@cyberskill/shared 3.12.0 → 3.14.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 (254) hide show
  1. package/dist/config/commitlint/index.d.ts +5 -1
  2. package/dist/{src/config → config}/config.type.d.ts +1 -1
  3. package/dist/{src/config → config}/config.util.d.ts +1 -1
  4. package/dist/{src/config → config}/env/env.util.d.ts +5 -0
  5. package/dist/config/env/env.util.js +20 -16
  6. package/dist/config/env/env.util.js.map +1 -1
  7. package/dist/config/env/index.d.ts +3 -1
  8. package/dist/config/env/index.js +2 -2
  9. package/dist/config/eslint/index.d.ts +1198 -1
  10. package/dist/config/graphql-codegen/index.d.ts +2 -1
  11. package/dist/config/index.d.ts +2 -1
  12. package/dist/config/lint-staged/index.d.ts +5 -1
  13. package/dist/config/storybook/index.d.ts +2 -1
  14. package/dist/config/vitest/index.d.ts +3 -1
  15. package/dist/config/vitest/vitest.e2e.d.ts +20 -1
  16. package/dist/config/vitest/vitest.e2e.js +4 -4
  17. package/dist/config/vitest/vitest.e2e.js.map +1 -1
  18. package/dist/config/vitest/vitest.unit.d.ts +22 -1
  19. package/dist/config/vitest/vitest.unit.js +5 -5
  20. package/dist/config/vitest/vitest.unit.js.map +1 -1
  21. package/dist/config/vitest/vitest.unit.setup.js +10 -0
  22. package/dist/config/vitest/vitest.unit.setup.js.map +1 -0
  23. package/dist/constant/index.d.ts +5 -1
  24. package/dist/node/apollo-server/apollo-server.type.d.ts +20 -0
  25. package/dist/{src/node → node}/apollo-server/apollo-server.util.d.ts +1 -0
  26. package/dist/node/apollo-server/apollo-server.util.js +40 -16
  27. package/dist/node/apollo-server/apollo-server.util.js.map +1 -1
  28. package/dist/node/apollo-server/index.d.ts +2 -1
  29. package/dist/node/cli/index.d.ts +2 -1
  30. package/dist/node/cli/index.js +26 -28
  31. package/dist/node/cli/index.js.map +1 -1
  32. package/dist/{src/node → node}/command/command.util.d.ts +5 -0
  33. package/dist/node/command/command.util.js +49 -48
  34. package/dist/node/command/command.util.js.map +1 -1
  35. package/dist/node/command/index.d.ts +2 -1
  36. package/dist/node/command/index.js +2 -2
  37. package/dist/{src/node → node}/express/express.type.d.ts +11 -0
  38. package/dist/{src/node → node}/express/express.util.d.ts +34 -6
  39. package/dist/node/express/express.util.js +81 -56
  40. package/dist/node/express/express.util.js.map +1 -1
  41. package/dist/node/express/index.d.ts +2 -1
  42. package/dist/node/express/index.js +2 -2
  43. package/dist/node/fs/index.d.ts +2 -1
  44. package/dist/node/log/index.d.ts +2 -1
  45. package/dist/node/log/log.type.d.ts +46 -0
  46. package/dist/node/log/log.type.js.map +1 -1
  47. package/dist/{src/node → node}/log/log.util.d.ts +1 -1
  48. package/dist/node/log/log.util.js +25 -11
  49. package/dist/node/log/log.util.js.map +1 -1
  50. package/dist/node/mongo/index.d.ts +7 -1
  51. package/dist/node/mongo/index.js +7 -8
  52. package/dist/{src/node → node}/mongo/mongo.constant.d.ts +5 -0
  53. package/dist/node/mongo/mongo.constant.js +2 -2
  54. package/dist/node/mongo/mongo.constant.js.map +1 -1
  55. package/dist/{src/node → node}/mongo/mongo.controller.helpers.d.ts +1 -1
  56. package/dist/{src/node → node}/mongo/mongo.controller.mongoose.d.ts +4 -1
  57. package/dist/node/mongo/mongo.controller.mongoose.js +41 -55
  58. package/dist/node/mongo/mongo.controller.mongoose.js.map +1 -1
  59. package/dist/{src/node → node}/mongo/mongo.controller.native.d.ts +30 -3
  60. package/dist/node/mongo/mongo.controller.native.js +31 -14
  61. package/dist/node/mongo/mongo.controller.native.js.map +1 -1
  62. package/dist/{src/node → node}/mongo/mongo.controller.type.d.ts +1 -1
  63. package/dist/{src/node → node}/mongo/mongo.type.d.ts +3 -1
  64. package/dist/{src/node → node}/mongo/mongo.util.d.ts +1 -0
  65. package/dist/node/mongo/mongo.util.js +38 -17
  66. package/dist/node/mongo/mongo.util.js.map +1 -1
  67. package/dist/node/package/index.d.ts +2 -1
  68. package/dist/{src/node → node}/package/package.util.d.ts +1 -1
  69. package/dist/node/package/package.util.js +47 -47
  70. package/dist/node/path/index.d.ts +2 -1
  71. package/dist/node/path/index.js +2 -2
  72. package/dist/{src/node → node}/path/path.constant.d.ts +4 -0
  73. package/dist/node/path/path.constant.js +75 -72
  74. package/dist/node/path/path.constant.js.map +1 -1
  75. package/dist/node/storage/index.d.ts +3 -1
  76. package/dist/{src/node → node}/storage/storage.util.d.ts +50 -1
  77. package/dist/node/storage/storage.util.js +79 -54
  78. package/dist/node/storage/storage.util.js.map +1 -1
  79. package/dist/node/upload/index.d.ts +3 -1
  80. package/dist/{src/node → node}/upload/upload.type.d.ts +2 -0
  81. package/dist/node/upload/upload.type.js.map +1 -1
  82. package/dist/{src/node → node}/upload/upload.util.d.ts +2 -1
  83. package/dist/node/upload/upload.util.js +62 -52
  84. package/dist/node/upload/upload.util.js.map +1 -1
  85. package/dist/node/ws/index.d.ts +2 -1
  86. package/dist/{src/node → node}/ws/ws.util.d.ts +7 -0
  87. package/dist/node/ws/ws.util.js +20 -19
  88. package/dist/node/ws/ws.util.js.map +1 -1
  89. package/dist/react/apollo-client/apollo-client.component.js.map +1 -1
  90. package/dist/{src/react → react}/apollo-client/apollo-client.type.d.ts +3 -1
  91. package/dist/react/apollo-client/apollo-client.util.js +6 -6
  92. package/dist/react/apollo-client/apollo-client.util.js.map +1 -1
  93. package/dist/react/apollo-client/index.d.ts +9 -1
  94. package/dist/react/apollo-client/links/index.d.ts +1 -1
  95. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts +16 -1
  96. package/dist/react/apollo-client-nextjs/index.d.ts +2 -1
  97. package/dist/react/apollo-error/apollo-error.component.js +1 -1
  98. package/dist/react/apollo-error/apollo-error.component.js.map +1 -1
  99. package/dist/react/apollo-error/apollo-error.util.js.map +1 -1
  100. package/dist/react/apollo-error/index.d.ts +6 -1
  101. package/dist/react/i18next/i18next.server.d.ts +17 -0
  102. package/dist/react/i18next/i18next.server.js +9 -0
  103. package/dist/react/i18next/i18next.server.js.map +1 -0
  104. package/dist/react/i18next/index.d.ts +2 -1
  105. package/dist/react/loading/index.d.ts +5 -1
  106. package/dist/{src/react → react}/loading/loading.provider.d.ts +1 -1
  107. package/dist/react/log/index.d.ts +2 -1
  108. package/dist/react/log/log.type.d.ts +1 -0
  109. package/dist/{src/react → react}/log/log.util.d.ts +1 -1
  110. package/dist/react/next-intl/index.d.ts +6 -1
  111. package/dist/{src/react → react}/next-intl/next-intl.hoc.d.ts +5 -9
  112. package/dist/react/next-intl/next-intl.hoc.js +14 -10
  113. package/dist/react/next-intl/next-intl.hoc.js.map +1 -1
  114. package/dist/react/next-intl/next-intl.server.d.ts +10 -0
  115. package/dist/react/next-intl/next-intl.server.js +7 -0
  116. package/dist/react/next-intl/next-intl.server.js.map +1 -0
  117. package/dist/{src/react → react}/next-intl/next-intl.type.d.ts +1 -1
  118. package/dist/react/storage/index.d.ts +2 -1
  119. package/dist/{src/react → react}/storage/storage.hook.d.ts +1 -1
  120. package/dist/{src/react → react}/storage/storage.util.d.ts +34 -1
  121. package/dist/react/storage/storage.util.js +30 -5
  122. package/dist/react/storage/storage.util.js.map +1 -1
  123. package/dist/react/toast/index.d.ts +1 -1
  124. package/dist/react/userback/index.d.ts +2 -1
  125. package/dist/react/userback/userback.component.js.map +1 -1
  126. package/dist/{src/typescript → typescript}/common.type.d.ts +4 -0
  127. package/dist/typescript/common.type.js +2 -2
  128. package/dist/typescript/common.type.js.map +1 -1
  129. package/dist/typescript/index.d.ts +5 -1
  130. package/dist/typescript/index.js +2 -2
  131. package/dist/util/common/index.d.ts +5 -1
  132. package/dist/util/index.d.ts +9 -1
  133. package/dist/util/log/index.d.ts +2 -1
  134. package/dist/{src/util → util}/log/log.util.d.ts +1 -1
  135. package/dist/util/object/index.d.ts +4 -1
  136. package/dist/util/object/object.util.js +29 -18
  137. package/dist/util/object/object.util.js.map +1 -1
  138. package/dist/util/serializer/index.d.ts +2 -1
  139. package/dist/{src/util → util}/serializer/serializer.util.d.ts +8 -0
  140. package/dist/util/serializer/serializer.util.js +51 -64
  141. package/dist/util/serializer/serializer.util.js.map +1 -1
  142. package/dist/util/storage/storage-envelope.d.ts +25 -0
  143. package/dist/util/storage/storage-envelope.js +18 -0
  144. package/dist/util/storage/storage-envelope.js.map +1 -0
  145. package/dist/util/string/index.d.ts +5 -1
  146. package/dist/util/validate/index.d.ts +4 -1
  147. package/package.json +33 -12
  148. package/dist/node/mongo/mongo.type.js +0 -8
  149. package/dist/node/mongo/mongo.type.js.map +0 -1
  150. package/dist/node_modules/.pnpm/vitest@4.1.2_@types_node@25.5.0_jsdom@29.0.1_@noble_hashes@1.8.0__vite@8.0.3_@types_nod_0827261ede788764a5d99ac6bdf44bde/node_modules/vitest/dist/config.js +0 -8
  151. package/dist/node_modules/.pnpm/vitest@4.1.2_@types_node@25.5.0_jsdom@29.0.1_@noble_hashes@1.8.0__vite@8.0.3_@types_nod_0827261ede788764a5d99ac6bdf44bde/node_modules/vitest/dist/config.js.map +0 -1
  152. package/dist/src/config/commitlint/index.d.ts +0 -5
  153. package/dist/src/config/env/index.d.ts +0 -3
  154. package/dist/src/config/eslint/index.d.ts +0 -1198
  155. package/dist/src/config/graphql-codegen/index.d.ts +0 -2
  156. package/dist/src/config/index.d.ts +0 -2
  157. package/dist/src/config/lint-staged/index.d.ts +0 -5
  158. package/dist/src/config/storybook/index.d.ts +0 -2
  159. package/dist/src/config/vitest/index.d.ts +0 -3
  160. package/dist/src/config/vitest/vitest.e2e.d.ts +0 -20
  161. package/dist/src/config/vitest/vitest.unit.d.ts +0 -22
  162. package/dist/src/constant/index.d.ts +0 -5
  163. package/dist/src/node/apollo-server/apollo-server.type.d.ts +0 -8
  164. package/dist/src/node/apollo-server/index.d.ts +0 -2
  165. package/dist/src/node/cli/index.d.ts +0 -2
  166. package/dist/src/node/command/index.d.ts +0 -2
  167. package/dist/src/node/express/index.d.ts +0 -2
  168. package/dist/src/node/fs/index.d.ts +0 -2
  169. package/dist/src/node/log/index.d.ts +0 -2
  170. package/dist/src/node/log/log.type.d.ts +0 -29
  171. package/dist/src/node/mongo/index.d.ts +0 -6
  172. package/dist/src/node/package/index.d.ts +0 -2
  173. package/dist/src/node/path/index.d.ts +0 -2
  174. package/dist/src/node/storage/index.d.ts +0 -3
  175. package/dist/src/node/upload/index.d.ts +0 -3
  176. package/dist/src/node/ws/index.d.ts +0 -2
  177. package/dist/src/react/apollo-client/index.d.ts +0 -9
  178. package/dist/src/react/apollo-client/links/index.d.ts +0 -1
  179. package/dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts +0 -16
  180. package/dist/src/react/apollo-client-nextjs/index.d.ts +0 -2
  181. package/dist/src/react/apollo-error/index.d.ts +0 -6
  182. package/dist/src/react/i18next/index.d.ts +0 -2
  183. package/dist/src/react/loading/index.d.ts +0 -5
  184. package/dist/src/react/log/index.d.ts +0 -2
  185. package/dist/src/react/log/log.type.d.ts +0 -1
  186. package/dist/src/react/next-intl/index.d.ts +0 -6
  187. package/dist/src/react/storage/index.d.ts +0 -2
  188. package/dist/src/react/toast/index.d.ts +0 -1
  189. package/dist/src/react/userback/index.d.ts +0 -2
  190. package/dist/src/typescript/index.d.ts +0 -5
  191. package/dist/src/util/common/index.d.ts +0 -5
  192. package/dist/src/util/index.d.ts +0 -9
  193. package/dist/src/util/log/index.d.ts +0 -2
  194. package/dist/src/util/object/index.d.ts +0 -4
  195. package/dist/src/util/serializer/index.d.ts +0 -2
  196. package/dist/src/util/string/index.d.ts +0 -5
  197. package/dist/src/util/validate/index.d.ts +0 -4
  198. /package/dist/{src/config → config}/env/env.constant.d.ts +0 -0
  199. /package/dist/{src/config → config}/env/env.type.d.ts +0 -0
  200. /package/dist/{src/config → config}/graphql-codegen/graphql-codegen.type.d.ts +0 -0
  201. /package/dist/{src/config → config}/graphql-codegen/graphql-codegen.util.d.ts +0 -0
  202. /package/dist/{src/config → config}/storybook/storybook.main.d.ts +0 -0
  203. /package/dist/{src/config → config}/storybook/storybook.preview.d.ts +0 -0
  204. /package/dist/{src/config → config}/vitest/vitest.unit.setup.d.ts +0 -0
  205. /package/dist/{src/constant → constant}/common.d.ts +0 -0
  206. /package/dist/{src/constant → constant}/response-status.d.ts +0 -0
  207. /package/dist/{src/node → node}/command/command.type.d.ts +0 -0
  208. /package/dist/{src/node → node}/fs/fs.type.d.ts +0 -0
  209. /package/dist/{src/node → node}/fs/fs.util.d.ts +0 -0
  210. /package/dist/{src/node → node}/mongo/mongo.controller.d.ts +0 -0
  211. /package/dist/{src/node → node}/mongo/mongo.dynamic-populate.d.ts +0 -0
  212. /package/dist/{src/node → node}/mongo/mongo.internal-types.d.ts +0 -0
  213. /package/dist/{src/node → node}/mongo/mongo.populate.d.ts +0 -0
  214. /package/dist/{src/node → node}/package/package.type.d.ts +0 -0
  215. /package/dist/{src/node → node}/path/path.util.d.ts +0 -0
  216. /package/dist/{src/node → node}/storage/storage.constant.d.ts +0 -0
  217. /package/dist/{src/node → node}/storage/storage.type.d.ts +0 -0
  218. /package/dist/{src/node → node}/upload/upload.constant.d.ts +0 -0
  219. /package/dist/{src/node → node}/ws/ws.type.d.ts +0 -0
  220. /package/dist/{src/react → react}/apollo-client/apollo-client.component.d.ts +0 -0
  221. /package/dist/{src/react → react}/apollo-client/apollo-client.constant.d.ts +0 -0
  222. /package/dist/{src/react → react}/apollo-client/apollo-client.context.d.ts +0 -0
  223. /package/dist/{src/react → react}/apollo-client/apollo-client.hook.d.ts +0 -0
  224. /package/dist/{src/react → react}/apollo-client/apollo-client.util.d.ts +0 -0
  225. /package/dist/{src/react → react}/apollo-client/links/upload.d.ts +0 -0
  226. /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +0 -0
  227. /package/dist/{src/react → react}/apollo-client-nextjs/apollo-client-nextjs.util.d.ts +0 -0
  228. /package/dist/{src/react → react}/apollo-error/apollo-error.component.d.ts +0 -0
  229. /package/dist/{src/react → react}/apollo-error/apollo-error.context.d.ts +0 -0
  230. /package/dist/{src/react → react}/apollo-error/apollo-error.hook.d.ts +0 -0
  231. /package/dist/{src/react → react}/apollo-error/apollo-error.provider.d.ts +0 -0
  232. /package/dist/{src/react → react}/apollo-error/apollo-error.type.d.ts +0 -0
  233. /package/dist/{src/react → react}/apollo-error/apollo-error.util.d.ts +0 -0
  234. /package/dist/{src/react → react}/i18next/i18next.hook.d.ts +0 -0
  235. /package/dist/{src/react → react}/i18next/i18next.util.d.ts +0 -0
  236. /package/dist/{src/react → react}/loading/loading.component.d.ts +0 -0
  237. /package/dist/{src/react → react}/loading/loading.context.d.ts +0 -0
  238. /package/dist/{src/react → react}/loading/loading.hook.d.ts +0 -0
  239. /package/dist/{src/react → react}/loading/loading.type.d.ts +0 -0
  240. /package/dist/{src/react → react}/next-intl/next-intl.constant.d.ts +0 -0
  241. /package/dist/{src/react → react}/next-intl/next-intl.context.d.ts +0 -0
  242. /package/dist/{src/react → react}/next-intl/next-intl.hook.d.ts +0 -0
  243. /package/dist/{src/react → react}/next-intl/next-intl.provider.d.ts +0 -0
  244. /package/dist/{src/react → react}/userback/userback.component.d.ts +0 -0
  245. /package/dist/{src/react → react}/userback/userback.type.d.ts +0 -0
  246. /package/dist/{src/typescript → typescript}/react.type.d.ts +0 -0
  247. /package/dist/{src/util → util}/common/common.type.d.ts +0 -0
  248. /package/dist/{src/util → util}/common/common.util.d.ts +0 -0
  249. /package/dist/{src/util → util}/log/log.type.d.ts +0 -0
  250. /package/dist/{src/util → util}/object/object.util.d.ts +0 -0
  251. /package/dist/{src/util → util}/serializer/serializer.type.d.ts +0 -0
  252. /package/dist/{src/util → util}/string/string.type.d.ts +0 -0
  253. /package/dist/{src/util → util}/string/string.util.d.ts +0 -0
  254. /package/dist/{src/util → util}/validate/validate.util.d.ts +0 -0
