@cyberskill/shared 1.95.0 → 1.96.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 (103) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +51 -17
  2. package/dist/_tsup-dts-rollup.d.ts +51 -17
  3. package/dist/configs/config.util.cjs +1 -1
  4. package/dist/configs/config.util.js +1 -1
  5. package/dist/configs/env/env.constant.cjs +1 -0
  6. package/dist/configs/env/env.constant.d.cts +1 -0
  7. package/dist/configs/env/env.constant.d.ts +1 -0
  8. package/dist/configs/env/env.constant.js +1 -0
  9. package/dist/configs/env/env.d.cjs +1 -0
  10. package/dist/configs/env/env.d.d.cts +1 -0
  11. package/dist/configs/env/env.d.d.ts +1 -0
  12. package/dist/configs/env/env.d.js +0 -0
  13. package/dist/configs/env/env.type.cjs +1 -0
  14. package/dist/configs/env/env.type.d.cts +1 -0
  15. package/dist/configs/env/env.type.d.ts +1 -0
  16. package/dist/configs/env/env.type.js +0 -0
  17. package/dist/configs/env/env.util.cjs +1 -0
  18. package/dist/configs/env/env.util.d.cts +1 -0
  19. package/dist/configs/env/env.util.d.ts +1 -0
  20. package/dist/configs/env/env.util.js +1 -0
  21. package/dist/configs/env/index.cjs +1 -0
  22. package/dist/configs/env/index.d.cts +3 -0
  23. package/dist/configs/env/index.d.ts +3 -0
  24. package/dist/configs/env/index.js +1 -0
  25. package/dist/configs/index.cjs +1 -1
  26. package/dist/configs/index.d.cts +3 -0
  27. package/dist/configs/index.d.ts +3 -0
  28. package/dist/configs/index.js +1 -1
  29. package/dist/constants/index.cjs +1 -1
  30. package/dist/constants/index.d.cts +0 -1
  31. package/dist/constants/index.d.ts +0 -1
  32. package/dist/constants/index.js +1 -1
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.d.cts +7 -3
  35. package/dist/index.d.ts +7 -3
  36. package/dist/index.js +1 -1
  37. package/dist/nodejs/apollo-server/apollo-server.util.cjs +1 -1
  38. package/dist/nodejs/apollo-server/apollo-server.util.js +1 -1
  39. package/dist/nodejs/apollo-server/index.cjs +1 -1
  40. package/dist/nodejs/apollo-server/index.js +1 -1
  41. package/dist/nodejs/cli/cli.util.cjs +1 -1
  42. package/dist/nodejs/cli/cli.util.js +1 -1
  43. package/dist/nodejs/cli/index.cjs +1 -1
  44. package/dist/nodejs/cli/index.js +1 -1
  45. package/dist/nodejs/command/command.util.cjs +1 -1
  46. package/dist/nodejs/command/command.util.js +1 -1
  47. package/dist/nodejs/command/index.cjs +1 -1
  48. package/dist/nodejs/command/index.js +1 -1
  49. package/dist/nodejs/express/express.util.cjs +1 -1
  50. package/dist/nodejs/express/express.util.d.cts +0 -1
  51. package/dist/nodejs/express/express.util.d.ts +0 -1
  52. package/dist/nodejs/express/express.util.js +1 -1
  53. package/dist/nodejs/express/index.cjs +1 -1
  54. package/dist/nodejs/express/index.d.cts +0 -1
  55. package/dist/nodejs/express/index.d.ts +0 -1
  56. package/dist/nodejs/express/index.js +1 -1
  57. package/dist/nodejs/index.cjs +1 -1
  58. package/dist/nodejs/index.d.cts +4 -2
  59. package/dist/nodejs/index.d.ts +4 -2
  60. package/dist/nodejs/index.js +1 -1
  61. package/dist/nodejs/log/index.cjs +1 -1
  62. package/dist/nodejs/log/index.js +1 -1
  63. package/dist/nodejs/log/log.util.cjs +1 -1
  64. package/dist/nodejs/log/log.util.js +1 -1
  65. package/dist/nodejs/mongo/index.cjs +1 -1
  66. package/dist/nodejs/mongo/index.d.cts +1 -0
  67. package/dist/nodejs/mongo/index.d.ts +1 -0
  68. package/dist/nodejs/mongo/index.js +1 -1
  69. package/dist/nodejs/mongo/migrate.util.cjs +1 -0
  70. package/dist/nodejs/mongo/migrate.util.d.cts +1 -0
  71. package/dist/nodejs/mongo/migrate.util.d.ts +1 -0
  72. package/dist/nodejs/mongo/migrate.util.js +1 -0
  73. package/dist/nodejs/package/index.cjs +1 -1
  74. package/dist/nodejs/package/index.js +1 -1
  75. package/dist/nodejs/package/package.util.cjs +1 -1
  76. package/dist/nodejs/package/package.util.js +1 -1
  77. package/dist/nodejs/path/index.cjs +1 -1
  78. package/dist/nodejs/path/index.d.cts +3 -1
  79. package/dist/nodejs/path/index.d.ts +3 -1
  80. package/dist/nodejs/path/index.js +1 -1
  81. package/dist/nodejs/path/path.constant.cjs +1 -1
  82. package/dist/nodejs/path/path.constant.d.cts +2 -1
  83. package/dist/nodejs/path/path.constant.d.ts +2 -1
  84. package/dist/nodejs/path/path.constant.js +1 -1
  85. package/dist/nodejs/path/path.util.cjs +1 -1
  86. package/dist/nodejs/path/path.util.d.cts +1 -0
  87. package/dist/nodejs/path/path.util.d.ts +1 -0
  88. package/dist/nodejs/path/path.util.js +1 -1
  89. package/dist/nodejs/storage/index.cjs +1 -1
  90. package/dist/nodejs/storage/index.js +1 -1
  91. package/dist/nodejs/storage/storage.util.cjs +1 -1
  92. package/dist/nodejs/storage/storage.util.js +1 -1
  93. package/dist/react/index.cjs +1 -1
  94. package/dist/react/index.js +1 -1
  95. package/dist/react/vitest/index.cjs +1 -1
  96. package/dist/react/vitest/index.js +1 -1
  97. package/dist/react/vitest/vitest.unit.cjs +1 -1
  98. package/dist/react/vitest/vitest.unit.js +1 -1
  99. package/package.json +7 -3
  100. package/dist/constants/nodejs.cjs +0 -1
  101. package/dist/constants/nodejs.d.cts +0 -1
  102. package/dist/constants/nodejs.d.ts +0 -1
  103. package/dist/constants/nodejs.js +0 -1
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,o,a,i){try{var c=e[a](i);var s=c.value}catch(e){n(e);return}if(c.done){t(s)}else{Promise.resolve(s).then(r,o)}}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,a){var i=e.apply(t,n);function c(e){r(i,o,a,c,s,"next",e)}function s(e){r(i,o,a,c,s,"throw",e)}c(undefined)})}}function a(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function i(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var o=true;var a=false;var i,c;try{for(n=n.call(e);!(o=(i=n.next()).done);o=true){r.push(i.value);if(t&&r.length===t)break}}catch(e){a=true;c=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(a)throw c}}return r}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){a(e,t,n[t])})}return e}function f(e,n){return t(e)||c(e,n)||v(e,n)||s()}function d(e){return n(e)||i(e)||v(e)||u()}function p(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function v(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function m(e,t){var n,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=c(0),i["throw"]=c(1),i["return"]=c(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(t){return s([e,t])}}function s(c){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,c[0]&&(a=0)),a)try{if(n=1,r&&(o=c[0]&2?r["return"]:c[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;if(r=0,o)c=[c[0]&2,o.value];switch(c[0]){case 0:case 1:o=c;break;case 4:a.label++;return{value:c[1],done:false};case 5:a.label++;r=c[1];c=[0];continue;case 7:c=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){a=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(c[0]===6&&a.label<o[1]){a.label=o[1];o=c;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(c);break}if(o[2])a.ops.pop();a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e];r=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var h=Object.defineProperty;var g=function(e,t){return h(e,"name",{value:t,configurable:!0})};import y from"@vitejs/plugin-react-swc";import{defineConfig as b}from"vitest/config";import I from"node:process";var w=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});import{exec as S}from"node:child_process";import E from"node:process";import*as O from"node:util";import C from"node:process";var T=C.env.DEBUG==="true";var _=function(e){return e.Error="error",e.Warning="warning",e}({});import k from"chalk";import j from"consola";import{GraphQLError as L}from"graphql";T||(j.level=4);function N(e){var t=k[e];return typeof t=="function"?t:k.green}g(N,"chalkKeyword");var A={silent:j.silent,level:j.level,fatal:j.fatal,error:j.error,warn:j.warn,log:j.log,info:j.info,success:j.success,ready:j.ready,start:j.start,box:j.box,debug:j.debug,trace:j.trace,verbose:j.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){j.box(k.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,a=e.message;j.log("".concat(k.gray("File:")," ").concat(k.blue("".concat(t).concat(r?":".concat(r):"")))),o&&j.log(" ".concat(N(n)("Rule:")," ").concat(o)),j.log(" ".concat(N(n)("Message:")," ").concat(a))}),j.box(N(n)("".concat(e," : ").concat(t.length))),j.log(k.gray("─".repeat(40)))}};var G={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import P from"node-fetch";import*as x from"node:fs";function R(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return x.existsSync(e)})}g(R,"existsSync");function D(e,t){var n=x.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":p(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}g(D,"readFileSync");function F(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,o=r===void 0?!1:r,a=o&&(typeof t==="undefined"?"undefined":p(t))=="object"?JSON.stringify(t,null,4):String(t);x.writeFileSync(e,a,"utf-8")}g(F,"writeFileSync");function M(e){var t=eh(eg,eS);if(!R(t))return!1;try{var n=D(t,{asJson:!0}),r=n.name,o=n.dependencies,a=o===void 0?{}:o,i=n.devDependencies,c=i===void 0?{}:i,s=r===e,u=e in a,l=e in c;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return A.warn("Failed to read package.json: ".concat(e.message)),!1}}g(M,"getPackage");function U(e){return W.apply(this,arguments)}function W(){W=o(function(e){var t,n,r,o;return m(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,P("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=a.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=a.sent(),r=n.version;return[2,r];case 3:o=a.sent();throw A.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})});return W.apply(this,arguments)}g(U,"getLatestPackageVersion");function J(e,t){return K.apply(this,arguments)}function K(){K=o(function(e,t){var n,r,o,a,i,c,s,u,f,d,p,v,h,g,y,b,I,w,S,E,O;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=M(e);if(!n)return[2,l({},G)];s=n.path,u=n.file,f=n.isCurrentProject,d=n.isDepend,p=n.isDevDepend,v=(r=u.dependencies)!==null&&r!==void 0?r:{},h=(o=u.devDependencies)!==null&&o!==void 0?o:{},g=f?(a=u.version)!==null&&a!==void 0?a:"0.0.0":d?(i=v[e])!==null&&i!==void 0?i:"0.0.0":p?(c=h[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!f)return[3,1];I=g;return[3,3];case 1:return[4,U(e)];case 2:I=m.sent();m.label=3;case 3:y=I,b=f||g===y;if(!b&&(t===null||t===void 0?void 0:t.update)){;S=d?"dependencies":p?"devDependencies":null;S&&((w=u[S])===null||w===void 0?void 0:w[e])!==y&&(u[S]=(E=u[S])!==null&&E!==void 0?E:{},u[S][e]=y,F(s,u,{isJson:!0}),A.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:f,installedPath:s,file:u,isUpToDate:b}];case 4:O=m.sent();return[2,(A.error('Error checking package "'.concat(e,'": ').concat(O.message)),l({},G))];case 5:return[2]}})});return K.apply(this,arguments)}g(J,"checkPackage");function Y(){return B.apply(this,arguments)}function B(){B=o(function(){var e,t,n,r,o,a,i,c,s,u,l,f;return m(this,function(d){switch(d.label){case 0:e=[{command:g(function(){return e3.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:g(function(){return e3.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:g(function(){return e3.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);o=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(a=o.next()).done))return[3,8];i=a.value,c=i.command,s=i.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,c()];case 4:u=d.sent();return[4,ed("".concat(s," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:l=d.sent();A.warn("Installation attempt failed: ".concat(s)),A.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=d.sent();n=true;r=f;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return B.apply(this,arguments)}g(Y,"installDependencies");function H(e,t){return $.apply(this,arguments)}function $(){$=o(function(e,t){var n,r,o,a,i,c,s,u,f,p,v;return m(this,function(m){switch(m.label){case 0:if(!R(e0.PACKAGE_JSON)){A.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=d(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return J(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=m.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,Y()];case 3:r=m.sent();m.label=4;case 4:r;a=true,i=false,c=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);s=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();m.label=6;case 6:if(!!(a=(u=s.next()).done))return[3,9];f=u.value;return[4,f()];case 7:m.sent();m.label=8;case 8:a=true;return[3,6];case 9:return[3,12];case 10:p=m.sent();i=true;c=p;return[3,12];case 11:try{if(!a&&s.return!=null){s.return()}}finally{if(i){throw c}}return[7];case 12:return[3,14];case 13:v=m.sent();throw A.error('Failed to setup "'.concat(e.join(", "),'": ').concat(v.message)),v;case 14:return[2]}})});return $.apply(this,arguments)}g(H,"setupPackages");import q from"node-persist";import Q from"node:os";import V from"node:process";function z(){return V.env.CYBERSKILL_STORAGE_DIR||eh(Q.homedir(),eb)}g(z,"getStorageDir");function X(){return Z.apply(this,arguments)}function Z(){Z=o(function(){var e;return m(this,function(t){switch(t.label){case 0:e=q.defaultInstance;if(e)return[3,2];return[4,q.init({dir:z(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return Z.apply(this,arguments)}g(X,"initNodePersist");var ee={get:function e(e){return o(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,X()];case 1:r.sent();return[4,q.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(A.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return o(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,X()];case 1:r.sent();return[4,q.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();A.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return o(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,X()];case 1:n.sent();return[4,q.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();A.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return o(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,X()];case 1:n.sent();return[4,q.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(A.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(A.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return o(function(){return m(this,function(t){try{return[2,"".concat(z()," (key: ").concat(e,")")]}catch(e){return[2,(A.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var et=O.promisify(S);function en(e){return"error_list:".concat(e)}g(en,"getErrorListKey");function er(e){return eo.apply(this,arguments)}function eo(){eo=o(function(e){var t,n,r;return m(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=en(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,ee.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/o(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ee.getLogLink(n)];case 1:e=t.sent();e&&A.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=a.sent();A.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return eo.apply(this,arguments)}g(er,"saveErrorListToStorage");function ea(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,i=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,s,u,l,f;var d=o.exec(e)||[],p=a.exec(e)||[],v=i.exec(e)||[];var m,h,g,y,b,I;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===_.Error?_.Error:_.Warning,message:(m=d===null||d===void 0?void 0:(c=d[4])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:"",rule:(h=d===null||d===void 0?void 0:(s=d[5])===null||s===void 0?void 0:s.trim())!==null&&h!==void 0?h:""}):p.length?t.push({file:(g=p===null||p===void 0?void 0:p[1])!==null&&g!==void 0?g:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===_.Error?_.Error:_.Warning,message:(y=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):v.length?t.push({file:"commitlint",type:_.Error,message:(b=v===null||v===void 0?void 0:(l=v[1])===null||l===void 0?void 0:l.trim())!==null&&b!==void 0?b:"",rule:(I=v===null||v===void 0?void 0:(f=v[2])===null||f===void 0?void 0:f.trim())!==null&&I!==void 0?I:""}):n.push(e.trim())}}),t.length&&er(t),T&&n.length&&(A.warn("Unmatched lines:"),n.forEach(function(e){return A.info(" ".concat(e))}))}g(ea,"parseTextErrors");function ei(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,a=e.column,i=e.ruleId,c=e.message;n.push({type:r===2?_.Error:_.Warning,file:t,position:"".concat(o,":").concat(a),rule:i,message:c})})}),n.length&&er(n)}catch(t){ea(e)}}g(ei,"parseCommandOutput");function ec(e){return es.apply(this,arguments)}function es(){es=o(function(e){var t,n,r,o,a,i,c,s,u;var l=arguments;return m(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:ei;n=new AbortController;E.on("SIGINT",function(){A.warn("Process interrupted. Terminating..."),n.abort(),E.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,et(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&t(e)});return[3,4];case 3:i=f.sent();c=i.stdout,s=i.stderr,u=i.message;[c,s].forEach(function(e){return e&&t(e)}),!s&&!c&&A.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return es.apply(this,arguments)}g(ec,"executeCommand");function eu(e){return{raw:!0,cmd:e}}g(eu,"rawCommand");function el(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(e$," ").concat(ey," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e$," ").concat(eY," ").concat(eA," ").concat(e):"".concat(e$," ").concat(eN," ").concat(e)}g(el,"formatCLI");function ef(e,t){return typeof e=="function"?el(e(t),t):(typeof e==="undefined"?"undefined":p(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?el(e,t):e}g(ef,"formatCommand");function ed(e,t){return ep.apply(this,arguments)}function ep(){ep=o(function(e,t){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);A.start("".concat(e)),T&&A.info("→ ".concat(t));return[4,ec(t)];case 1:r.sent(),A.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw A.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return ep.apply(this,arguments)}g(ed,"runCommand");import*as ev from"node:path";function em(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ev).resolve.apply(r,[eg].concat(d(t)))}g(em,"resolveWorkingPath");function eh(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ev).join.apply(r,d(t))}g(eh,"join");var eg=I.env.INIT_CWD||I.cwd(),ey="@cyberskill/shared",eb=".cyberskill-storage",eI="node_modules",ew="dist",eS="package.json",eE="package-lock.json",eO="tsconfig.json",eC=".gitignore",eT=".simple-git-hooks.json",e_="pnpm-lock.yaml",ek=".git/hooks/",ej=".git/COMMIT_EDITMSG",eL=eh(eg,eI,ey,ew),eN="cyberskill",eA="src/nodejs/cli/index.ts",eG="eslint",eP="eslint",ex="vitest",eR="playwright",eD="vitest",eF="@commitlint/cli",eM="commitlint",eU="lint-staged",eW="lint-staged",eJ="typescript",eK="tsc",eY="tsx",eB="git",eH="pnpm",e$="pnpm exec",eq="simple-git-hooks",eQ="simple-git-hooks",eV="@eslint/config-inspector",ez="eslint-config-inspector",eX="node-modules-inspector",eZ="node-modules-inspector",e0={CYBERSKILL_DIRECTORY:eL,WORKING_DIRECTORY:eg,TS_CONFIG:em(eO),GIT_IGNORE:em(eC),GIT_HOOK:em(ek),GIT_COMMIT_MSG:em(ej),SIMPLE_GIT_HOOKS_JSON:em(eT),PACKAGE_JSON:em(eS),PACKAGE_LOCK_JSON:em(eE),PNPM_LOCK_YAML:em(e_),NODE_MODULES:em(eI),LINT_STAGED_CONFIG:em("".concat(eL,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:em("".concat(eL,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:em("".concat(eL,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:em("".concat(eL,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:em("".concat(eL,"/react/vitest/vitest.e2e.js"))};function e1(e){return e2.apply(this,arguments)}function e2(){e2=o(function(e){var t,n,r,o,a,i;var c=arguments;return m(this,function(s){switch(s.label){case 0:for(t=c.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=c[r]}o=f(n,2),a=o[0],i=o[1];if(!a)throw new Error("'first' argument is undefined");switch(e){case w.CLI:return[3,1];case w.RAW:return[3,3]}return[3,4];case 1:return[4,H(a.split(" "),{update:!0})];case 2:return[2,(s.sent(),ef(eu("".concat(e$," ").concat(i))))];case 3:return[2,ef(eu(a))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return e2.apply(this,arguments)}g(e1,"buildCommand");function e4(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/o(function(){return m(this,function(t){return[2,e1.apply(void 0,[e].concat(d(n)))]})})}g(e4,"commandFactory");var e3={simpleGitHooks:e4(w.CLI,eq,eQ),eslintInspect:e4(w.CLI,eV,ez),nodeModulesInspect:e4(w.CLI,eX,eZ),eslintCheck:e4(w.CLI,eG,"".concat(eP," ").concat(e0.WORKING_DIRECTORY)),eslintFix:e4(w.CLI,eG,"".concat(eP," ").concat(e0.WORKING_DIRECTORY," --fix")),typescriptCheck:e4(w.CLI,eJ,"".concat(eK," -p ").concat(e0.TS_CONFIG," --noEmit")),configureGitHook:e4(w.RAW,"".concat(eB," config core.hooksPath ").concat(e0.GIT_HOOK)),testUnit:e4(w.CLI,ex,"".concat(eD," --config ").concat(e0.UNIT_TEST_CONFIG)),testE2e:e4(w.CLI,"".concat(ex," ").concat(eR),"".concat(eD," --config ").concat(e0.E2E_TEST_CONFIG)),commitLint:e4(w.CLI,eF,"".concat(eM," --edit ").concat(e0.GIT_COMMIT_MSG," --config ").concat(e0.COMMITLINT_CONFIG)),lintStaged:e4(w.CLI,eU,"".concat(eW," --config ").concat(e0.LINT_STAGED_CONFIG)),stageBuildDirectory:e4(w.RAW,"".concat(eB," add ").concat(ew)),build:e4(w.RAW,"".concat(eH," run build")),pnpmInstallStandard:e4(w.RAW,"".concat(eH," install")),pnpmInstallLegacy:e4(w.RAW,"".concat(eH," install --legacy-peer-deps")),pnpmInstallForce:e4(w.RAW,"".concat(eH," install --force"))};function e5(e){return b(l({plugins:[y()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[e0.UNIT_TEST_SETUP_CONFIG]}},e))}g(e5,"vitestUnit");export{e5 as vitestUnit};
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,o,a,i){try{var c=e[a](i);var s=c.value}catch(e){n(e);return}if(c.done){t(s)}else{Promise.resolve(s).then(r,o)}}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,a){var i=e.apply(t,n);function c(e){r(i,o,a,c,s,"next",e)}function s(e){r(i,o,a,c,s,"throw",e)}c(undefined)})}}function a(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function i(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var o=true;var a=false;var i,c;try{for(n=n.call(e);!(o=(i=n.next()).done);o=true){r.push(i.value);if(t&&r.length===t)break}}catch(e){a=true;c=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(a)throw c}}return r}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){a(e,t,n[t])})}return e}function f(e,n){return t(e)||c(e,n)||v(e,n)||s()}function d(e){return n(e)||i(e)||v(e)||u()}function p(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function v(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function m(e,t){var n,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=c(0),i["throw"]=c(1),i["return"]=c(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(t){return s([e,t])}}function s(c){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,c[0]&&(a=0)),a)try{if(n=1,r&&(o=c[0]&2?r["return"]:c[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;if(r=0,o)c=[c[0]&2,o.value];switch(c[0]){case 0:case 1:o=c;break;case 4:a.label++;return{value:c[1],done:false};case 5:a.label++;r=c[1];c=[0];continue;case 7:c=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){a=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(c[0]===6&&a.label<o[1]){a.label=o[1];o=c;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(c);break}if(o[2])a.ops.pop();a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e];r=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var g=Object.defineProperty;var h=function(e,t){return g(e,"name",{value:t,configurable:!0})};import y from"@vitejs/plugin-react-swc";import{defineConfig as b}from"vitest/config";var I=".cyberskill-storage";import E from"dotenv";import{bool as w,cleanEnv as S,str as C}from"envalid";import _ from"node:os";import O from"node:path";import T from"node:process";E.config();function L(){var e={DEBUG:T.env.DEBUG,CWD:T.env.CWD,CYBERSKILL_STORAGE_DIR:T.env.CYBERSKILL_STORAGE_DIR},t=S(e,{DEBUG:w({default:!1}),CWD:C({default:T.cwd()}),CYBERSKILL_STORAGE_DIR:C({default:O.join(_.homedir(),I)})});return{DEBUG:t.DEBUG,CWD:t.CWD,CYBERSKILL_STORAGE_DIR:t.CYBERSKILL_STORAGE_DIR}}h(L,"getEnv");var D=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});import{exec as G}from"node:child_process";import k from"node:process";import*as R from"node:util";var A=function(e){return e.Error="error",e.Warning="warning",e}({});import j from"chalk";import N from"consola";import{GraphQLError as P}from"graphql";var x=L();x.DEBUG||(N.level=4);function F(e){var t=j[e];return typeof t=="function"?t:j.green}h(F,"chalkKeyword");var U={silent:N.silent,level:N.level,fatal:N.fatal,error:N.error,warn:N.warn,log:N.log,info:N.info,success:N.success,ready:N.ready,start:N.start,box:N.box,debug:N.debug,trace:N.trace,verbose:N.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){N.box(j.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,a=e.message;N.log("".concat(j.gray("File:")," ").concat(j.blue("".concat(t).concat(r?":".concat(r):"")))),o&&N.log(" ".concat(F(n)("Rule:")," ").concat(o)),N.log(" ".concat(F(n)("Message:")," ").concat(a))}),N.box(F(n)("".concat(e," : ").concat(t.length))),N.log(j.gray("─".repeat(40)))}};var W={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import M from"node-fetch";import*as K from"node:fs";function B(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return K.existsSync(e)})}h(B,"existsSync");function J(e,t){var n=K.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":p(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}h(J,"readFileSync");function Y(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,o=r===void 0?!1:r,a=o&&(typeof t==="undefined"?"undefined":p(t))=="object"?JSON.stringify(t,null,4):String(t);K.writeFileSync(e,a,"utf-8")}h(Y,"writeFileSync");function H(e){var t=L(),n=ew(t.CWD,eL);if(!B(n))return!1;try{var r=J(n,{asJson:!0}),o=r.name,a=r.dependencies,i=a===void 0?{}:a,c=r.devDependencies,s=c===void 0?{}:c,u=o===e,l=e in i,f=e in s;return u||l||f?{path:n,file:r,isCurrentProject:u,isDepend:l,isDevDepend:f}:!1}catch(e){return U.warn("Failed to read package.json: ".concat(e.message)),!1}}h(H,"getPackage");function $(e){return q.apply(this,arguments)}function q(){q=o(function(e){var t,n,r,o;return m(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,M("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=a.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=a.sent(),r=n.version;return[2,r];case 3:o=a.sent();throw U.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})});return q.apply(this,arguments)}h($,"getLatestPackageVersion");function Q(e,t){return V.apply(this,arguments)}function V(){V=o(function(e,t){var n,r,o,a,i,c,s,u,f,d,p,v,g,h,y,b,I,E,w,S,C;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=H(e);if(!n)return[2,l({},W)];s=n.path,u=n.file,f=n.isCurrentProject,d=n.isDepend,p=n.isDevDepend,v=(r=u.dependencies)!==null&&r!==void 0?r:{},g=(o=u.devDependencies)!==null&&o!==void 0?o:{},h=f?(a=u.version)!==null&&a!==void 0?a:"0.0.0":d?(i=v[e])!==null&&i!==void 0?i:"0.0.0":p?(c=g[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!f)return[3,1];I=h;return[3,3];case 1:return[4,$(e)];case 2:I=m.sent();m.label=3;case 3:y=I,b=f||h===y;if(!b&&(t===null||t===void 0?void 0:t.update)){;w=d?"dependencies":p?"devDependencies":null;w&&((E=u[w])===null||E===void 0?void 0:E[e])!==y&&(u[w]=(S=u[w])!==null&&S!==void 0?S:{},u[w][e]=y,Y(s,u,{isJson:!0}),U.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:f,installedPath:s,file:u,isUpToDate:b}];case 4:C=m.sent();return[2,(U.error('Error checking package "'.concat(e,'": ').concat(C.message)),l({},W))];case 5:return[2]}})});return V.apply(this,arguments)}h(Q,"checkPackage");function Z(){return z.apply(this,arguments)}function z(){z=o(function(){var e,t,n,r,o,a,i,c,s,u,l,f;return m(this,function(d){switch(d.label){case 0:e=[{command:h(function(){return tn.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:h(function(){return tn.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:h(function(){return tn.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);o=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(a=o.next()).done))return[3,8];i=a.value,c=i.command,s=i.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,c()];case 4:u=d.sent();return[4,ey("".concat(s," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:l=d.sent();U.warn("Installation attempt failed: ".concat(s)),U.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=d.sent();n=true;r=f;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return z.apply(this,arguments)}h(Z,"installDependencies");function X(e,t){return ee.apply(this,arguments)}function ee(){ee=o(function(e,t){var n,r,o,a,i,c,s,u,f,p,v;return m(this,function(m){switch(m.label){case 0:if(!B(e7.PACKAGE_JSON)){U.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=d(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return Q(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=m.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,Z()];case 3:r=m.sent();m.label=4;case 4:r;a=true,i=false,c=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);s=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();m.label=6;case 6:if(!!(a=(u=s.next()).done))return[3,9];f=u.value;return[4,f()];case 7:m.sent();m.label=8;case 8:a=true;return[3,6];case 9:return[3,12];case 10:p=m.sent();i=true;c=p;return[3,12];case 11:try{if(!a&&s.return!=null){s.return()}}finally{if(i){throw c}}return[7];case 12:return[3,14];case 13:v=m.sent();throw U.error('Failed to setup "'.concat(e.join(", "),'": ').concat(v.message)),v;case 14:return[2]}})});return ee.apply(this,arguments)}h(X,"setupPackages");import et from"node-persist";var en=L();function er(){return eo.apply(this,arguments)}function eo(){eo=o(function(){var e;return m(this,function(t){switch(t.label){case 0:e=et.defaultInstance;if(e)return[3,2];return[4,et.init({dir:en.CYBERSKILL_STORAGE_DIR,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return eo.apply(this,arguments)}h(er,"initNodePersist");var ea={get:function e(e){return o(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,er()];case 1:r.sent();return[4,et.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(U.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return o(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,er()];case 1:r.sent();return[4,et.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return o(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,er()];case 1:n.sent();return[4,et.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();U.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return o(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,er()];case 1:n.sent();return[4,et.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(U.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(U.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return o(function(){return m(this,function(t){try{return[2,"".concat(en.CYBERSKILL_STORAGE_DIR," (key: ").concat(e,")")]}catch(e){return[2,(U.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var ei=L(),ec=R.promisify(G);function es(e){return"error_list:".concat(e)}h(es,"getErrorListKey");function eu(e){return el.apply(this,arguments)}function el(){el=o(function(e){var t,n,r;return m(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=es(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,ea.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/o(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ea.getLogLink(n)];case 1:e=t.sent();e&&U.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=a.sent();U.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return el.apply(this,arguments)}h(eu,"saveErrorListToStorage");function ef(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,i=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,s,u,l,f;var d=o.exec(e)||[],p=a.exec(e)||[],v=i.exec(e)||[];var m,g,h,y,b,I;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===A.Error?A.Error:A.Warning,message:(m=d===null||d===void 0?void 0:(c=d[4])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:"",rule:(g=d===null||d===void 0?void 0:(s=d[5])===null||s===void 0?void 0:s.trim())!==null&&g!==void 0?g:""}):p.length?t.push({file:(h=p===null||p===void 0?void 0:p[1])!==null&&h!==void 0?h:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===A.Error?A.Error:A.Warning,message:(y=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):v.length?t.push({file:"commitlint",type:A.Error,message:(b=v===null||v===void 0?void 0:(l=v[1])===null||l===void 0?void 0:l.trim())!==null&&b!==void 0?b:"",rule:(I=v===null||v===void 0?void 0:(f=v[2])===null||f===void 0?void 0:f.trim())!==null&&I!==void 0?I:""}):n.push(e.trim())}}),t.length&&eu(t),ei.DEBUG&&n.length&&(U.warn("Unmatched lines:"),n.forEach(function(e){return U.info(" ".concat(e))}))}h(ef,"parseTextErrors");function ed(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,a=e.column,i=e.ruleId,c=e.message;n.push({type:r===2?A.Error:A.Warning,file:t,position:"".concat(o,":").concat(a),rule:i,message:c})})}),n.length&&eu(n)}catch(t){ef(e)}}h(ed,"parseCommandOutput");function ep(e){return ev.apply(this,arguments)}function ev(){ev=o(function(e){var t,n,r,o,a,i,c,s,u;var l=arguments;return m(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:ed;n=new AbortController;k.on("SIGINT",function(){U.warn("Process interrupted. Terminating..."),n.abort(),k.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,ec(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&t(e)});return[3,4];case 3:i=f.sent();c=i.stdout,s=i.stderr,u=i.message;[c,s].forEach(function(e){return e&&t(e)}),!s&&!c&&U.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ev.apply(this,arguments)}h(ep,"executeCommand");function em(e){return{raw:!0,cmd:e}}h(em,"rawCommand");function eg(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eX," ").concat(e_," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eX," ").concat(eV," ").concat(eF," ").concat(e):"".concat(eX," ").concat(ex," ").concat(e)}h(eg,"formatCLI");function eh(e,t){return typeof e=="function"?eg(e(t),t):(typeof e==="undefined"?"undefined":p(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eg(e,t):e}h(eh,"formatCommand");function ey(e,t){return eb.apply(this,arguments)}function eb(){eb=o(function(e,t){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);U.start("".concat(e)),ei.DEBUG&&U.info("→ ".concat(t));return[4,ep(t)];case 1:r.sent(),U.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw U.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return eb.apply(this,arguments)}h(ey,"runCommand");import*as eI from"node:path";function eE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;var o=L();return(r=eI).resolve.apply(r,[o.CWD].concat(d(t)))}h(eE,"resolveWorkingPath");function ew(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eI).join.apply(r,d(t))}h(ew,"join");var eS=L(),eC=eS.CWD,e_="@cyberskill/shared",eO="node_modules",eT="dist",eL="package.json",eD="package-lock.json",eG="tsconfig.json",ek=".gitignore",eR=".simple-git-hooks.json",eA="pnpm-lock.yaml",ej=".git/hooks/",eN=".git/COMMIT_EDITMSG",eP=ew(eC,eO,e_,eT),ex="cyberskill",eF="src/nodejs/cli/index.ts",eU="eslint",eW="eslint",eM="vitest",eK="playwright",eB="vitest",eJ="@commitlint/cli",eY="commitlint",eH="lint-staged",e$="lint-staged",eq="typescript",eQ="tsc",eV="tsx",eZ="git",ez="pnpm",eX="pnpm exec",e0="simple-git-hooks",e1="simple-git-hooks",e2="@eslint/config-inspector",e4="eslint-config-inspector",e3="node-modules-inspector",e5="node-modules-inspector",e6="migrate-mongo",e8="migrate-mongo",e7={CYBERSKILL_DIRECTORY:eP,WORKING_DIRECTORY:eC,TS_CONFIG:eE(eG),GIT_IGNORE:eE(ek),GIT_HOOK:eE(ej),GIT_COMMIT_MSG:eE(eN),SIMPLE_GIT_HOOKS_JSON:eE(eR),PACKAGE_JSON:eE(eL),PACKAGE_LOCK_JSON:eE(eD),PNPM_LOCK_YAML:eE(eA),NODE_MODULES:eE(eO),LINT_STAGED_CONFIG:eE("".concat(eP,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eE("".concat(eP,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eE("".concat(eP,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eE("".concat(eP,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eE("".concat(eP,"/react/vitest/vitest.e2e.js"))};function e9(e){return te.apply(this,arguments)}function te(){te=o(function(e){var t,n,r,o,a,i;var c=arguments;return m(this,function(s){switch(s.label){case 0:for(t=c.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=c[r]}o=f(n,2),a=o[0],i=o[1];if(!a)throw new Error("'first' argument is undefined");switch(e){case D.CLI:return[3,1];case D.RAW:return[3,3]}return[3,4];case 1:return[4,X(a.split(" "),{update:!0})];case 2:return[2,(s.sent(),eh(em("".concat(eX," ").concat(i))))];case 3:return[2,eh(em(a))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return te.apply(this,arguments)}h(e9,"buildCommand");function tt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/o(function(){return m(this,function(t){return[2,e9.apply(void 0,[e].concat(d(n)))]})})}h(tt,"commandFactory");var tn={simpleGitHooks:tt(D.CLI,e0,e1),eslintInspect:tt(D.CLI,e2,e4),nodeModulesInspect:tt(D.CLI,e3,e5),eslintCheck:tt(D.CLI,eU,"".concat(eW," ").concat(e7.WORKING_DIRECTORY)),eslintFix:tt(D.CLI,eU,"".concat(eW," ").concat(e7.WORKING_DIRECTORY," --fix")),typescriptCheck:tt(D.CLI,eq,"".concat(eQ," -p ").concat(e7.TS_CONFIG," --noEmit")),configureGitHook:tt(D.RAW,"".concat(eZ," config core.hooksPath ").concat(e7.GIT_HOOK)),testUnit:tt(D.CLI,eM,"".concat(eB," --config ").concat(e7.UNIT_TEST_CONFIG)),testE2e:tt(D.CLI,"".concat(eM," ").concat(eK),"".concat(eB," --config ").concat(e7.E2E_TEST_CONFIG)),mongoMigrateCreate:h(function(e){return tt(D.CLI,"".concat(e6),"".concat(e8," create ").concat(e))()},"mongoMigrateCreate"),mongoMigrateUp:tt(D.CLI,"".concat(e6),"".concat(e8," up")),mongoMigrateDown:tt(D.CLI,"".concat(e6),"".concat(e8," down")),commitLint:tt(D.CLI,eJ,"".concat(eY," --edit ").concat(e7.GIT_COMMIT_MSG," --config ").concat(e7.COMMITLINT_CONFIG)),lintStaged:tt(D.CLI,eH,"".concat(e$," --config ").concat(e7.LINT_STAGED_CONFIG)),stageBuildDirectory:tt(D.RAW,"".concat(eZ," add ").concat(eT)),build:tt(D.RAW,"".concat(ez," run build")),pnpmInstallStandard:tt(D.RAW,"".concat(ez," install")),pnpmInstallLegacy:tt(D.RAW,"".concat(ez," install --legacy-peer-deps")),pnpmInstallForce:tt(D.RAW,"".concat(ez," install --force"))};function tr(e){return b(l({plugins:[y()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[e7.UNIT_TEST_SETUP_CONFIG]}},e))}h(tr,"vitestUnit");export{tr as vitestUnit};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cyberskill/shared",
3
3
  "type": "module",
4
- "version": "1.95.0",
4
+ "version": "1.96.0",
5
5
  "description": "CyberSkill Shared",
6
6
  "author": "Stephen Cheng",
7
7
  "license": "MIT",
@@ -203,7 +203,7 @@
203
203
  "@apollo/client": "3.13.8",
204
204
  "@apollo/server": "4.12.0",
205
205
  "@eddeee888/gcg-typescript-resolver-files": "0.12.0",
206
- "@eslint-react/eslint-plugin": "1.48.3",
206
+ "@eslint-react/eslint-plugin": "1.48.4",
207
207
  "@graphql-codegen/cli": "5.0.5",
208
208
  "@graphql-codegen/client-preset": "4.8.0",
209
209
  "@microsoft/api-extractor": "7.52.4",
@@ -220,7 +220,9 @@
220
220
  "cors": "2.8.5",
221
221
  "crypto-js": "4.2.0",
222
222
  "date-fns": "4.1.0",
223
+ "dotenv": "16.5.0",
223
224
  "dotenv-cli": "8.0.0",
225
+ "envalid": "8.0.0",
224
226
  "eslint-config-next": "15.3.1",
225
227
  "eslint-plugin-format": "1.0.1",
226
228
  "eslint-plugin-react-hooks": "5.2.0",
@@ -234,6 +236,7 @@
234
236
  "i18next": "25.0.0",
235
237
  "jsdom": "26.1.0",
236
238
  "localforage": "1.10.0",
239
+ "migrate-mongo": "12.1.3",
237
240
  "modern-normalize": "3.0.1",
238
241
  "mongodb": "6.15.0",
239
242
  "mongoose": "8.13.2",
@@ -276,6 +279,7 @@
276
279
  "@types/crypto-js": "4.2.2",
277
280
  "@types/express": "4.17.21",
278
281
  "@types/express-session": "1.18.1",
282
+ "@types/migrate-mongo": "10.0.5",
279
283
  "@types/mongoose-aggregate-paginate-v2": "1.0.12",
280
284
  "@types/node-persist": "3.1.8",
281
285
  "@types/react": "19.1.2",
@@ -284,7 +288,7 @@
284
288
  "@types/uuid": "10.0.0",
285
289
  "@types/ws": "8.18.1",
286
290
  "@types/yargs": "17.0.33",
287
- "eslint": "9.24.0",
291
+ "eslint": "9.25.0",
288
292
  "lint-staged": "15.5.1",
289
293
  "node-modules-inspector": "0.6.6",
290
294
  "simple-git-hooks": "2.12.1"
@@ -1 +0,0 @@
1
- "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var r=Object.create;var t=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var o=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty;var f=function(e,r){for(var n in r)t(e,n,{get:r[n],enumerable:!0})},l=function(r,o,f,l){var c=true,i=false,y=undefined;if(o&&(typeof o==="undefined"?"undefined":e(o))=="object"||typeof o=="function")try{var v=function(){var e=d.value;!a.call(r,e)&&e!==f&&t(r,e,{get:function(){return o[e]},enumerable:!(l=n(o,e))||l.enumerable})};for(var p=u(o)[Symbol.iterator](),d;!(c=(d=p.next()).done);c=true)v()}catch(e){i=true;y=e}finally{try{if(!c&&p.return!=null){p.return()}}finally{if(i){throw y}}}return r};var c=function(e,n,u){return u=e!=null?r(o(e)):{},l(n||!e||!e.__esModule?t(u,"default",{value:e,enumerable:!0}):u,e)},i=function(e){return l(t({},"__esModule",{value:!0}),e)};var y={};f(y,{DEBUG:function(){return p}});module.exports=i(y);var v=c(require("process"),1),p=v.default.env.DEBUG==="true";0&&(module.exports={DEBUG:DEBUG});
@@ -1 +0,0 @@
1
- export { DEBUG_alias_2 as DEBUG } from '../_tsup-dts-rollup.cjs';
@@ -1 +0,0 @@
1
- export { DEBUG_alias_2 as DEBUG } from '../_tsup-dts-rollup.js';
@@ -1 +0,0 @@
1
- import r from"node:process";var e=r.env.DEBUG==="true";export{e as DEBUG};