@@ -1 +1,2 @@
1
- export {}
1
+ export * from './graphql-codegen.type.js';
2
+ export * from './graphql-codegen.util.js';
@@ -1 +1,2 @@
1
- export {}
1
+ export * from './config.type.js';
2
+ export * from './config.util.js';
@@ -1 +1,5 @@
1
- export {}
1
+ declare const _default: {
2
+ '*.ts': () => string;
3
+ '*': string[];
4
+ };
5
+ export default _default;
@@ -1 +1,2 @@
1
- export {}
1
+ export * from './storybook.main.js';
2
+ export * from './storybook.preview.js';
@@ -1 +1,3 @@
1
- export {}
1
+ export * from './vitest.e2e.js';
2
+ export * from './vitest.unit.js';
3
+ export * from './vitest.unit.setup.js';
@@ -1 +1,20 @@
1
- export {}
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * Creates a Vitest configuration for end-to-end testing with browser automation.
4
+ * This function generates a Vitest configuration specifically designed for E2E testing
5
+ * using Playwright with multiple browser instances. It includes React support and
6
+ * browser automation capabilities for comprehensive end-to-end testing.
7
+ *
8
+ * The configuration includes:
9
+ * - React SWC plugin for fast React compilation
10
+ * - Browser automation with Playwright provider
11
+ * - Multiple browser instances (Chromium, Firefox, WebKit)
12
+ * - E2E test file pattern matching
13
+ * - Configurable options merging
14
+ *
15
+ * @param options - Additional Vite configuration options to merge with the E2E config.
16
+ * @returns A Vitest configuration object optimized for end-to-end testing with browser automation.
17
+ */
18
+ export declare function vitestE2E(options: UserConfig): UserConfig;
19
+ declare const _default: UserConfig;
20
+ export default _default;
@@ -1,10 +1,10 @@
1
1
  import { deepMerge as e } from "../../util/object/object.util.js";
2
- import { defineConfig as t } from "../../node_modules/.pnpm/vitest@4.1.2_@types_node@25.5.0_jsdom@29.0.1_@noble_hashes@1.8.0__vite@8.0.3_@types_nod_0827261ede788764a5d99ac6bdf44bde/node_modules/vitest/dist/config.js";
3
- import n from "@vitejs/plugin-react";
2
+ import t from "@vitejs/plugin-react";
3
+ import { defineConfig as n } from "vitest/config";
4
4
  //#region src/config/vitest/vitest.e2e.ts
5
5
  function r(r) {
6
- return t(e({
7
- plugins: [n()],
6
+ return n(e({
7
+ plugins: [t()],
8
8
  test: { include: ["**/*.test.e2e.?(c|m)[jt]s?(x)"] }
9
9
  }, r));
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.e2e.js","names":[],"sources":["../../../src/config/vitest/vitest.e2e.ts"],"sourcesContent":["import type { UserConfig } from 'vite';\n\nimport react from '@vitejs/plugin-react';\nimport { defineConfig } from 'vitest/config';\n\nimport { deepMerge } from '../../util/object/index.js';\n\n/**\n * Creates a Vitest configuration for end-to-end testing with browser automation.\n * This function generates a Vitest configuration specifically designed for E2E testing\n * using Playwright with multiple browser instances. It includes React support and\n * browser automation capabilities for comprehensive end-to-end testing.\n *\n * The configuration includes:\n * - React SWC plugin for fast React compilation\n * - Browser automation with Playwright provider\n * - Multiple browser instances (Chromium, Firefox, WebKit)\n * - E2E test file pattern matching\n * - Configurable options merging\n *\n * @param options - Additional Vite configuration options to merge with the E2E config.\n * @returns A Vitest configuration object optimized for end-to-end testing with browser automation.\n */\nexport function vitestE2E(options: UserConfig) {\n const config = {\n plugins: [react()],\n test: {\n include: ['**/*.test.e2e.?(c|m)[jt]s?(x)'],\n },\n };\n\n return defineConfig(deepMerge(config as any, options as any) as UserConfig);\n}\n\nexport default vitestE2E({});\n"],"mappings":";;;;AAuBA,SAAgB,EAAU,GAAqB;AAQ3C,QAAO,EAAa,EAPL;EACX,SAAS,CAAC,GAAO,CAAC;EAClB,MAAM,EACF,SAAS,CAAC,gCAAgC,EAC7C;EACJ,EAE4C,EAAe,CAAe;;AAG/E,IAAA,IAAe,EAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"vitest.e2e.js","names":[],"sources":["../../../src/config/vitest/vitest.e2e.ts"],"sourcesContent":["import type { UserConfig } from 'vite';\n\nimport react from '@vitejs/plugin-react';\nimport { defineConfig } from 'vitest/config';\n\nimport { deepMerge } from '../../util/object/index.js';\n\n/**\n * Creates a Vitest configuration for end-to-end testing with browser automation.\n * This function generates a Vitest configuration specifically designed for E2E testing\n * using Playwright with multiple browser instances. It includes React support and\n * browser automation capabilities for comprehensive end-to-end testing.\n *\n * The configuration includes:\n * - React SWC plugin for fast React compilation\n * - Browser automation with Playwright provider\n * - Multiple browser instances (Chromium, Firefox, WebKit)\n * - E2E test file pattern matching\n * - Configurable options merging\n *\n * @param options - Additional Vite configuration options to merge with the E2E config.\n * @returns A Vitest configuration object optimized for end-to-end testing with browser automation.\n */\nexport function vitestE2E(options: UserConfig) {\n const config = {\n plugins: [react()],\n test: {\n include: ['**/*.test.e2e.?(c|m)[jt]s?(x)'],\n },\n };\n\n return defineConfig(deepMerge<UserConfig>(config, options));\n}\n\nexport default vitestE2E({});\n"],"mappings":";;;;AAuBA,SAAgB,EAAU,GAAqB;AAQ3C,QAAO,EAAa,EAPL;EACX,SAAS,CAAC,GAAO,CAAC;EAClB,MAAM,EACF,SAAS,CAAC,gCAAgC,EAC7C;EACJ,EAEiD,EAAQ,CAAC;;AAG/D,IAAA,IAAe,EAAU,EAAE,CAAC"}
@@ -1 +1,22 @@
1
- export {}
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * Creates a Vitest configuration for unit testing with React support.
4
+ * This function generates a Vitest configuration specifically designed for unit testing
5
+ * React components and JavaScript/TypeScript modules. It includes JSDOM environment
6
+ * for DOM simulation and comprehensive testing setup.
7
+ *
8
+ * The configuration includes:
9
+ * - React SWC plugin for fast React compilation
10
+ * - JSDOM environment for DOM simulation
11
+ * - Global test functions availability
12
+ * - VM threads pool for parallel test execution
13
+ * - Unit test file pattern matching
14
+ * - Setup files for testing library configuration
15
+ * - Configurable options merging
16
+ *
17
+ * @param options - Additional Vite configuration options to merge with the unit test config.
18
+ * @returns A Vitest configuration object optimized for unit testing with React and DOM support.
19
+ */
20
+ export declare function vitestUnit(options: UserConfig): UserConfig;
21
+ declare const _default: UserConfig;
22
+ export default _default;
@@ -1,16 +1,16 @@
1
1
  import { deepMerge as e } from "../../util/object/object.util.js";
2
- import { defineConfig as t } from "../../node_modules/.pnpm/vitest@4.1.2_@types_node@25.5.0_jsdom@29.0.1_@noble_hashes@1.8.0__vite@8.0.3_@types_nod_0827261ede788764a5d99ac6bdf44bde/node_modules/vitest/dist/config.js";
3
- import n from "@vitejs/plugin-react";
2
+ import t from "@vitejs/plugin-react";
3
+ import { defineConfig as n } from "vitest/config";
4
4
  //#region src/config/vitest/vitest.unit.ts
5
5
  function r(r) {
6
- return t(e({
7
- plugins: [n()],
6
+ return n(e({
7
+ plugins: [t()],
8
8
  test: {
9
9
  globals: !0,
10
10
  environment: "jsdom",
11
11
  pool: "vmThreads",
12
12
  include: ["**/*.test.unit.?(c|m)[jt]s?(x)"],
13
- setupFiles: ["./vitest.unit.setup.ts"],
13
+ setupFiles: [`${import.meta.dirname}/vitest.unit.setup.js`],
14
14
  coverage: {
15
15
  provider: "istanbul",
16
16
  reporter: ["text", "lcov"],
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.unit.js","names":[],"sources":["../../../src/config/vitest/vitest.unit.ts"],"sourcesContent":["import type { UserConfig } from 'vite';\n\nimport react from '@vitejs/plugin-react';\nimport { defineConfig } from 'vitest/config';\n\nimport { deepMerge } from '#util/object/index.js';\n\n/**\n * Creates a Vitest configuration for unit testing with React support.\n * This function generates a Vitest configuration specifically designed for unit testing\n * React components and JavaScript/TypeScript modules. It includes JSDOM environment\n * for DOM simulation and comprehensive testing setup.\n *\n * The configuration includes:\n * - React SWC plugin for fast React compilation\n * - JSDOM environment for DOM simulation\n * - Global test functions availability\n * - VM threads pool for parallel test execution\n * - Unit test file pattern matching\n * - Setup files for testing library configuration\n * - Configurable options merging\n *\n * @param options - Additional Vite configuration options to merge with the unit test config.\n * @returns A Vitest configuration object optimized for unit testing with React and DOM support.\n */\nexport function vitestUnit(options: UserConfig) {\n const config = {\n plugins: [react()],\n test: {\n globals: true,\n environment: 'jsdom',\n pool: 'vmThreads',\n include: ['**/*.test.unit.?(c|m)[jt]s?(x)'],\n setupFiles: ['./vitest.unit.setup.ts'],\n coverage: {\n provider: 'istanbul',\n reporter: ['text', 'lcov'],\n reportsDirectory: './coverage',\n thresholds: {\n statements: 80,\n branches: 80,\n functions: 80,\n lines: 80,\n },\n },\n },\n };\n\n return defineConfig(deepMerge(config as any, options as any) as UserConfig);\n}\n\nexport default vitestUnit({});\n"],"mappings":";;;;AAyBA,SAAgB,EAAW,GAAqB;AAuB5C,QAAO,EAAa,EAtBL;EACX,SAAS,CAAC,GAAO,CAAC;EAClB,MAAM;GACF,SAAS;GACT,aAAa;GACb,MAAM;GACN,SAAS,CAAC,iCAAiC;GAC3C,YAAY,CAAC,yBAAyB;GACtC,UAAU;IACN,UAAU;IACV,UAAU,CAAC,QAAQ,OAAO;IAC1B,kBAAkB;IAClB,YAAY;KACR,YAAY;KACZ,UAAU;KACV,WAAW;KACX,OAAO;KACV;IACJ;GACJ;EACJ,EAE4C,EAAe,CAAe;;AAG/E,IAAA,IAAe,EAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"vitest.unit.js","names":[],"sources":["../../../src/config/vitest/vitest.unit.ts"],"sourcesContent":["import type { UserConfig } from 'vite';\n\nimport react from '@vitejs/plugin-react';\nimport { defineConfig } from 'vitest/config';\n\nimport { deepMerge } from '#util/object/index.js';\n\n/**\n * Creates a Vitest configuration for unit testing with React support.\n * This function generates a Vitest configuration specifically designed for unit testing\n * React components and JavaScript/TypeScript modules. It includes JSDOM environment\n * for DOM simulation and comprehensive testing setup.\n *\n * The configuration includes:\n * - React SWC plugin for fast React compilation\n * - JSDOM environment for DOM simulation\n * - Global test functions availability\n * - VM threads pool for parallel test execution\n * - Unit test file pattern matching\n * - Setup files for testing library configuration\n * - Configurable options merging\n *\n * @param options - Additional Vite configuration options to merge with the unit test config.\n * @returns A Vitest configuration object optimized for unit testing with React and DOM support.\n */\nexport function vitestUnit(options: UserConfig) {\n const config = {\n plugins: [react()],\n test: {\n globals: true,\n environment: 'jsdom',\n pool: 'vmThreads',\n include: ['**/*.test.unit.?(c|m)[jt]s?(x)'],\n setupFiles: [`${import.meta.dirname}/vitest.unit.setup.js`],\n coverage: {\n provider: 'istanbul',\n reporter: ['text', 'lcov'],\n reportsDirectory: './coverage',\n thresholds: {\n statements: 80,\n branches: 80,\n functions: 80,\n lines: 80,\n },\n },\n },\n };\n\n return defineConfig(deepMerge<UserConfig>(config, options));\n}\n\nexport default vitestUnit({});\n"],"mappings":";;;;AAyBA,SAAgB,EAAW,GAAqB;AAuB5C,QAAO,EAAa,EAtBL;EACX,SAAS,CAAC,GAAO,CAAC;EAClB,MAAM;GACF,SAAS;GACT,aAAa;GACb,MAAM;GACN,SAAS,CAAC,iCAAiC;GAC3C,YAAY,CAAC,GAAG,OAAO,KAAK,QAAQ,uBAAuB;GAC3D,UAAU;IACN,UAAU;IACV,UAAU,CAAC,QAAQ,OAAO;IAC1B,kBAAkB;IAClB,YAAY;KACR,YAAY;KACZ,UAAU;KACV,WAAW;KACX,OAAO;KACV;IACJ;GACJ;EACJ,EAEiD,EAAQ,CAAC;;AAG/D,IAAA,IAAe,EAAW,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import "@testing-library/jest-dom/vitest";
2
+ import { cleanup as e } from "@testing-library/react";
3
+ import { afterEach as t } from "vitest";
4
+ //#region src/config/vitest/vitest.unit.setup.ts
5
+ t(() => {
6
+ e();
7
+ });
8
+ //#endregion
9
+
10
+ //# sourceMappingURL=vitest.unit.setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.unit.setup.js","names":[],"sources":["../../../src/config/vitest/vitest.unit.setup.ts"],"sourcesContent":["import '@testing-library/jest-dom/vitest';\nimport { cleanup } from '@testing-library/react';\nimport { afterEach } from 'vitest';\n\nafterEach(() => {\n cleanup();\n});\n"],"mappings":";;;;AAIA,QAAgB;AACZ,IAAS;EACX"}
@@ -1 +1,5 @@
1
- export {}
1
+ /**
2
+ * Re-exports all common constants for shared usage across the codebase.
3
+ */
4
+ export * from './common.js';
5
+ export * from './response-status.js';
@@ -0,0 +1,20 @@
1
+ import { GraphQLSchema, ValidationRule } from 'graphql';
2
+ import { Server } from 'node:http';
3
+ export interface I_ApolloServerOptions {
4
+ server: Server;
5
+ schema: GraphQLSchema;
6
+ isDev?: boolean;
7
+ drainServer?: () => Promise<void>;
8
+ /**
9
+ * Maximum allowed depth for GraphQL queries.
10
+ * Limits deeply nested queries to prevent abuse and denial-of-service.
11
+ * Set to `0` or `false` to disable depth limiting entirely.
12
+ * @default 10
13
+ */
14
+ maxQueryDepth?: number | false;
15
+ /**
16
+ * Additional GraphQL validation rules applied to every incoming operation.
17
+ * These are appended after the built-in depth-limit rule (if enabled).
18
+ */
19
+ validationRules?: ValidationRule[];
20
+ }
@@ -11,6 +11,7 @@ import { I_ApolloServerOptions } from './apollo-server.type.js';
11
11
  * - HTTP server draining plugin for graceful shutdowns
12
12
  * - Optional custom drain server hook for additional cleanup
13
13
  * - Development-specific settings (introspection and stack traces) when isDev is true
14
+ * - Query depth limiting (default: 10) to prevent deeply nested query abuse
14
15
  *
15
16
  * @param options - Configuration options for the Apollo Server including server instance, schema, and environment settings.
16
17
  * @returns A configured Apollo Server instance ready to be started.
@@ -1,30 +1,54 @@
1
- import { log as e } from "../log/log.util.js";
2
- import t from "node:process";
3
- import { ApolloServer as n } from "@apollo/server";
4
- import { ApolloServerPluginDrainHttpServer as r } from "@apollo/server/plugin/drainHttpServer";
5
- import { ApolloServerPluginLandingPageLocalDefault as i, ApolloServerPluginLandingPageProductionDefault as a } from "@apollo/server/plugin/landingPage/default";
6
- import { expressMiddleware as o } from "@as-integrations/express5";
1
+ import { E_Environment as e } from "../../typescript/common.type.js";
2
+ import { log as t } from "../log/log.util.js";
3
+ import { GraphQLError as n, Kind as r } from "graphql";
4
+ import i from "node:process";
5
+ import { ApolloServer as a } from "@apollo/server";
6
+ import { ApolloServerPluginDrainHttpServer as o } from "@apollo/server/plugin/drainHttpServer";
7
+ import { ApolloServerPluginLandingPageLocalDefault as s, ApolloServerPluginLandingPageProductionDefault as c } from "@apollo/server/plugin/landingPage/default";
8
+ import { expressMiddleware as l } from "@as-integrations/express5";
7
9
  //#region src/node/apollo-server/apollo-server.util.ts
8
- function s(o) {
9
- let s = o.isDev && t.env.NODE_ENV !== "production";
10
- return new n({
11
- schema: o.schema,
10
+ var u = 10;
11
+ function d(e) {
12
+ return function(t) {
13
+ return { Document: { enter(n) {
14
+ for (let i of n.definitions) (i.kind === r.OPERATION_DEFINITION || i.kind === r.FRAGMENT_DEFINITION) && f(i.selectionSet, 0, e, t);
15
+ } } };
16
+ };
17
+ }
18
+ function f(e, t, i, a) {
19
+ if (e) for (let o of e.selections) if (o.kind === r.FIELD) {
20
+ if (t >= i) {
21
+ a.reportError(new n(`Query depth of ${t + 1} exceeds the maximum allowed depth of ${i}.`));
22
+ return;
23
+ }
24
+ o.selectionSet && f(o.selectionSet, t + 1, i, a);
25
+ } else (o.kind === r.INLINE_FRAGMENT || o.kind === r.FRAGMENT_SPREAD) && f(o.selectionSet, t, i, a);
26
+ }
27
+ function p(n) {
28
+ let r = n.isDev && i.env.NODE_ENV !== e.PRODUCTION, l = m(n);
29
+ return new a({
30
+ schema: n.schema,
12
31
  plugins: [
13
- s ? i() : a(),
14
- r({ httpServer: o.server }),
15
- ...o.drainServer ? [{ async serverWillStart() {
32
+ r ? s() : c(),
33
+ o({ httpServer: n.server }),
34
+ ...n.drainServer ? [{ async serverWillStart() {
16
35
  return { async drainServer() {
17
- o.drainServer?.(), e.info("Apollo Server drainServer hook called");
36
+ n.drainServer?.(), t.info("Apollo Server drainServer hook called");
18
37
  } };
19
38
  } }] : []
20
39
  ],
21
- ...s && {
40
+ ...l.length > 0 && { validationRules: l },
41
+ ...r && {
22
42
  introspection: !0,
23
43
  includeStacktraceInErrorResponses: !0
24
44
  }
25
45
  });
26
46
  }
47
+ function m(e) {
48
+ let t = [], n = e.maxQueryDepth;
49
+ return n !== !1 && n !== 0 && t.push(d(typeof n == "number" ? n : u)), e.validationRules && t.push(...e.validationRules), t;
50
+ }
27
51
  //#endregion
28
- export { s as createApolloServer, o as expressMiddleware };
52
+ export { p as createApolloServer, l as expressMiddleware };
29
53
 
30
54
  //# sourceMappingURL=apollo-server.util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"apollo-server.util.js","names":[],"sources":["../../../src/node/apollo-server/apollo-server.util.ts"],"sourcesContent":["import { ApolloServer } from '@apollo/server';\nimport { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';\nimport {\n ApolloServerPluginLandingPageLocalDefault,\n ApolloServerPluginLandingPageProductionDefault,\n} from '@apollo/server/plugin/landingPage/default';\nimport { expressMiddleware } from '@as-integrations/express5';\nimport process from 'node:process';\n\nimport type { I_ApolloServerOptions } from './apollo-server.type.js';\n\nimport { log } from '../log/index.js';\n\n/**\n * Creates and configures an Apollo Server instance with appropriate plugins and settings.\n * This function sets up an Apollo Server with development or production landing pages,\n * HTTP server draining capabilities, and optional custom drain server hooks.\n *\n * The server is configured with:\n * - Development or production landing page based on the isDev flag\n * - HTTP server draining plugin for graceful shutdowns\n * - Optional custom drain server hook for additional cleanup\n * - Development-specific settings (introspection and stack traces) when isDev is true\n *\n * @param options - Configuration options for the Apollo Server including server instance, schema, and environment settings.\n * @returns A configured Apollo Server instance ready to be started.\n */\nexport function createApolloServer(options: I_ApolloServerOptions): ApolloServer {\n // Defense-in-depth: never enable dev features when NODE_ENV is 'production'\n const safeIsDev = options.isDev && process.env['NODE_ENV'] !== 'production';\n\n return new ApolloServer({\n schema: options.schema,\n plugins: [\n safeIsDev\n ? ApolloServerPluginLandingPageLocalDefault()\n : ApolloServerPluginLandingPageProductionDefault(),\n ApolloServerPluginDrainHttpServer({ httpServer: options.server }),\n ...(options.drainServer\n ? [{\n async serverWillStart() {\n return {\n async drainServer() {\n options.drainServer?.();\n log.info('Apollo Server drainServer hook called');\n },\n };\n },\n }]\n : []),\n ],\n ...(safeIsDev && {\n introspection: true,\n includeStacktraceInErrorResponses: true,\n }),\n });\n}\n\nexport { expressMiddleware };\n"],"mappings":";;;;;;;AA2BA,SAAgB,EAAmB,GAA8C;CAE7E,IAAM,IAAY,EAAQ,SAAS,EAAQ,IAAI,aAAgB;AAE/D,QAAO,IAAI,EAAa;EACpB,QAAQ,EAAQ;EAChB,SAAS;GACL,IACM,GAA2C,GAC3C,GAAgD;GACtD,EAAkC,EAAE,YAAY,EAAQ,QAAQ,CAAC;GACjE,GAAI,EAAQ,cACN,CAAC,EACK,MAAM,kBAAkB;AACpB,WAAO,EACH,MAAM,cAAc;AAEhB,KADA,EAAQ,eAAe,EACvB,EAAI,KAAK,wCAAwC;OAExD;MAER,CAAC,GACJ,EAAE;GACX;EACD,GAAI,KAAa;GACb,eAAe;GACf,mCAAmC;GACtC;EACJ,CAAC"}
1
+ {"version":3,"file":"apollo-server.util.js","names":[],"sources":["../../../src/node/apollo-server/apollo-server.util.ts"],"sourcesContent":["import type { ASTVisitor, ValidationContext } from 'graphql';\n\nimport { ApolloServer } from '@apollo/server';\nimport { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';\nimport {\n ApolloServerPluginLandingPageLocalDefault,\n ApolloServerPluginLandingPageProductionDefault,\n} from '@apollo/server/plugin/landingPage/default';\nimport { expressMiddleware } from '@as-integrations/express5';\nimport { GraphQLError, Kind } from 'graphql';\nimport process from 'node:process';\n\nimport { E_Environment } from '#typescript/index.js';\n\nimport type { I_ApolloServerOptions } from './apollo-server.type.js';\n\nimport { log } from '../log/index.js';\n\nconst DEFAULT_MAX_QUERY_DEPTH = 10;\n\n/**\n * Creates a GraphQL validation rule that rejects operations exceeding the\n * specified nesting depth. This prevents deeply nested queries from consuming\n * excessive server resources (query-depth DoS).\n *\n * @param maxDepth - Maximum allowed selection-set nesting depth.\n * @returns A GraphQL validation rule function.\n */\nfunction createDepthLimitRule(maxDepth: number) {\n return function depthLimit(context: ValidationContext): ASTVisitor {\n return {\n Document: {\n enter(node) {\n for (const definition of node.definitions) {\n if (definition.kind === Kind.OPERATION_DEFINITION || definition.kind === Kind.FRAGMENT_DEFINITION) {\n measureDepth(definition.selectionSet, 0, maxDepth, context);\n }\n }\n },\n },\n };\n };\n}\n\n/**\n * Recursively measures selection-set depth and reports an error when exceeded.\n */\nfunction measureDepth(\n selectionSet: { selections: readonly { kind: string; selectionSet?: { selections: readonly unknown[] } }[] } | undefined,\n currentDepth: number,\n maxDepth: number,\n context: ValidationContext,\n) {\n if (!selectionSet) {\n return;\n }\n\n for (const selection of selectionSet.selections) {\n if (selection.kind === Kind.FIELD) {\n if (currentDepth >= maxDepth) {\n context.reportError(\n new GraphQLError(`Query depth of ${currentDepth + 1} exceeds the maximum allowed depth of ${maxDepth}.`),\n );\n return;\n }\n\n if (selection.selectionSet) {\n measureDepth(\n selection.selectionSet as Parameters<typeof measureDepth>[0],\n currentDepth + 1,\n maxDepth,\n context,\n );\n }\n }\n else if (selection.kind === Kind.INLINE_FRAGMENT || selection.kind === Kind.FRAGMENT_SPREAD) {\n measureDepth(\n (selection as { selectionSet?: Parameters<typeof measureDepth>[0] }).selectionSet,\n currentDepth,\n maxDepth,\n context,\n );\n }\n }\n}\n\n/**\n * Creates and configures an Apollo Server instance with appropriate plugins and settings.\n * This function sets up an Apollo Server with development or production landing pages,\n * HTTP server draining capabilities, and optional custom drain server hooks.\n *\n * The server is configured with:\n * - Development or production landing page based on the isDev flag\n * - HTTP server draining plugin for graceful shutdowns\n * - Optional custom drain server hook for additional cleanup\n * - Development-specific settings (introspection and stack traces) when isDev is true\n * - Query depth limiting (default: 10) to prevent deeply nested query abuse\n *\n * @param options - Configuration options for the Apollo Server including server instance, schema, and environment settings.\n * @returns A configured Apollo Server instance ready to be started.\n */\nexport function createApolloServer(options: I_ApolloServerOptions): ApolloServer {\n // Defense-in-depth: never enable dev features when NODE_ENV is 'production'\n const safeIsDev = options.isDev && process.env['NODE_ENV'] !== E_Environment.PRODUCTION;\n\n // Build validation rules: depth limit + user-provided rules\n const validationRules = buildValidationRules(options);\n\n return new ApolloServer({\n schema: options.schema,\n plugins: [\n safeIsDev\n ? ApolloServerPluginLandingPageLocalDefault()\n : ApolloServerPluginLandingPageProductionDefault(),\n ApolloServerPluginDrainHttpServer({ httpServer: options.server }),\n ...(options.drainServer\n ? [{\n async serverWillStart() {\n return {\n async drainServer() {\n options.drainServer?.();\n log.info('Apollo Server drainServer hook called');\n },\n };\n },\n }]\n : []),\n ],\n ...(validationRules.length > 0 && { validationRules }),\n ...(safeIsDev && {\n introspection: true,\n includeStacktraceInErrorResponses: true,\n }),\n });\n}\n\n/**\n * Assembles the final list of GraphQL validation rules, prepending the\n * built-in depth-limit rule (unless explicitly disabled) before any\n * consumer-supplied rules.\n */\nfunction buildValidationRules(options: I_ApolloServerOptions) {\n const rules = [];\n const maxDepth = options.maxQueryDepth;\n\n if (maxDepth !== false && maxDepth !== 0) {\n const depth = typeof maxDepth === 'number' ? maxDepth : DEFAULT_MAX_QUERY_DEPTH;\n rules.push(createDepthLimitRule(depth));\n }\n\n if (options.validationRules) {\n rules.push(...options.validationRules);\n }\n\n return rules;\n}\n\nexport { expressMiddleware };\n"],"mappings":";;;;;;;;;AAkBA,IAAM,IAA0B;AAUhC,SAAS,EAAqB,GAAkB;AAC5C,QAAO,SAAoB,GAAwC;AAC/D,SAAO,EACH,UAAU,EACN,MAAM,GAAM;AACR,QAAK,IAAM,KAAc,EAAK,YAC1B,EAAI,EAAW,SAAS,EAAK,wBAAwB,EAAW,SAAS,EAAK,wBAC1E,EAAa,EAAW,cAAc,GAAG,GAAU,EAAQ;KAI1E,EACJ;;;AAOT,SAAS,EACL,GACA,GACA,GACA,GACF;AACO,OAIL,MAAK,IAAM,KAAa,EAAa,WACjC,KAAI,EAAU,SAAS,EAAK,OAAO;AAC/B,MAAI,KAAgB,GAAU;AAC1B,KAAQ,YACJ,IAAI,EAAa,kBAAkB,IAAe,EAAE,wCAAwC,EAAS,GAAG,CAC3G;AACD;;AAGJ,EAAI,EAAU,gBACV,EACI,EAAU,cACV,IAAe,GACf,GACA,EACH;SAGA,EAAU,SAAS,EAAK,mBAAmB,EAAU,SAAS,EAAK,oBACxE,EACK,EAAoE,cACrE,GACA,GACA,EACH;;AAoBb,SAAgB,EAAmB,GAA8C;CAE7E,IAAM,IAAY,EAAQ,SAAS,EAAQ,IAAI,aAAgB,EAAc,YAGvE,IAAkB,EAAqB,EAAQ;AAErD,QAAO,IAAI,EAAa;EACpB,QAAQ,EAAQ;EAChB,SAAS;GACL,IACM,GAA2C,GAC3C,GAAgD;GACtD,EAAkC,EAAE,YAAY,EAAQ,QAAQ,CAAC;GACjE,GAAI,EAAQ,cACN,CAAC,EACK,MAAM,kBAAkB;AACpB,WAAO,EACH,MAAM,cAAc;AAEhB,KADA,EAAQ,eAAe,EACvB,EAAI,KAAK,wCAAwC;OAExD;MAER,CAAC,GACJ,EAAE;GACX;EACD,GAAI,EAAgB,SAAS,KAAK,EAAE,oBAAiB;EACrD,GAAI,KAAa;GACb,eAAe;GACf,mCAAmC;GACtC;EACJ,CAAC;;AAQN,SAAS,EAAqB,GAAgC;CAC1D,IAAM,IAAQ,EAAE,EACV,IAAW,EAAQ;AAWzB,QATI,MAAa,MAAS,MAAa,KAEnC,EAAM,KAAK,EADG,OAAO,KAAa,WAAW,IAAW,EAClB,CAAC,EAGvC,EAAQ,mBACR,EAAM,KAAK,GAAG,EAAQ,gBAAgB,EAGnC"}
@@ -1 +1,2 @@
1
- export {}
1
+ export * from './apollo-server.type.js';
2
+ export * from './apollo-server.util.js';
@@ -1 +1,2 @@
1
- export {}
1
+ #!/usr/bin/env node
2
+ export {};
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { addGitIgnoreEntry as e, pathExistsSync as t, readFileSync as n, removeSync as r, writeFileSync as i } from "../fs/fs.util.js";
3
- import { E_IssueType as a } from "../log/log.type.js";
4
- import { catchError as o, log as s } from "../log/log.util.js";
2
+ import { E_IssueType as e } from "../log/log.type.js";
3
+ import { catchError as t, log as n } from "../log/log.util.js";
4
+ import { addGitIgnoreEntry as r, pathExistsSync as i, readFileSync as a, removeSync as o, writeFileSync as s } from "../fs/fs.util.js";
5
5
  import { getPackage as c, installDependencies as l } from "../package/package.util.js";
6
6
  import { clearAllErrorLists as u, getStoredErrorLists as d, resolveCommands as f, runCommand as p } from "../command/command.util.js";
7
7
  import { resolve as m } from "../path/path.util.js";
@@ -12,43 +12,43 @@ import T from "yargs/yargs";
12
12
  //#region src/node/cli/index.ts
13
13
  function E() {
14
14
  try {
15
- return JSON.parse(n(m(import.meta.dirname, "../../../package.json"), "utf-8")).version;
15
+ return JSON.parse(a(m(import.meta.dirname, "../../../package.json"), "utf-8")).version;
16
16
  } catch {
17
17
  return "1.0.0";
18
18
  }
19
19
  }
20
20
  async function D() {
21
- if (!t(y.TS_CONFIG)) {
22
- s.warn("No TypeScript configuration found. Skipping type check.");
21
+ if (!i(y.TS_CONFIG)) {
22
+ n.warn("No TypeScript configuration found. Skipping type check.");
23
23
  return;
24
24
  }
25
25
  await p("Performing TypeScript validation", await x.typescriptCheck());
26
26
  }
27
27
  async function O(e = !1) {
28
- let t = e ? await x.eslintFix() : await x.eslintCheck(), n = e ? "Running ESLint with auto-fix" : "Running ESLint check";
28
+ let r = e ? await x.eslintFix() : await x.eslintCheck(), i = e ? "Running ESLint with auto-fix" : "Running ESLint check";
29
29
  try {
30
- await p(n, t, {
30
+ await p(i, r, {
31
31
  timeout: 6e4,
32
32
  throwOnError: !0
33
33
  });
34
34
  } catch (e) {
35
- let r = e;
36
- r.code === "ETIMEDOUT" || r.killed || r.signal === "SIGTERM" ? (s.warn("Lint check timed out. Retrying with debug mode enabled..."), C.env.DEBUG = "true", await p(`${n} (Debug Mode)`, t)) : o(e);
35
+ let a = e;
36
+ a.code === "ETIMEDOUT" || a.killed || a.signal === "SIGTERM" ? (n.warn("Lint check timed out. Retrying with debug mode enabled..."), C.env.DEBUG = "true", await p(`${i} (Debug Mode)`, r)) : t(e);
37
37
  }
38
38
  }
39
39
  function k(e, t) {
40
- t.length && s.printBoxedLog(e === "Errors" ? "✖ Errors" : "⚠ Warnings", t, e === "Errors" ? "red" : "yellow");
40
+ t.length && n.printBoxedLog(e === "Errors" ? "✖ Errors" : "⚠ Warnings", t, e === "Errors" ? "red" : "yellow");
41
41
  }
42
42
  async function A() {
43
43
  await new Promise((e) => setImmediate(e));
44
- let e = await d() || [], t = e.filter((e) => e.type === a.Error), n = e.filter((e) => e.type === a.Warning);
45
- !t.length && !n.length ? s.printBoxedLog("✔ NO ISSUES FOUND", [], "green") : (k("Warnings", n), k("Errors", t), t.length > 0 && C.exit(1));
44
+ let t = await d() || [], r = t.filter((t) => t.type === e.Error), i = t.filter((t) => t.type === e.Warning);
45
+ !r.length && !i.length ? n.printBoxedLog("✔ NO ISSUES FOUND", [], "green") : (k("Warnings", i), k("Errors", r), r.length > 0 && C.exit(1));
46
46
  }
47
47
  async function j() {
48
48
  await u();
49
49
  let e = await c({ name: _ });
50
50
  if (!e.success) {
51
- s.error("Failed to retrieve package information. Aborting lint-staged.");
51
+ n.error("Failed to retrieve package information. Aborting lint-staged.");
52
52
  return;
53
53
  }
54
54
  e.result.isCurrentProject && await p(`Building package: ${_}`, await x.build()), await p("Executing lint-staged", await x.lintStaged()), await A();
@@ -66,9 +66,9 @@ async function F() {
66
66
  await u(), await p("Validating commit message", await x.commitLint()), await A();
67
67
  }
68
68
  async function I() {
69
- await p("Configuring Git hooks", await x.configureGitHook()), r(y.GIT_HOOK);
70
- let t = await f(S);
71
- i(y.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(t, null, 4)), e(y.GIT_IGNORE, b), await p("Setting up simple-git-hooks", await x.simpleGitHooks());
69
+ await p("Configuring Git hooks", await x.configureGitHook()), o(y.GIT_HOOK);
70
+ let e = await f(S);
71
+ s(y.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(e, null, 4)), r(y.GIT_IGNORE, b), await p("Setting up simple-git-hooks", await x.simpleGitHooks());
72
72
  }
73
73
  async function L() {
74
74
  try {
@@ -76,31 +76,29 @@ async function L() {
76
76
  } catch {
77
77
  await p(`Installing ${h} globally`, `pnpm i -g ${h}`);
78
78
  }
79
- t(y.DOT_AGENT) ? await p("Updating AI agent", "echo y | ag-kit update") : await p("Initializing AI agent", "ag-kit init"), e(y.GIT_EXCLUDE, v);
79
+ i(y.DOT_AGENT) ? await p("Updating AI agent", "echo y | ag-kit update") : await p("Initializing AI agent", "ag-kit init"), r(y.GIT_EXCLUDE, v);
80
80
  }
81
81
  async function R() {
82
82
  await l(), await I();
83
83
  }
84
84
  async function z() {
85
- r(y.NODE_MODULES, y.PNPM_LOCK_YAML, y.SIMPLE_GIT_HOOKS_JSON), await p("Pruning pnpm store", await x.pnpmPruneStore()), await p("Clearing pnpm cache", await x.pnpmCleanCache()), await l(), await I();
85
+ o(y.NODE_MODULES, y.PNPM_LOCK_YAML, y.SIMPLE_GIT_HOOKS_JSON), await p("Pruning pnpm store", await x.pnpmPruneStore()), await p("Clearing pnpm cache", await x.pnpmCleanCache()), await l(), await I();
86
86
  }
87
87
  async function B() {
88
88
  await p("Inspecting project dependencies", await x.nodeModulesInspect());
89
89
  }
90
90
  async function V() {
91
91
  try {
92
- let e = await c({ name: _ });
93
- await p("Running unit tests", e.success && e.result.isCurrentProject ? "pnpm exec vitest run" : await x.testUnit(), { throwOnError: !0 });
92
+ await p("Running unit tests", await x.testUnit(), { throwOnError: !0 });
94
93
  } catch (e) {
95
- s.error(e), C.exit(1);
94
+ n.error(e), C.exit(1);
96
95
  }
97
96
  }
98
97
  async function H() {
99
98
  try {
100
- let e = await c({ name: _ });
101
- await p("Running end-to-end tests", e.success && e.result.isCurrentProject ? "pnpm exec vitest run --passWithNoTests --config src/config/vitest/vitest.e2e.ts" : await x.testE2e(), { throwOnError: !0 });
99
+ await p("Running end-to-end tests", await x.testE2e(), { throwOnError: !0 });
102
100
  } catch (e) {
103
- s.error(e), C.exit(1);
101
+ n.error(e), C.exit(1);
104
102
  }
105
103
  }
106
104
  async function U(e) {
@@ -125,13 +123,13 @@ async function q() {
125
123
  type: "string"
126
124
  }), async (e) => {
127
125
  if (!e.name) {
128
- s.error("Migration name is required.");
126
+ n.error("Migration name is required.");
129
127
  return;
130
128
  }
131
129
  await U(e.name);
132
- }).command("mongo:migrate:up", "Apply all MongoDB migrations", W).command("mongo:migrate:down", "Rollback last MongoDB migration", G).command("storybook:dev", "Start Storybook development server", K).command("storybook:build", "Build Storybook for production", q).demandCommand(1, "Please specify a valid command.").strict().help().alias("h", "help").alias("v", "version").version(E()).epilog("💡 Tip: Use \"--help\" with any command to see options\n").parse();
130
+ }).command("mongo:migrate:up", "Apply all MongoDB migrations", W).command("mongo:migrate:down", "Rollback last MongoDB migration", G).command("storybook:dev", "Start Storybook development server", K).command("storybook:build", "Build Storybook for production", q).example("$0 lint:fix", "Automatically block and fix linter errors").example("$0 test:unit", "Run the unit test suite").example("$0 mongo:migrate:create init_db", "Create a new migration file named \"init_db\"").demandCommand(1, "Please specify a valid command.").strict().help().alias("h", "help").alias("v", "version").version(E()).epilog("💡 Tip: Use \"--help\" with any command to see options\n").parse();
133
131
  } catch (e) {
134
- o(e), C.exit(1);
132
+ t(e), C.exit(1);
135
133
  }
136
134
  })();
137
135
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/node/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport process from 'node:process';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nimport type { I_IssueEntry } from '../log/index.js';\n\nimport { clearAllErrorLists, getStoredErrorLists, resolveCommands, runCommand } from '../command/index.js';\nimport { addGitIgnoreEntry, pathExistsSync, readFileSync, removeSync, writeFileSync } from '../fs/index.js';\nimport { catchError, E_IssueType, log } from '../log/index.js';\nimport { getPackage, installDependencies } from '../package/index.js';\nimport { AG_KIT_PACKAGE_NAME, command, createGitHooksConfig, CYBERSKILL_CLI, CYBERSKILL_PACKAGE_NAME, DOT_AGENT, PATH, resolve, SIMPLE_GIT_HOOK_JSON } from '../path/index.js';\n\n/**\n * Retrieves the version from the package.json file.\n * This function reads the package.json file and extracts the version number.\n * If the file cannot be read or parsed, it returns a default version of '1.0.0'.\n *\n * @returns The version string from package.json or '1.0.0' as fallback.\n */\nfunction getVersion(): string {\n try {\n const pkg = JSON.parse(\n readFileSync(resolve(import.meta.dirname, '../../../package.json'), 'utf-8'),\n );\n return pkg.version;\n }\n catch {\n return '1.0.0';\n }\n}\n\n/**\n * Performs TypeScript validation if a TypeScript configuration file exists.\n * Uses `--incremental` mode to cache results — the first run may be slow\n * (especially with large generated files), but subsequent runs are near-instant.\n *\n * @returns A promise that resolves when the TypeScript validation is complete.\n */\nasync function checkTypescript() {\n if (!pathExistsSync(PATH.TS_CONFIG)) {\n log.warn('No TypeScript configuration found. Skipping type check.');\n return;\n }\n\n await runCommand('Performing TypeScript validation', await command.typescriptCheck());\n}\n\n/**\n * Performs ESLint checking with optional auto-fix functionality.\n * This function runs ESLint checks on the codebase and optionally applies\n * automatic fixes to resolve linting issues.\n *\n * @param fix - Whether to apply automatic fixes to linting issues (default: false).\n * @returns A promise that resolves when the ESLint check is complete.\n */\nasync function checkEslint(fix = false) {\n const commandToRun = fix ? await command.eslintFix() : await command.eslintCheck();\n const label = fix ? 'Running ESLint with auto-fix' : 'Running ESLint check';\n\n try {\n await runCommand(label, commandToRun, { timeout: 60000, throwOnError: true });\n }\n catch (error: unknown) {\n const errObj = error as { code?: string; killed?: boolean; signal?: string };\n if (errObj.code === 'ETIMEDOUT' || errObj.killed || errObj.signal === 'SIGTERM') {\n log.warn('Lint check timed out. Retrying with debug mode enabled...');\n process.env['DEBUG'] = 'true';\n await runCommand(`${label} (Debug Mode)`, commandToRun);\n }\n else {\n catchError(error);\n }\n }\n}\n\n/**\n * Prints a formatted list of issues (errors or warnings) to the console.\n * This function displays issues in a boxed format with appropriate color coding\n * based on the issue type. It only displays issues if the list is not empty.\n *\n * @param type - The type of issues to display ('Errors' or 'Warnings').\n * @param list - An array of issue entries to display.\n */\nfunction printIssues(type: 'Errors' | 'Warnings', list: I_IssueEntry[]) {\n if (!list.length) {\n return;\n }\n\n const color = type === 'Errors' ? 'red' : 'yellow';\n log.printBoxedLog(type === 'Errors' ? '✖ Errors' : '⚠ Warnings', list, color);\n}\n\n/**\n * Displays the final check results after all validation processes.\n * This function retrieves stored error lists and displays them in a formatted manner.\n * If no errors or warnings are found, it displays a success message. If errors are found,\n * it exits the process with code 1 to indicate failure.\n *\n * @returns A promise that resolves when the results are displayed.\n */\nasync function showCheckResult() {\n // Allow pending I/O (runCommand writes) to flush before reading results\n await new Promise(resolve => setImmediate(resolve));\n\n const allResults = (await getStoredErrorLists()) || [];\n const errors = allResults.filter(e => e.type === E_IssueType.Error);\n const warnings = allResults.filter(e => e.type === E_IssueType.Warning);\n\n if (!errors.length && !warnings.length) {\n log.printBoxedLog('✔ NO ISSUES FOUND', [], 'green');\n }\n else {\n printIssues('Warnings', warnings);\n printIssues('Errors', errors);\n\n if (errors.length > 0) {\n process.exit(1);\n }\n }\n}\n\n/**\n * Executes lint-staged to check only staged files.\n * This function runs lint-staged which executes linting tools only on files\n * that are staged for commit. It includes building the package if it's the current project\n * and displays the results after completion.\n *\n * @returns A promise that resolves when lint-staged execution is complete.\n */\nasync function lintStaged() {\n await clearAllErrorLists();\n const packageData = await getPackage({ name: CYBERSKILL_PACKAGE_NAME });\n\n if (!packageData.success) {\n log.error('Failed to retrieve package information. Aborting lint-staged.');\n return;\n }\n\n if (packageData.result.isCurrentProject) {\n await runCommand(`Building package: ${CYBERSKILL_PACKAGE_NAME}`, await command.build());\n }\n\n await runCommand('Executing lint-staged', await command.lintStaged());\n await showCheckResult();\n}\n\n/**\n * Inspects the ESLint configuration to show active rules and settings.\n * This function runs ESLint inspection to display the current configuration,\n * including which rules are active and their settings.\n *\n * @returns A promise that resolves when the ESLint inspection is complete.\n */\nasync function inspectLint() {\n await runCommand('Inspecting ESLint configuration', await command.eslintInspect());\n}\n\n/**\n * Performs comprehensive linting checks including TypeScript and ESLint.\n * This function runs both TypeScript validation and ESLint checks in parallel,\n * then displays the combined results.\n *\n * @returns A promise that resolves when all linting checks are complete.\n */\nasync function lintCheck() {\n await clearAllErrorLists();\n await checkTypescript();\n await checkEslint();\n await showCheckResult();\n}\n\n/**\n * Performs comprehensive linting checks with automatic fixes.\n * This function runs both TypeScript validation and ESLint checks with auto-fix\n * in parallel, then displays the combined results.\n *\n * @returns A promise that resolves when all linting checks with fixes are complete.\n */\nasync function lintFix() {\n await clearAllErrorLists();\n await checkTypescript();\n await checkEslint(true);\n await showCheckResult();\n}\n\n/**\n * Validates commit message format using commitlint.\n * This function runs commitlint to check if the current commit message\n * follows the conventional commit format and displays the results.\n *\n * @returns A promise that resolves when commit message validation is complete.\n */\nasync function commitLint() {\n await clearAllErrorLists();\n await runCommand('Validating commit message', await command.commitLint());\n await showCheckResult();\n}\n\n/**\n * Sets up Git hooks for automated code quality checks.\n * This function configures Git hooks using simple-git-hooks, creates the necessary\n * configuration files, and updates .gitignore to exclude hook configuration files.\n * It also sets up the hooks to run linting and commit validation automatically.\n *\n * @returns A promise that resolves when Git hook setup is complete.\n */\nasync function gitHookSetup() {\n await runCommand('Configuring Git hooks', await command.configureGitHook());\n\n removeSync(PATH.GIT_HOOK);\n\n const hooks = await resolveCommands(createGitHooksConfig);\n\n writeFileSync(PATH.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(hooks, null, 4));\n\n addGitIgnoreEntry(PATH.GIT_IGNORE, SIMPLE_GIT_HOOK_JSON);\n\n await runCommand('Setting up simple-git-hooks', await command.simpleGitHooks());\n}\n\n/**\n * Sets up the AI agent environment.\n * This function ensures the ag-kit package is installed globally, initializes\n * or updates the AI agent configuration, and adds the agent directory\n * to .gitignore to exclude it from version control.\n *\n * @returns A promise that resolves when the AI agent setup is complete.\n */\nasync function aiSetup() {\n try {\n await runCommand(`Checking for ${AG_KIT_PACKAGE_NAME}`, `pnpm list -g ${AG_KIT_PACKAGE_NAME}`);\n }\n catch {\n await runCommand(`Installing ${AG_KIT_PACKAGE_NAME} globally`, `pnpm i -g ${AG_KIT_PACKAGE_NAME}`);\n }\n\n if (pathExistsSync(PATH.DOT_AGENT)) {\n await runCommand('Updating AI agent', 'echo y | ag-kit update');\n }\n else {\n await runCommand('Initializing AI agent', 'ag-kit init');\n }\n\n addGitIgnoreEntry(PATH.GIT_EXCLUDE, DOT_AGENT);\n}\n\n/**\n * Initializes the project with dependencies and Git hooks.\n * This function installs project dependencies and sets up Git hooks for\n * automated code quality checks. It's typically run when setting up a new project.\n *\n * @returns A promise that resolves when project initialization is complete.\n */\nasync function ready() {\n await installDependencies();\n await gitHookSetup();\n}\n\n/**\n * Resets the project by removing dependencies and reinstalling them.\n * This function removes node_modules and lock files, cleans the package manager cache,\n * reinstalls dependencies, and sets up Git hooks. It's useful for resolving\n * dependency-related issues.\n *\n * @returns A promise that resolves when project reset is complete.\n */\nasync function reset() {\n removeSync(PATH.NODE_MODULES, PATH.PNPM_LOCK_YAML, PATH.SIMPLE_GIT_HOOKS_JSON);\n await runCommand('Pruning pnpm store', await command.pnpmPruneStore());\n await runCommand('Clearing pnpm cache', await command.pnpmCleanCache());\n await installDependencies();\n await gitHookSetup();\n // await aiSetup();\n}\n\n/**\n * Inspects project dependencies to analyze their status.\n * This function runs dependency inspection to check for outdated packages,\n * security vulnerabilities, and other dependency-related issues.\n *\n * @returns A promise that resolves when dependency inspection is complete.\n */\nasync function inspect() {\n await runCommand('Inspecting project dependencies', await command.nodeModulesInspect());\n}\n\n/**\n * Runs the unit test suite.\n * This function executes unit tests using the configured test runner\n * and displays the test results.\n *\n * @returns A promise that resolves when unit tests are complete.\n */\nasync function testUnit() {\n try {\n const packageData = await getPackage({ name: CYBERSKILL_PACKAGE_NAME });\n const cmd = packageData.success && packageData.result.isCurrentProject\n ? `pnpm exec vitest run`\n : await command.testUnit();\n\n await runCommand('Running unit tests', cmd, { throwOnError: true });\n }\n catch (error) {\n log.error(error);\n process.exit(1);\n }\n}\n\n/**\n * Runs the end-to-end test suite.\n * This function executes end-to-end tests using the configured test runner\n * and displays the test results.\n *\n * @returns A promise that resolves when end-to-end tests are complete.\n */\nasync function testE2E() {\n try {\n const packageData = await getPackage({ name: CYBERSKILL_PACKAGE_NAME });\n const cmd = packageData.success && packageData.result.isCurrentProject\n ? `pnpm exec vitest run --passWithNoTests --config src/config/vitest/vitest.e2e.ts`\n : await command.testE2e();\n\n await runCommand('Running end-to-end tests', cmd, { throwOnError: true });\n }\n catch (error) {\n log.error(error);\n process.exit(1);\n }\n}\n\n/**\n * Creates a new MongoDB migration file.\n * This function creates a new migration file with the specified name\n * for database schema changes.\n *\n * @param migrationName - The name for the new migration file.\n * @returns A promise that resolves when the migration file is created.\n */\nasync function mongoMigrateCreate(migrationName: string) {\n await runCommand('Creating MongoDB migration', await command.mongoMigrateCreate(migrationName));\n}\n\n/**\n * Applies all pending MongoDB migrations.\n * This function runs all pending database migrations to update the database schema\n * to the latest version.\n *\n * @returns A promise that resolves when all migrations are applied.\n */\nasync function mongoMigrateUp() {\n await runCommand('Running MongoDB migrations', await command.mongoMigrateUp());\n}\n\n/**\n * Rolls back the last applied MongoDB migration.\n * This function reverts the most recent database migration, undoing\n * the last schema change.\n *\n * @returns A promise that resolves when the migration is rolled back.\n */\nasync function mongoMigrateDown() {\n await runCommand('Rolling back MongoDB migration', await command.mongoMigrateDown());\n}\n\n/**\n * Starts the Storybook development server.\n * This function runs Storybook in development mode, allowing you to\n * view and interact with your component stories in a browser.\n *\n * @returns A promise that resolves when the Storybook dev server is started.\n */\nasync function storybookDev() {\n await runCommand('Starting Storybook development server', await command.storybookDev());\n}\n\n/**\n * Builds Storybook for production deployment.\n * This function creates a static build of Storybook that can be\n * deployed to a web server or hosting service.\n *\n * @returns A promise that resolves when the Storybook build is complete.\n */\nasync function storybookBuild() {\n await runCommand('Building Storybook', await command.storybookBuild());\n}\n\n(async () => {\n try {\n await yargs(hideBin(process.argv))\n .scriptName(CYBERSKILL_CLI)\n .usage('$0 <command> [options]')\n .command('ai:setup', 'Setup AI agent environment', aiSetup)\n .command('lint', 'Check code for linting issues', lintCheck)\n .command('lint:fix', 'Fix linting issues automatically', lintFix)\n .command('lint:inspect', 'View active ESLint configuration', inspectLint)\n .command('lint-staged', 'Run lint checks on staged files', lintStaged)\n .command('commitlint', 'Validate commit message format', commitLint)\n .command('ready', 'Initialize project and dependencies', ready)\n .command('reset', 'Reset the project and reinstall dependencies', reset)\n .command('inspect', 'Analyze installed project dependencies', inspect)\n .command('test:unit', 'Run unit test suite', testUnit)\n .command('test:e2e', 'Run end-to-end test suite', testE2E)\n .command('mongo:migrate:create <name>', 'Create a MongoDB migration', y =>\n y.positional('name', {\n describe: 'Migration name',\n type: 'string',\n }), async (argv) => {\n if (!argv.name) {\n log.error('Migration name is required.');\n\n return;\n }\n\n await mongoMigrateCreate(argv.name);\n })\n .command('mongo:migrate:up', 'Apply all MongoDB migrations', mongoMigrateUp)\n .command('mongo:migrate:down', 'Rollback last MongoDB migration', mongoMigrateDown)\n .command('storybook:dev', 'Start Storybook development server', storybookDev)\n .command('storybook:build', 'Build Storybook for production', storybookBuild)\n .demandCommand(1, 'Please specify a valid command.')\n .strict()\n .help()\n .alias('h', 'help')\n .alias('v', 'version')\n .version(getVersion())\n .epilog('💡 Tip: Use \"--help\" with any command to see options\\n')\n .parse();\n }\n catch (error) {\n catchError(error);\n process.exit(1);\n }\n})();\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAS,IAAqB;AAC1B,KAAI;AAIA,SAHY,KAAK,MACb,EAAa,EAAQ,OAAO,KAAK,SAAS,wBAAwB,EAAE,QAAQ,CAC/E,CACU;SAET;AACF,SAAO;;;AAWf,eAAe,IAAkB;AAC7B,KAAI,CAAC,EAAe,EAAK,UAAU,EAAE;AACjC,IAAI,KAAK,0DAA0D;AACnE;;AAGJ,OAAM,EAAW,oCAAoC,MAAM,EAAQ,iBAAiB,CAAC;;AAWzF,eAAe,EAAY,IAAM,IAAO;CACpC,IAAM,IAAe,IAAM,MAAM,EAAQ,WAAW,GAAG,MAAM,EAAQ,aAAa,EAC5E,IAAQ,IAAM,iCAAiC;AAErD,KAAI;AACA,QAAM,EAAW,GAAO,GAAc;GAAE,SAAS;GAAO,cAAc;GAAM,CAAC;UAE1E,GAAgB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,SAAS,gDAAgD,EAAM,CACvE,QAAQ,WAAW,0CAA0C,EAAQ,CACrE,QAAQ,aAAa,uBAAuB,EAAS,CACrD,QAAQ,YAAY,6BAA6B,EAAQ,CACzD,QAAQ,+BAA+B,+BAA8B,MAClE,EAAE,WAAW,QAAQ;GACjB,UAAU;GACV,MAAM;GACT,CAAC,EAAE,OAAO,MAAS;AACpB,OAAI,CAAC,EAAK,MAAM;AACZ,MAAI,MAAM,8BAA8B;AAExC;;AAGJ,SAAM,EAAmB,EAAK,KAAK;IACrC,CACD,QAAQ,oBAAoB,gCAAgC,EAAe,CAC3E,QAAQ,sBAAsB,mCAAmC,EAAiB,CAClF,QAAQ,iBAAiB,sCAAsC,EAAa,CAC5E,QAAQ,mBAAmB,kCAAkC,EAAe,CAC5E,cAAc,GAAG,kCAAkC,CACnD,QAAQ,CACR,MAAM,CACN,MAAM,KAAK,OAAO,CAClB,MAAM,KAAK,UAAU,CACrB,QAAQ,GAAY,CAAC,CACrB,OAAO,2DAAyD,CAChE,OAAO;UAET,GAAO;AAEV,EADA,EAAW,EAAM,EACjB,EAAQ,KAAK,EAAE;;IAEnB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/node/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport process from 'node:process';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nimport type { I_IssueEntry } from '../log/index.js';\n\nimport { clearAllErrorLists, getStoredErrorLists, resolveCommands, runCommand } from '../command/index.js';\nimport { addGitIgnoreEntry, pathExistsSync, readFileSync, removeSync, writeFileSync } from '../fs/index.js';\nimport { catchError, E_IssueType, log } from '../log/index.js';\nimport { getPackage, installDependencies } from '../package/index.js';\nimport { AG_KIT_PACKAGE_NAME, command, createGitHooksConfig, CYBERSKILL_CLI, CYBERSKILL_PACKAGE_NAME, DOT_AGENT, PATH, resolve, SIMPLE_GIT_HOOK_JSON } from '../path/index.js';\n\n/**\n * Retrieves the version from the package.json file.\n * This function reads the package.json file and extracts the version number.\n * If the file cannot be read or parsed, it returns a default version of '1.0.0'.\n *\n * @returns The version string from package.json or '1.0.0' as fallback.\n */\nfunction getVersion(): string {\n try {\n const pkg = JSON.parse(\n readFileSync(resolve(import.meta.dirname, '../../../package.json'), 'utf-8'),\n );\n return pkg.version;\n }\n catch {\n /* Intentionally empty — fallback to default version when package.json is unreadable */\n return '1.0.0';\n }\n}\n\n/**\n * Performs TypeScript validation if a TypeScript configuration file exists.\n * Uses `--incremental` mode to cache results — the first run may be slow\n * (especially with large generated files), but subsequent runs are near-instant.\n *\n * @returns A promise that resolves when the TypeScript validation is complete.\n */\nasync function checkTypescript() {\n if (!pathExistsSync(PATH.TS_CONFIG)) {\n log.warn('No TypeScript configuration found. Skipping type check.');\n return;\n }\n\n await runCommand('Performing TypeScript validation', await command.typescriptCheck());\n}\n\n/**\n * Performs ESLint checking with optional auto-fix functionality.\n * This function runs ESLint checks on the codebase and optionally applies\n * automatic fixes to resolve linting issues.\n *\n * @param fix - Whether to apply automatic fixes to linting issues (default: false).\n * @returns A promise that resolves when the ESLint check is complete.\n */\nasync function checkEslint(fix = false) {\n const commandToRun = fix ? await command.eslintFix() : await command.eslintCheck();\n const label = fix ? 'Running ESLint with auto-fix' : 'Running ESLint check';\n\n try {\n await runCommand(label, commandToRun, { timeout: 60000, throwOnError: true });\n }\n catch (error: unknown) {\n const errObj = error as { code?: string; killed?: boolean; signal?: string };\n if (errObj.code === 'ETIMEDOUT' || errObj.killed || errObj.signal === 'SIGTERM') {\n log.warn('Lint check timed out. Retrying with debug mode enabled...');\n process.env['DEBUG'] = 'true';\n await runCommand(`${label} (Debug Mode)`, commandToRun);\n }\n else {\n catchError(error);\n }\n }\n}\n\n/**\n * Prints a formatted list of issues (errors or warnings) to the console.\n * This function displays issues in a boxed format with appropriate color coding\n * based on the issue type. It only displays issues if the list is not empty.\n *\n * @param type - The type of issues to display ('Errors' or 'Warnings').\n * @param list - An array of issue entries to display.\n */\nfunction printIssues(type: 'Errors' | 'Warnings', list: I_IssueEntry[]) {\n if (!list.length) {\n return;\n }\n\n const color = type === 'Errors' ? 'red' : 'yellow';\n log.printBoxedLog(type === 'Errors' ? '✖ Errors' : '⚠ Warnings', list, color);\n}\n\n/**\n * Displays the final check results after all validation processes.\n * This function retrieves stored error lists and displays them in a formatted manner.\n * If no errors or warnings are found, it displays a success message. If errors are found,\n * it exits the process with code 1 to indicate failure.\n *\n * @returns A promise that resolves when the results are displayed.\n */\nasync function showCheckResult() {\n // Allow pending I/O (runCommand writes) to flush before reading results\n await new Promise(resolve => setImmediate(resolve));\n\n const allResults = (await getStoredErrorLists()) || [];\n const errors = allResults.filter(e => e.type === E_IssueType.Error);\n const warnings = allResults.filter(e => e.type === E_IssueType.Warning);\n\n if (!errors.length && !warnings.length) {\n log.printBoxedLog('✔ NO ISSUES FOUND', [], 'green');\n }\n else {\n printIssues('Warnings', warnings);\n printIssues('Errors', errors);\n\n if (errors.length > 0) {\n process.exit(1);\n }\n }\n}\n\n/**\n * Executes lint-staged to check only staged files.\n * This function runs lint-staged which executes linting tools only on files\n * that are staged for commit. It includes building the package if it's the current project\n * and displays the results after completion.\n *\n * @returns A promise that resolves when lint-staged execution is complete.\n */\nasync function lintStaged() {\n await clearAllErrorLists();\n const packageData = await getPackage({ name: CYBERSKILL_PACKAGE_NAME });\n\n if (!packageData.success) {\n log.error('Failed to retrieve package information. Aborting lint-staged.');\n return;\n }\n\n if (packageData.result.isCurrentProject) {\n await runCommand(`Building package: ${CYBERSKILL_PACKAGE_NAME}`, await command.build());\n }\n\n await runCommand('Executing lint-staged', await command.lintStaged());\n await showCheckResult();\n}\n\n/**\n * Inspects the ESLint configuration to show active rules and settings.\n * This function runs ESLint inspection to display the current configuration,\n * including which rules are active and their settings.\n *\n * @returns A promise that resolves when the ESLint inspection is complete.\n */\nasync function inspectLint() {\n await runCommand('Inspecting ESLint configuration', await command.eslintInspect());\n}\n\n/**\n * Performs comprehensive linting checks including TypeScript and ESLint.\n * This function runs both TypeScript validation and ESLint checks in parallel,\n * then displays the combined results.\n *\n * @returns A promise that resolves when all linting checks are complete.\n */\nasync function lintCheck() {\n await clearAllErrorLists();\n await checkTypescript();\n await checkEslint();\n await showCheckResult();\n}\n\n/**\n * Performs comprehensive linting checks with automatic fixes.\n * This function runs both TypeScript validation and ESLint checks with auto-fix\n * in parallel, then displays the combined results.\n *\n * @returns A promise that resolves when all linting checks with fixes are complete.\n */\nasync function lintFix() {\n await clearAllErrorLists();\n await checkTypescript();\n await checkEslint(true);\n await showCheckResult();\n}\n\n/**\n * Validates commit message format using commitlint.\n * This function runs commitlint to check if the current commit message\n * follows the conventional commit format and displays the results.\n *\n * @returns A promise that resolves when commit message validation is complete.\n */\nasync function commitLint() {\n await clearAllErrorLists();\n await runCommand('Validating commit message', await command.commitLint());\n await showCheckResult();\n}\n\n/**\n * Sets up Git hooks for automated code quality checks.\n * This function configures Git hooks using simple-git-hooks, creates the necessary\n * configuration files, and updates .gitignore to exclude hook configuration files.\n * It also sets up the hooks to run linting and commit validation automatically.\n *\n * @returns A promise that resolves when Git hook setup is complete.\n */\nasync function gitHookSetup() {\n await runCommand('Configuring Git hooks', await command.configureGitHook());\n\n removeSync(PATH.GIT_HOOK);\n\n const hooks = await resolveCommands(createGitHooksConfig);\n\n writeFileSync(PATH.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(hooks, null, 4));\n\n addGitIgnoreEntry(PATH.GIT_IGNORE, SIMPLE_GIT_HOOK_JSON);\n\n await runCommand('Setting up simple-git-hooks', await command.simpleGitHooks());\n}\n\n/**\n * Sets up the AI agent environment.\n * This function ensures the ag-kit package is installed globally, initializes\n * or updates the AI agent configuration, and adds the agent directory\n * to .gitignore to exclude it from version control.\n *\n * @returns A promise that resolves when the AI agent setup is complete.\n */\nasync function aiSetup() {\n try {\n await runCommand(`Checking for ${AG_KIT_PACKAGE_NAME}`, `pnpm list -g ${AG_KIT_PACKAGE_NAME}`);\n }\n catch {\n /* Package not found globally — install it */\n await runCommand(`Installing ${AG_KIT_PACKAGE_NAME} globally`, `pnpm i -g ${AG_KIT_PACKAGE_NAME}`);\n }\n\n if (pathExistsSync(PATH.DOT_AGENT)) {\n await runCommand('Updating AI agent', 'echo y | ag-kit update');\n }\n else {\n await runCommand('Initializing AI agent', 'ag-kit init');\n }\n\n addGitIgnoreEntry(PATH.GIT_EXCLUDE, DOT_AGENT);\n}\n\n/**\n * Initializes the project with dependencies and Git hooks.\n * This function installs project dependencies and sets up Git hooks for\n * automated code quality checks. It's typically run when setting up a new project.\n *\n * @returns A promise that resolves when project initialization is complete.\n */\nasync function ready() {\n await installDependencies();\n await gitHookSetup();\n}\n\n/**\n * Resets the project by removing dependencies and reinstalling them.\n * This function removes node_modules and lock files, cleans the package manager cache,\n * reinstalls dependencies, and sets up Git hooks. It's useful for resolving\n * dependency-related issues.\n *\n * @returns A promise that resolves when project reset is complete.\n */\nasync function reset() {\n removeSync(PATH.NODE_MODULES, PATH.PNPM_LOCK_YAML, PATH.SIMPLE_GIT_HOOKS_JSON);\n await runCommand('Pruning pnpm store', await command.pnpmPruneStore());\n await runCommand('Clearing pnpm cache', await command.pnpmCleanCache());\n await installDependencies();\n await gitHookSetup();\n // await aiSetup();\n}\n\n/**\n * Inspects project dependencies to analyze their status.\n * This function runs dependency inspection to check for outdated packages,\n * security vulnerabilities, and other dependency-related issues.\n *\n * @returns A promise that resolves when dependency inspection is complete.\n */\nasync function inspect() {\n await runCommand('Inspecting project dependencies', await command.nodeModulesInspect());\n}\n\n/**\n * Runs the unit test suite.\n * This function executes unit tests using the configured test runner\n * and displays the test results.\n *\n * @returns A promise that resolves when unit tests are complete.\n */\nasync function testUnit() {\n try {\n const cmd = await command.testUnit();\n\n await runCommand('Running unit tests', cmd, { throwOnError: true });\n }\n catch (error) {\n log.error(error);\n process.exit(1);\n }\n}\n\n/**\n * Runs the end-to-end test suite.\n * This function executes end-to-end tests using the configured test runner\n * and displays the test results.\n *\n * @returns A promise that resolves when end-to-end tests are complete.\n */\nasync function testE2E() {\n try {\n const cmd = await command.testE2e();\n\n await runCommand('Running end-to-end tests', cmd, { throwOnError: true });\n }\n catch (error) {\n log.error(error);\n process.exit(1);\n }\n}\n\n/**\n * Creates a new MongoDB migration file.\n * This function creates a new migration file with the specified name\n * for database schema changes.\n *\n * @param migrationName - The name for the new migration file.\n * @returns A promise that resolves when the migration file is created.\n */\nasync function mongoMigrateCreate(migrationName: string) {\n await runCommand('Creating MongoDB migration', await command.mongoMigrateCreate(migrationName));\n}\n\n/**\n * Applies all pending MongoDB migrations.\n * This function runs all pending database migrations to update the database schema\n * to the latest version.\n *\n * @returns A promise that resolves when all migrations are applied.\n */\nasync function mongoMigrateUp() {\n await runCommand('Running MongoDB migrations', await command.mongoMigrateUp());\n}\n\n/**\n * Rolls back the last applied MongoDB migration.\n * This function reverts the most recent database migration, undoing\n * the last schema change.\n *\n * @returns A promise that resolves when the migration is rolled back.\n */\nasync function mongoMigrateDown() {\n await runCommand('Rolling back MongoDB migration', await command.mongoMigrateDown());\n}\n\n/**\n * Starts the Storybook development server.\n * This function runs Storybook in development mode, allowing you to\n * view and interact with your component stories in a browser.\n *\n * @returns A promise that resolves when the Storybook dev server is started.\n */\nasync function storybookDev() {\n await runCommand('Starting Storybook development server', await command.storybookDev());\n}\n\n/**\n * Builds Storybook for production deployment.\n * This function creates a static build of Storybook that can be\n * deployed to a web server or hosting service.\n *\n * @returns A promise that resolves when the Storybook build is complete.\n */\nasync function storybookBuild() {\n await runCommand('Building Storybook', await command.storybookBuild());\n}\n\n(async () => {\n try {\n await yargs(hideBin(process.argv))\n .scriptName(CYBERSKILL_CLI)\n .usage('$0 <command> [options]')\n .command('ai:setup', 'Setup AI agent environment', aiSetup)\n .command('lint', 'Check code for linting issues', lintCheck)\n .command('lint:fix', 'Fix linting issues automatically', lintFix)\n .command('lint:inspect', 'View active ESLint configuration', inspectLint)\n .command('lint-staged', 'Run lint checks on staged files', lintStaged)\n .command('commitlint', 'Validate commit message format', commitLint)\n .command('ready', 'Initialize project and dependencies', ready)\n .command('reset', 'Reset the project and reinstall dependencies', reset)\n .command('inspect', 'Analyze installed project dependencies', inspect)\n .command('test:unit', 'Run unit test suite', testUnit)\n .command('test:e2e', 'Run end-to-end test suite', testE2E)\n .command('mongo:migrate:create <name>', 'Create a MongoDB migration', y =>\n y.positional('name', {\n describe: 'Migration name',\n type: 'string',\n }), async (argv) => {\n if (!argv.name) {\n log.error('Migration name is required.');\n\n return;\n }\n\n await mongoMigrateCreate(argv.name);\n })\n .command('mongo:migrate:up', 'Apply all MongoDB migrations', mongoMigrateUp)\n .command('mongo:migrate:down', 'Rollback last MongoDB migration', mongoMigrateDown)\n .command('storybook:dev', 'Start Storybook development server', storybookDev)\n .command('storybook:build', 'Build Storybook for production', storybookBuild)\n .example('$0 lint:fix', 'Automatically block and fix linter errors')\n .example('$0 test:unit', 'Run the unit test suite')\n .example('$0 mongo:migrate:create init_db', 'Create a new migration file named \"init_db\"')\n .demandCommand(1, 'Please specify a valid command.')\n .strict()\n .help()\n .alias('h', 'help')\n .alias('v', 'version')\n .version(getVersion())\n .epilog('💡 Tip: Use \"--help\" with any command to see options\\n')\n .parse();\n }\n catch (error) {\n catchError(error);\n process.exit(1);\n }\n})();\n"],"mappings":";;;;;;;;;;;;AAoBA,SAAS,IAAqB;AAC1B,KAAI;AAIA,SAHY,KAAK,MACb,EAAa,EAAQ,OAAO,KAAK,SAAS,wBAAwB,EAAE,QAAQ,CAC/E,CACU;SAET;AAEF,SAAO;;;AAWf,eAAe,IAAkB;AAC7B,KAAI,CAAC,EAAe,EAAK,UAAU,EAAE;AACjC,IAAI,KAAK,0DAA0D;AACnE;;AAGJ,OAAM,EAAW,oCAAoC,MAAM,EAAQ,iBAAiB,CAAC;;AAWzF,eAAe,EAAY,IAAM,IAAO;CACpC,IAAM,IAAe,IAAM,MAAM,EAAQ,WAAW,GAAG,MAAM,EAAQ,aAAa,EAC5E,IAAQ,IAAM,iCAAiC;AAErD,KAAI;AACA,QAAM,E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EAAQ,CACzD,QAAQ,+BAA+B,+BAA8B,MAClE,EAAE,WAAW,QAAQ;GACjB,UAAU;GACV,MAAM;GACT,CAAC,EAAE,OAAO,MAAS;AACpB,OAAI,CAAC,EAAK,MAAM;AACZ,MAAI,MAAM,8BAA8B;AAExC;;AAGJ,SAAM,EAAmB,EAAK,KAAK;IACrC,CACD,QAAQ,oBAAoB,gCAAgC,EAAe,CAC3E,QAAQ,sBAAsB,mCAAmC,EAAiB,CAClF,QAAQ,iBAAiB,sCAAsC,EAAa,CAC5E,QAAQ,mBAAmB,kCAAkC,EAAe,CAC5E,QAAQ,eAAe,4CAA4C,CACnE,QAAQ,gBAAgB,0BAA0B,CAClD,QAAQ,mCAAmC,gDAA8C,CACzF,cAAc,GAAG,kCAAkC,CACnD,QAAQ,CACR,MAAM,CACN,MAAM,KAAK,OAAO,CAClB,MAAM,KAAK,UAAU,CACrB,QAAQ,GAAY,CAAC,CACrB,OAAO,2DAAyD,CAChE,OAAO;UAET,GAAO;AAEV,EADA,EAAW,EAAM,EACjB,EAAQ,KAAK,EAAE;;IAEnB"}
@@ -1,5 +1,10 @@
1
1
  import { I_IssueEntry } from '../log/index.js';
2
2
  import { I_CommandContext, T_Command, T_CommandMapInput } from './command.type.js';
3
+ /**
4
+ * Resets the cached package name. For testing only.
5
+ * Call this to force `getPackageName()` to re-read the package.json on the next invocation.
6
+ */
7
+ export declare function resetCommandCacheForTesting(): void;
3
8
  /**
4
9
  * Retrieves all stored error lists from persistent storage.
5
10
  * This function fetches error entries that were previously saved using the package name as the key.