@cyberskill/shared 1.117.0 → 1.119.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.cts +7 -1
- package/dist/_tsup-dts-rollup.d.ts +7 -1
- package/dist/configs/config.util.cjs +1 -1
- package/dist/configs/config.util.js +1 -1
- package/dist/configs/env/env.util.cjs +1 -1
- package/dist/configs/env/env.util.d.cts +1 -0
- package/dist/configs/env/env.util.d.ts +1 -0
- package/dist/configs/env/env.util.js +1 -1
- package/dist/configs/env/index.cjs +1 -1
- package/dist/configs/env/index.d.cts +1 -0
- package/dist/configs/env/index.d.ts +1 -0
- package/dist/configs/env/index.js +1 -1
- package/dist/configs/graphql-codegen/graphql-codegen.util.cjs +1 -1
- package/dist/configs/graphql-codegen/graphql-codegen.util.js +1 -1
- package/dist/configs/graphql-codegen/index.cjs +1 -1
- package/dist/configs/graphql-codegen/index.js +1 -1
- package/dist/configs/index.cjs +1 -1
- package/dist/configs/index.d.cts +1 -0
- package/dist/configs/index.d.ts +1 -0
- package/dist/configs/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/nodejs/apollo-server/apollo-server.util.cjs +1 -1
- package/dist/nodejs/apollo-server/apollo-server.util.js +1 -1
- package/dist/nodejs/apollo-server/index.cjs +1 -1
- package/dist/nodejs/apollo-server/index.js +1 -1
- package/dist/nodejs/cli/cli.util.cjs +1 -1
- package/dist/nodejs/cli/cli.util.js +1 -1
- package/dist/nodejs/cli/index.cjs +1 -1
- package/dist/nodejs/cli/index.js +1 -1
- package/dist/nodejs/command/command.util.cjs +1 -1
- package/dist/nodejs/command/command.util.js +1 -1
- package/dist/nodejs/command/index.cjs +1 -1
- package/dist/nodejs/command/index.js +1 -1
- package/dist/nodejs/index.cjs +1 -1
- package/dist/nodejs/index.js +1 -1
- package/dist/nodejs/log/index.cjs +1 -1
- package/dist/nodejs/log/index.js +1 -1
- package/dist/nodejs/log/log.util.cjs +1 -1
- package/dist/nodejs/log/log.util.js +1 -1
- package/dist/nodejs/mongo/index.cjs +1 -1
- package/dist/nodejs/mongo/index.js +1 -1
- package/dist/nodejs/mongo/mongo.util.cjs +1 -1
- package/dist/nodejs/mongo/mongo.util.js +1 -1
- package/dist/nodejs/package/index.cjs +1 -1
- package/dist/nodejs/package/index.js +1 -1
- package/dist/nodejs/package/package.util.cjs +1 -1
- package/dist/nodejs/package/package.util.js +1 -1
- package/dist/nodejs/path/index.cjs +1 -1
- package/dist/nodejs/path/index.js +1 -1
- package/dist/nodejs/path/path.constant.cjs +1 -1
- package/dist/nodejs/path/path.constant.js +1 -1
- package/dist/nodejs/path/path.util.cjs +1 -1
- package/dist/nodejs/path/path.util.js +1 -1
- package/dist/nodejs/storage/index.cjs +1 -1
- package/dist/nodejs/storage/index.js +1 -1
- package/dist/nodejs/storage/storage.util.cjs +1 -1
- package/dist/nodejs/storage/storage.util.js +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/vitest/index.cjs +1 -1
- package/dist/react/vitest/index.js +1 -1
- package/dist/react/vitest/vitest.unit.cjs +1 -1
- package/dist/react/vitest/vitest.unit.js +1 -1
- package/package.json +17 -12
- package/dist/configs/env/env.d.cjs +0 -1
- package/dist/configs/env/env.d.d.cts +0 -1
- package/dist/configs/env/env.d.d.ts +0 -1
- package/dist/configs/env/env.d.js +0 -0
package/dist/nodejs/index.js
CHANGED
|
@@ -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){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,n,r,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,s)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,c,"next",e)}function c(e){s(o,r,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,n){t=d(t);return R(e,N()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function u(e,t,n){if(t)c(e.prototype,t);if(n)c(e,n);return e}function l(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 d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)I(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function E(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function m(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,a;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw a}}return r}function g(){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 _(){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 h(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){l(e,t,n[t])})}return e}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function y(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{v(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function S(e,t){if(e==null)return{};var n=O(e,t);var r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){r=i[s];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function O(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var s,i;for(i=0;i<r.length;i++){s=r[i];if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function R(e,t){if(t&&(T(t)==="object"||typeof t==="function")){return t}return r(e)}function I(e,t){I=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return I(e,t)}function C(e,n){return t(e)||m(e,n)||b(e,n)||g()}function A(e){return n(e)||E(e)||b(e)||_()}function T(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function b(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 N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function D(e,t){var n,r,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var P=Object.defineProperty;var x=function(e,t,n){return t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n};var G=function(e,t){return P(e,"name",{value:t,configurable:!0})};var M=function(e,t,n){return x(e,(typeof t==="undefined"?"undefined":T(t))!="symbol"?t+"":t,n)};import{ApolloServer as w}from"@apollo/server";import{expressMiddleware as j}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as L}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as U,ApolloServerPluginLandingPageProductionDefault as k}from"@apollo/server/plugin/landingPage/default";var F=function(e){return e.Error="error",e.Warning="warning",e}({});import q from"chalk";import K from"consola";import{GraphQLError as B}from"graphql";var H=".cyberskill-storage";import Y from"@dotenvx/dotenvx";import{bool as W,cleanEnv as V,str as Q}from"envalid";import J from"node:os";import $ from"node:path";import X from"node:process";Y.config();function z(){var e={DEBUG:X.env.DEBUG||!1,CWD:X.env.CWD||X.cwd(),CYBERSKILL_STORAGE_DIRECTORY:X.env.CYBERSKILL_STORAGE_DIRECTORY||$.join(J.homedir(),H)};return V(e,{DEBUG:W(),CWD:Q(),CYBERSKILL_STORAGE_DIRECTORY:Q()})}G(z,"getEnv");var Z={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var ee=z();function et(e){var t=e.message,n=e.status,r=n===void 0?Z.INTERNAL_SERVER_ERROR:n,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:r.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new B(a,{extensions:{code:r.CODE}}):new Error(a)}G(et,"throwError");ee.DEBUG||(K.level=4);function en(e){var t=q[e];return typeof t=="function"?t:q.green}G(en,"chalkKeyword");var er={silent:K.silent,level:K.level,fatal:K.fatal,error:K.error,warn:K.warn,log:K.log,info:K.info,success:K.success,ready:K.ready,start:K.start,box:K.box,debug:K.debug,trace:K.trace,verbose:K.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)){K.box(q.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;K.log("".concat(q.gray("File:")," ").concat(q.blue("".concat(t).concat(r?":".concat(r):"")))),s&&K.log(" ".concat(en(n)("Rule:")," ").concat(s)),K.log(" ".concat(en(n)("Message:")," ").concat(i))}),K.box(en(n)("".concat(e," : ").concat(t.length))),K.log(q.gray("─".repeat(40)))}};function es(e){return new w(h({schema:e.schema,plugins:[e.isDev?U():k(),L({httpServer:e.server})].concat(A(e.drainServer?[{serverWillStart:function t(){return /*#__PURE__*/i(function(){return D(this,function(t){return[2,{drainServer:function t(){return /*#__PURE__*/i(function(){var t;return D(this,function(n){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),er.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}G(es,"createApolloServer");import ei from"node:process";import{hideBin as eo}from"yargs/helpers";import ea from"yargs/yargs";var ec={name:"@cyberskill/shared",type:"module",version:"1.116.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenvx run -- tsup --watch",lint:"dotenvx run -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenvx run -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenvx run -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenvx run -- tsx src/nodejs/cli/index.ts reset",setup:"dotenvx run -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenvx run -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenvx run -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenvx run -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenvx run -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenvx run -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@dotenvx/dotenvx":"1.41.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.22","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.1",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.0","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.3",vitest:"3.1.2","vitest-browser-react":"0.1.1",ws:"8.18.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var eu=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as el}from"node:child_process";import ed from"node:process";import*as ef from"node:util";var ep={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import eE from"node-fetch";import em from"fs-extra";import{extname as eg}from"node:path";var e_=em,eh=em.lstatSync,ev=em.readdirSync,ey=em.mkdirSync,eS=em.readFileSync,eO=em.writeFileSync,eR=em.appendFileSync,eI=em.unlinkSync,eC=em.statSync,eA=em.readJsonSync,eT=em.writeJsonSync;function eb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return em.pathExistsSync(e)})}G(eb,"pathExistsSync");function eN(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){eb(e)&&em.removeSync(e)})}G(eN,"removeSync");function eD(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.extensions,s=S(n,["extensions"]);em.copySync(e,t,h({filter:G(function(e){return eC(e).isDirectory()||!r||r.length===0?!0:r.includes(eg(e))},"filter")},s))}G(eD,"copySync");import eP,{join as ex,resolve as eG}from"node:path";var eM=z(),ew=eP;function ej(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return eG.apply(void 0,[eM.CWD].concat(A(t)))}G(ej,"resolveWorkingPath");function eL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return eG.apply(void 0,A(t))}G(eL,"resolve");function eU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return ex.apply(void 0,A(t))}G(eU,"join");var ek=z(),eF=ek.CWD,eq="@cyberskill/shared",eK="node_modules",eB="dist",eH="package.json",eY="package-lock.json",eW="tsconfig.json",eV=".gitignore",eQ=".simple-git-hooks.json",eJ="pnpm-lock.yaml",e$=".git/hooks/",eX=".git/COMMIT_EDITMSG",ez=".migrate-mongo.config.js",eZ=eU(eF,eK,eq,eB),e0="cyberskill",e1="src/nodejs/cli/index.ts",e2="eslint",e4="eslint",e3="vitest",e5="playwright",e8="vitest",e6="@commitlint/cli",e7="commitlint",e9="lint-staged",te="lint-staged",tt="typescript",tn="tsc",tr="tsx",ts="git",ti="pnpm",to="pnpm exec",ta="simple-git-hooks",tc="simple-git-hooks",tu="@eslint/config-inspector",tl="eslint-config-inspector",td="node-modules-inspector",tf="node-modules-inspector",tp="migrate-mongo",tE="./node_modules/migrate-mongo/bin/migrate-mongo",tm={CYBERSKILL_DIRECTORY:eZ,WORKING_DIRECTORY:eF,TS_CONFIG:ej(eW),GIT_IGNORE:ej(eV),GIT_HOOK:ej(e$),GIT_COMMIT_MSG:ej(eX),SIMPLE_GIT_HOOKS_JSON:ej(eQ),PACKAGE_JSON:ej(eH),PACKAGE_LOCK_JSON:ej(eY),PNPM_LOCK_YAML:ej(eJ),NODE_MODULES:ej(eK),MIGRATE_MONGO_CONFIG:ej(ez),LINT_STAGED_CONFIG:ej("".concat(eZ,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ej("".concat(eZ,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ej("".concat(eZ,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ej("".concat(eZ,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ej("".concat(eZ,"/react/vitest/vitest.e2e.js"))};function tg(e){var t=e.isCurrentProject;return h({"pre-commit":te,"commit-msg":e7},t&&{"pre-push":tk("".concat(ts," pull"))})}G(tg,"createGitHooksConfig");function t_(e,t,n){return /*#__PURE__*/i(function(){return D(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case eu.CLI:return[3,1];case eu.STRING:return[3,3]}return[3,4];case 1:return[4,tC(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),tq(tk("".concat(to," ").concat(n))))];case 3:return[2,tq(tk(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}G(t_,"buildCommand");function th(e,t,n){return function(){return /*#__PURE__*/i(function(){return D(this,function(r){return[2,t_(e,t,n)]})})()}}G(th,"commandFactory");var tv={simpleGitHooks:th(eu.CLI,ta,tc),eslintInspect:th(eu.CLI,tu,tl),nodeModulesInspect:th(eu.CLI,td,tf),eslintCheck:th(eu.CLI,e2,"".concat(e4," ").concat(tm.WORKING_DIRECTORY)),eslintFix:th(eu.CLI,e2,"".concat(e4," ").concat(tm.WORKING_DIRECTORY," --fix")),typescriptCheck:th(eu.CLI,tt,"".concat(tn," -p ").concat(tm.TS_CONFIG," --noEmit")),configureGitHook:th(eu.STRING,"".concat(ts," config core.hooksPath ").concat(tm.GIT_HOOK)),testUnit:th(eu.CLI,e3,"".concat(e8," --config ").concat(tm.UNIT_TEST_CONFIG)),testE2e:th(eu.CLI,"".concat(e3," ").concat(e5),"".concat(e8," --config ").concat(tm.E2E_TEST_CONFIG)),mongoMigrateCreate:G(function(e){return th(eu.CLI,tp,"".concat(tr," ").concat(tE," create ").concat(e," -f ").concat(tm.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:th(eu.CLI,tp,"".concat(tr," ").concat(tE," up -f ").concat(tm.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:th(eu.CLI,tp,"".concat(tr," ").concat(tE," down -f ").concat(tm.MIGRATE_MONGO_CONFIG)),commitLint:th(eu.CLI,e6,"".concat(e7," --edit ").concat(tm.GIT_COMMIT_MSG," --config ").concat(tm.COMMITLINT_CONFIG)),lintStaged:th(eu.CLI,e9,"".concat(te," --config ").concat(tm.LINT_STAGED_CONFIG)),stageBuildDirectory:th(eu.STRING,"".concat(ts," add ").concat(eB)),build:th(eu.STRING,"".concat(ti," run build")),pnpmInstallStandard:th(eu.STRING,"".concat(ti," install")),pnpmInstallLegacy:th(eu.STRING,"".concat(ti," install --legacy-peer-deps")),pnpmInstallForce:th(eu.STRING,"".concat(ti," install --force"))};var ty=z();function tS(e){var t=eU(ty.CWD,eH);if(!eb(t))return!1;try{var n=eA(t),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in i,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return er.warn("Failed to read package.json: ".concat(e.message)),!1}}G(tS,"getPackage");function tO(e){return /*#__PURE__*/i(function(){var t,n,r,s;return D(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,eE("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.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=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw er.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}G(tO,"getLatestPackageVersion");function tR(e,t){return /*#__PURE__*/i(function(){var n,r,s,i,o,a,c,u,l,d,f,p,E,m,g,_,v,y,S,O,R;return D(this,function(I){switch(I.label){case 0:I.trys.push([0,4,,5]);n=tS(e);if(!n)return[2,h({},ep)];c=n.path,u=n.file,l=n.isCurrentProject,d=n.isDepend,f=n.isDevDepend,p=(r=u.dependencies)!==null&&r!==void 0?r:{},E=(s=u.devDependencies)!==null&&s!==void 0?s:{},m=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=E[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];v=m;return[3,3];case 1:return[4,tO(e)];case 2:v=I.sent();I.label=3;case 3:g=v,_=l||m===g;if(!_&&(t===null||t===void 0?void 0:t.update)){;S=d?"dependencies":f?"devDependencies":null;S&&((y=u[S])===null||y===void 0?void 0:y[e])!==g&&(u[S]=(O=u[S])!==null&&O!==void 0?O:{},u[S][e]=g,eT(c,u),er.info('Updated "'.concat(e,'" to version ').concat(g)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:_}];case 4:R=I.sent();return[2,(er.error('Error checking package "'.concat(e,'": ').concat(R.message)),h({},ep))];case 5:return[2]}})})()}G(tR,"checkPackage");function tI(){return /*#__PURE__*/i(function(){var e,t,n,r,s,i,o,a,c,u,l,d;return D(this,function(f){switch(f.label){case 0:e=[{command:G(function(){return tv.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:G(function(){return tv.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:G(function(){return tv.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,tB("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();er.warn("Installation attempt failed: ".concat(c)),er.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}G(tI,"installDependencies");function tC(e,t){return /*#__PURE__*/i(function(){var n,r,s,i,o,a,c,u,l,d,f;return D(this,function(p){switch(p.label){case 0:if(!eb(tm.PACKAGE_JSON)){er.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);n=A(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return tR(e,h({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=p.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,tI()];case 3:r=p.sent();p.label=4;case 4:r;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw er.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})})()}G(tC,"setupPackages");import tA from"node-persist";var tT=z();function tb(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=tA.defaultInstance;if(e)return[3,2];return[4,tA.init({dir:tT.CYBERSKILL_STORAGE_DIRECTORY,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]}})})()}G(tb,"initNodePersist");var tN={get:function e(e){return /*#__PURE__*/i(function(){var t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tb()];case 1:r.sent();return[4,tA.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(er.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/i(function(){var n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tb()];case 1:r.sent();return[4,tA.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();er.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/i(function(){var t;return D(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tb()];case 1:n.sent();return[4,tA.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();er.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/i(function(){var e,t;return D(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tb()];case 1:n.sent();return[4,tA.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(er.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(er.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/i(function(){return D(this,function(t){try{return[2,"".concat(tT.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(er.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tD=z(),tP=ef.promisify(el);function tx(e){return"error_list:".concat(e)}G(tx,"getErrorListKey");function tG(e){return /*#__PURE__*/i(function(){var t,n,r;return D(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=tx(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,tN.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(function(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:return[4,tN.getLogLink(n)];case 1:e=t.sent();e&&er.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=s.sent();er.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}G(tG,"saveErrorListToStorage");function tM(){return /*#__PURE__*/i(function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tN.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return /*#__PURE__*/i(function(){var t;return D(this,function(n){switch(n.label){case 0:return[4,tN.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(er.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}G(tM,"getStoredErrorLists");function tw(){return /*#__PURE__*/i(function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tN.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return tN.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();er.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}G(tw,"clearAllErrorLists");function tj(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],E=o.exec(e)||[];var m,g,_,h,v,y;f.length&&r?t.push({file:r,position:"".concat(f[1],":").concat(f[2]),type:f[3]===F.Error?F.Error:F.Warning,message:(m=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&m!==void 0?m:"",rule:(g=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):p.length?t.push({file:(_=p===null||p===void 0?void 0:p[1])!==null&&_!==void 0?_:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===F.Error?F.Error:F.Warning,message:(h=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):E.length?t.push({file:"commitlint",type:F.Error,message:(v=E===null||E===void 0?void 0:(l=E[1])===null||l===void 0?void 0:l.trim())!==null&&v!==void 0?v:"",rule:(y=E===null||E===void 0?void 0:(d=E[2])===null||d===void 0?void 0:d.trim())!==null&&y!==void 0?y:""}):n.push(e.trim())}}),t.length&&tG(t),tD.DEBUG&&n.length&&(er.warn("Unmatched lines:"),n.forEach(function(e){return er.info(" ".concat(e))}))}G(tj,"parseTextErrors");function tL(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,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?F.Error:F.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&tG(n)}catch(t){tj(e)}}G(tL,"parseCommandOutput");function tU(e){return /*#__PURE__*/i(function(e){var t,n,r,s,i,o,a,c,u;var l=arguments;return D(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tL;n=new AbortController;ed.on("SIGINT",function(){er.warn("Process interrupted. Terminating..."),n.abort(),ed.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,tP(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&er.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}G(tU,"executeCommand");function tk(e){return{raw:!0,cmd:e}}G(tk,"rawCommand");function tF(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(to," ").concat(eq," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(to," ").concat(tr," ").concat(e1," ").concat(e):"".concat(to," ").concat(e0," ").concat(e)}G(tF,"formatCLI");function tq(e,t){return typeof e=="function"?tF(e(t),t):(typeof e==="undefined"?"undefined":T(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tF(e,t):e}G(tq,"formatCommand");function tK(e){return /*#__PURE__*/i(function(e){var t,n,r,s,i,o,a;var c=arguments;return D(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,tR(eq)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=C(e,2),n=t[0],r=t[1];return[n,tq(r,i)]}))]}})}).apply(this,arguments)}G(tK,"resolveCommands");function tB(e,t){return /*#__PURE__*/i(function(){var n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);er.start("".concat(e)),tD.DEBUG&&er.info("→ ".concat(t));return[4,tU(t)];case 1:r.sent(),er.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw er.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}G(tB,"runCommand");function tH(){return /*#__PURE__*/i(function(){var e,t;return D(this,function(n){switch(n.label){case 0:if(!eb(tm.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tv.typescriptCheck()];case 1:return[4,tB.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=er.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}G(tH,"checkTypescript");function tY(){return /*#__PURE__*/i(function(){var e,t,n,r;var s=arguments;return D(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,tv.eslintFix()];case 1:return[4,tB.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,tv.eslintCheck()];case 4:return[4,tB.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}G(tY,"checkEslint");function tW(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";er.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}G(tW,"printIssues");function tV(){return /*#__PURE__*/i(function(){var e,t,n;return D(this,function(r){switch(r.label){case 0:return[4,tM()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===F.Error}),n=e.filter(function(e){return e.type===F.Warning});!t.length&&!n.length?er.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tW("Warnings",n),tW("Errors",t),(t.length>0||n.length>0)&&ei.exit(1));return[2]}})})()}G(tV,"showCheckResult");function tQ(){return /*#__PURE__*/i(function(){var e,t,n,r,s,i;return D(this,function(o){switch(o.label){case 0:return[4,tw()];case 1:o.sent();return[4,tR(eq)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(eq)];return[4,tv.build()];case 4:return[4,tB.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,tv.stageBuildDirectory()];case 6:return[4,tB.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw er.error("Error building and staging ".concat(eq,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tv.lintStaged()];case 10:return[4,tB.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tV();return[2]}})})()}G(tQ,"lintStaged");function tJ(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tv.eslintInspect()];case 1:return[4,tB.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(tJ,"inspectLint");function t$(){return /*#__PURE__*/i(function(){return D(this,function(e){switch(e.label){case 0:return[4,tw()];case 1:e.sent();return[4,Promise.all([tH(),tY()])];case 2:e.sent(),tV();return[2]}})})()}G(t$,"lintCheck");function tX(){return /*#__PURE__*/i(function(){return D(this,function(e){switch(e.label){case 0:return[4,tw()];case 1:e.sent();return[4,Promise.all([tH(),tY(!0)])];case 2:e.sent(),tV();return[2]}})})()}G(tX,"lintFix");function tz(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:return[4,tw()];case 1:t.sent();e=["Validating commit message"];return[4,tv.commitLint()];case 2:return[4,tB.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tV();return[2]}})})()}G(tz,"commitLint");function tZ(){return /*#__PURE__*/i(function(){var e,t,n,r;return D(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tv.configureGitHook()];case 1:return[4,tB.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eN(tm.GIT_HOOK);return[4,tK(tg)];case 3:t=s.sent();eT(tm.SIMPLE_GIT_HOOKS_JSON,t);n="\n".concat(eQ,"\n");eb(tm.GIT_IGNORE)?eS(tm.GIT_IGNORE,"utf-8").split("\n").includes(eQ)||eR(tm.GIT_IGNORE,n,"utf-8"):eO(tm.GIT_IGNORE,n,"utf-8");r=["Setting up simple-git-hooks"];return[4,tv.simpleGitHooks()];case 4:return[4,tB.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}G(tZ,"setupGitHook");function t0(){return /*#__PURE__*/i(function(){return D(this,function(e){switch(e.label){case 0:return[4,tC([eq],{update:!0,postInstallActions:[tZ]})];case 1:e.sent();return[2]}})})()}G(t0,"setup");function t1(){return /*#__PURE__*/i(function(){return D(this,function(e){switch(e.label){case 0:eN(tm.NODE_MODULES,tm.PNPM_LOCK_YAML);return[4,tI()];case 1:e.sent();return[4,tZ()];case 2:e.sent();return[2]}})})()}G(t1,"reset");function t2(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tv.nodeModulesInspect()];case 1:return[4,tB.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t2,"inspect");function t4(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tv.testUnit()];case 1:return[4,tB.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t4,"testUnit");function t3(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tv.testE2e()];case 1:return[4,tB.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t3,"testE2E");function t5(e){return /*#__PURE__*/i(function(){var t;return D(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,tv.mongoMigrateCreate(e)];case 1:return[4,tB.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}G(t5,"mongoMigrateCreate");function t8(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tv.mongoMigrateUp()];case 1:return[4,tB.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t8,"mongoMigrateUp");function t6(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tv.mongoMigrateDown()];case 1:return[4,tB.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t6,"mongoMigrateDown");(function(){return /*#__PURE__*/i(function(){var e;return D(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,ea(eo(ei.argv)).scriptName(e0).usage("$0 <command> [options]").command("lint","Check code for linting issues",t$).command("lint:fix","Fix linting issues automatically",tX).command("lint:inspect","View active ESLint configuration",tJ).command("lint-staged","Run lint checks on staged files",tQ).command("commitlint","Validate commit message format",tz).command("setup","Initialize project setup and dependencies",t0).command("reset","Reset the project and reinstall dependencies",t1).command("inspect","Analyze installed project dependencies",t2).command("test:unit","Run unit test suite",t4).command("test:e2e","Run end-to-end test suite",t3).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return /*#__PURE__*/i(function(){return D(this,function(t){switch(t.label){case 0:if(!e.name){er.error("Migration name is required.");return[2]}return[4,t5(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",t8).command("mongo:migrate:down","Rollback last MongoDB migration",t6).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(ec.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();er.error("Fatal: ".concat(e.message)),ei.exit(1);return[3,3];case 3:return[2]}})})()})();import{Router as t7}from"express";import{NestFactory as t9}from"@nestjs/core";import ne from"body-parser";import nt from"compression";import nn from"cookie-parser";import nr from"cors";import ns from"express";import ni from"express-device";import no from"express-session";function na(e){var t=e.isDev,n=e.whiteList,r=S(e,["isDev","whiteList"]);return h({origin:G(function(e,r){t||(n===null||n===void 0?void 0:n.includes(e!==null&&e!==void 0?e:""))?r(null,!0):r(new Error("Not allowed by CORS"),!1)},"origin"),credentials:!0},r)}G(na,"createCorsOptions");function nc(e){return nr(na(e))}G(nc,"createCors");function nu(e){return no(e)}G(nu,"createSession");function nl(e){var t=ns();return t.set("trust proxy",1),t.use(nn()),t.use(ns.urlencoded({extended:!0})),t.use(nt()),t.use(ni.capture()),(e===null||e===void 0?void 0:e.staticFolder)&&t.use(ns.static(e.staticFolder)),t}G(nl,"createExpress");function nd(e){return /*#__PURE__*/i(function(){var t,n,r;return D(this,function(s){switch(s.label){case 0:return[4,t9.create(e.module)];case 1:r=s.sent();return[2,(r.getHttpAdapter().getInstance().set("trust proxy",1),r.use(ns.urlencoded({extended:!0})),r.use(nn()),r.use(nt()),r.use(ni.capture()),e.staticFolder&&r.use(ns.static(e.staticFolder)),e.filters&&(t=r).useGlobalFilters.apply(t,A(e.filters)),e.pipes&&(n=r).useGlobalPipes.apply(n,A(e.pipes)),r)]}})})()}G(nd,"createNest");var nf="MONGO_MIGRATE_OPTIONS";import{Collection as np,Db as nE}from"mongodb";import{Document as nm,Model as ng}from"mongoose";var n_=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nE);G(n_,"C_Db");var nh=n_,nv=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nm);G(nv,"C_Document");var ny=nv,nS=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(ng);G(nS,"C_Model");var nO=nS,nR=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(np);G(nR,"C_Collection");var nI=nR;import{format as nC}from"date-fns";import nA from"migrate-mongo";import{Document as nT}from"mongoose";import nb from"mongoose-aggregate-paginate-v2";import nN from"mongoose-paginate-v2";import{v4 as nD}from"uuid";import nP from"unorm";var nx={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},nG=Object.entries(nx).reduce(function(e,t){var n=C(t,2),r=n[0],s=n[1];return e[r.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function nM(e){return(typeof e==="undefined"?"undefined":T(e))=="object"&&e!==null&&!Array.isArray(e)}G(nM,"isObject");import nw from"crypto-js";import nj from"slugify";var nL=nj.default||nj;function nU(e,t){var n=G(function(e){var n,r;return nL(e!==null&&e!==void 0?e:"",h({lower:(n=t===null||t===void 0?void 0:t.lower)!==null&&n!==void 0?n:!0,locale:(r=t===null||t===void 0?void 0:t.locale)!==null&&r!==void 0?r:"vi"},t))},"slugifyWithOptions");if(nM(e)){var r={};var s=true,i=false,o=undefined;try{for(var a=Object.entries(e)[Symbol.iterator](),c;!(s=(c=a.next()).done);s=true){var u=C(c.value,2),l=u[0],d=u[1];r[l]=n(d)}}catch(e){i=true;o=e}finally{try{if(!s&&a.return!=null){a.return()}}finally{if(i){throw o}}}return r}return n(e)}G(nU,"generateSlug");function nk(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return nw.SHA256(e).toString(nw.enc.Hex).slice(0,t)}G(nk,"generateShortId");var nF={isEmpty:function e(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":T(e))=="object"?p(e,Date)?!1:p(e,Map)||p(e,Set)?e.size===0:p(e,WeakMap)||p(e,WeakSet)?!0:ArrayBuffer.isView(e)?e.byteLength===0:Object.keys(e).length===0:!1},isValidIP:function e(e){var t=e.split(".");return t.length===4&&t.every(function(e){return/^\d+$/.test(e)&&Number(e)>=0&&Number(e)<=255})?!0:/^(([a-f\d]{1,4}:){7}[a-f\d]{1,4}|((?:[a-f\d]{1,4}:){1,7}:)|((?:[a-f\d]{1,4}:){1,6}:[a-f\d]{1,4})|::)$/i.test(e)}};var nq={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return nC(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,n=t===void 0?"string":t;var r=n==="string"?nq.getDateTime():new Date;return{id:nD(),isDel:!1,createdAt:r,updatedAt:r}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var n=t.method,r=t.pre,s=t.post;n&&r&&e.pre(n,r),n&&s&&e.post(n,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:nD,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,n=e.schema,r=e.virtuals,s=r===void 0?[]:r,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(n,{strict:!0});return s.forEach(function(e){var t=e.name,n=e.options,r=e.get;var s=a.virtual(t,n);r&&s.get(r)}),o||a.add(nq.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,n=e.name,r=e.schema,s=e.pagination,i=s===void 0?!1:s,o=e.aggregate,a=o===void 0?!1:o,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!n)throw new Error("Model name is required.");if(t.models[n])return t.models[n];var f=nq.createSchema({mongoose:t,schema:r,virtuals:u});return nq.applyPlugins(f,[i&&nN,a&&nb]),nq.applyMiddlewares(f,d),t.model(n,f)},validator:{isEmpty:function e(){return function(e){return /*#__PURE__*/i(function(){return D(this,function(t){return[2,!nF.isEmpty(e)]})})()}},isUnique:function e(e){return function(t){return /*#__PURE__*/i(function(){var n;return D(this,function(r){switch(r.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");n={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.exists(n)];case 1:return[2,!r.sent()]}})}).call(this)}},matchesRegex:function e(e){return function(t){return /*#__PURE__*/i(function(){return D(this,function(n){if(!Array.isArray(e)||e.some(function(e){return!p(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})})()}}},migrate:y(h({},nA),{setConfig:G(function(e){var t="// This file is automatically generated by the Cyberskill CLI.\nmodule.exports = ".concat(JSON.stringify(e,null,4));eO(tm.MIGRATE_MONGO_CONFIG,t);var n="\n".concat(ez,"\n");eb(tm.GIT_IGNORE)?eS(tm.GIT_IGNORE,"utf-8").split("\n").includes(ez)||eR(tm.GIT_IGNORE,n,"utf-8"):eO(tm.GIT_IGNORE,n,"utf-8")},"setConfig")})},nK=/*#__PURE__*/function(){"use strict";function e(t,n){a(this,e);M(this,"collection");this.collection=t.collection(n)}u(e,[{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=h({},nq.createGenericFields(),e);n={success:!0,message:"Document created successfully"};return[4,this.collection.insertOne(t)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(){var t,n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=e.map(function(e){return h({},nq.createGenericFields(),e)});return[4,this.collection.insertMany(t)];case 1:n=s.sent();return[2,n.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(n.insertedCount," documents created successfully"),result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.findOne(e)];case 1:t=r.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found"}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"findAll",value:function e(){return /*#__PURE__*/i(function(){var e,t,n;var r=arguments;return D(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Documents retrieved successfully"};return[4,this.collection.find(e).toArray()];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,{success:!1,message:n.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,n;var r=arguments;return D(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Count retrieved successfully"};return[4,this.collection.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,{success:!1,message:n.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(e,t){return /*#__PURE__*/i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateOne(e,{$set:t})];case 1:n=s.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"updateMany",value:function e(e,t){return /*#__PURE__*/i(function(){var n,r;return D(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateMany(e,{$set:t})];case 1:n=s.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"deleteOne",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.deleteOne(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"deleteMany",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.deleteMany(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}}]);return e}();G(nK,"MongoController");var nB=nK,nH=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);M(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var e,t,n,r,s,i,o;var a=arguments;return D(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},n=a.length>2&&a[2]!==void 0?a[2]:{},r=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.findOne(e,t,n);r&&s.populate(r);return[4,s.exec()];case 2:i=c.sent();return[2,i?{success:!0,result:i}:{success:!1,message:"No ".concat(this.getModelName()," found."),code:Z.NOT_FOUND.CODE}];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findAll",value:function e(e){return /*#__PURE__*/i(function(){var e,t,n,r,s,i,o;var a=arguments;return D(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},n=a.length>2&&a[2]!==void 0?a[2]:{},r=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.find(e,t,n);r&&s.populate(r);i={success:!0};return[4,s.exec()];case 2:return[2,(i.result=c.sent(),i)];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPaging",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r;var s=arguments;return D(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.paginate(e,t)];case 2:return[2,(n.result=i.sent(),n)];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPagingAggregate",value:function e(e){return /*#__PURE__*/i(function(e){var t,n,r;var s=arguments;return D(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.aggregatePaginate(this.model.aggregate(e),t)];case 2:return[2,(n.result=i.sent(),n)];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,n;var r=arguments;return D(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0};return[4,this.model.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,{success:!1,message:n.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0};return[4,this.model.create(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:n=r.sent();return[2,{success:!1,message:n.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(e){var t,n,r;var s=arguments;return D(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.insertMany(e,t)];case 2:return[2,(n.result=i.sent().map(function(e){return p(e,nT)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r,s;var i=arguments;return D(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},n=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);return[4,this.model.findOneAndUpdate(e,t,h({new:!0},n)).exec()];case 2:r=o.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"Failed to update ".concat(this.getModelName(),"."),code:Z.NOT_FOUND.CODE}];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r,s;var i=arguments;return D(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},n=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);r={success:!0};return[4,this.model.updateMany(e,t,n).exec()];case 2:return[2,(r.result=o.sent(),r)];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r;var s=arguments;return D(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.findOneAndDelete(e,t).exec()];case 2:n=i.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(this.getModelName()," found to delete."),code:Z.NOT_FOUND.CODE}];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r;var s=arguments;return D(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.deleteMany(e,t).exec()];case 2:n=i.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:Z.NOT_FOUND.CODE}:{success:!0,result:n}];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return /*#__PURE__*/i(function(){var n,r,s,i;return D(this,function(o){switch(o.label){case 0:n=new Set;r=0;o.label=1;case 1:if(!(r<10))return[3,5];s=nk(e,r+t);i=!n.has(s);if(!i)return[3,3];n.add(s);return[4,this.model.exists({shortId:s})];case 2:i=!o.sent();o.label=3;case 3:if(i)return[2,{success:!0,result:s}];o.label=4;case 4:r++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:Z.INTERNAL_SERVER_ERROR.CODE}]}})}).call(this)}},{key:"createSlug",value:function e(e,t,n){return /*#__PURE__*/i(function(){var r,s,o,a,c,u,d,f,p,E;return D(this,function(m){switch(m.label){case 0:r=this;m.label=1;case 1:m.trys.push([1,5,,6]);s=t[e],o=nM(s),a=G(function(t){var r=h({},n!==null&&n!==void 0?n:{});return o?y(h({},r),{$or:[l({},"slug.".concat(e),t),{slugHistory:{$elemMatch:l({},"slug.".concat(e),t)}}]}):y(h({},r),{$or:[{slug:t},{slugHistory:t}]})},"generateSlugQuery"),c=G(function(e){return /*#__PURE__*/i(function(){var t,n;return D(this,function(r){switch(r.label){case 0:t=e,n=1;r.label=1;case 1:return[4,this.model.exists(a(t))];case 2:if(!r.sent())return[3,4];t="".concat(e,"-").concat(n++);r.label=3;case 3:return[3,1];case 4:return[2,t]}})}).call(r)},"generateUniqueSlug");if(!o)return[3,3];u={success:!0};d=Object.fromEntries;return[4,Promise.all(Object.entries(s).map(function(e){var t=C(e,2),n=t[0],r=t[1];return /*#__PURE__*/i(function(){var e,t;return D(this,function(s){switch(s.label){case 0:e=nU(r);t=[n];return[4,c(e)];case 1:return[2,t.concat([s.sent()])]}})})()}))];case 2:return[2,(u.result=d.apply(Object,[m.sent()]),u)];case 3:f=nU(s);p={success:!0};return[4,c(f)];case 4:return[2,(p.result=m.sent(),p)];case 5:E=m.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(E.message),code:Z.INTERNAL_SERVER_ERROR.CODE}];case 6:return[2]}})}).call(this)}},{key:"aggregate",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return D(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0};return[4,this.model.aggregate(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:n=r.sent();return[2,{success:!1,message:n.message,code:Z.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}}]);return e}();G(nH,"MongooseController");var nY=nH;import{useServer as nW}from"graphql-ws/use/ws";import{WebSocketServer as nV}from"ws";function nQ(e){return new nV({server:e.server,path:e.path})}G(nQ,"createWSServer");function nJ(e){return nW({schema:e.schema},e.server)}G(nJ,"initGraphQLWS");export{eB as BUILD_DIRECTORY,ep as CHECK_PACKAGE_EMPTY_RESULT,e7 as COMMIT_LINT_CLI,e6 as COMMIT_LINT_PACKAGE_NAME,e0 as CYBERSKILL_CLI,e1 as CYBERSKILL_CLI_PATH,eZ as CYBERSKILL_DIRECTORY,eq as CYBERSKILL_PACKAGE_NAME,nI as C_Collection,nh as C_Db,ny as C_Document,nO as C_Model,e4 as ESLINT_CLI,tl as ESLINT_INSPECT_CLI,tu as ESLINT_INSPECT_PACKAGE_NAME,e2 as ESLINT_PACKAGE_NAME,eu as E_CommandType,F as E_IssueType,ts as GIT_CLI,eX as GIT_COMMIT_EDITMSG,e$ as GIT_HOOK,eV as GIT_IGNORE,te as LINT_STAGED_CLI,e9 as LINT_STAGED_PACKAGE_NAME,tE as MIGRATE_MONGO_CLI,ez as MIGRATE_MONGO_CONFIG,tp as MIGRATE_MONGO_PACKAGE_NAME,nf as MONGO_MIGRATE_OPTIONS,nB as MongoController,nY as MongooseController,eK as NODE_MODULES,tf as NODE_MODULES_INSPECT_CLI,td as NODE_MODULES_INSPECT_PACKAGE_NAME,eH as PACKAGE_JSON,eY as PACKAGE_LOCK_JSON,tm as PATH,e5 as PLAYWRIGHT_PACKAGE_NAME,ti as PNPM_CLI,to as PNPM_EXEC_CLI,eJ as PNPM_LOCK_YAML,t7 as Router,ta as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tc as SIMPLE_GIT_HOOK_CLI,eQ as SIMPLE_GIT_HOOK_JSON,eW as TSCONFIG_JSON,tn as TSC_CLI,tt as TSC_PACKAGE_NAME,tr as TSX_CLI,e8 as VITEST_CLI,e3 as VITEST_PACKAGE_NAME,eF as WORKING_DIRECTORY,nb as aggregatePaginate,eR as appendFileSync,ne as bodyParser,tR as checkPackage,tw as clearAllErrorLists,tv as command,eD as copySync,es as createApolloServer,nc as createCors,na as createCorsOptions,nl as createExpress,tg as createGitHooksConfig,nd as createNest,nu as createSession,nQ as createWSServer,ns as express,j as expressMiddleware,tq as formatCommand,e_ as fs,tO as getLatestPackageVersion,tS as getPackage,tM as getStoredErrorLists,nJ as initGraphQLWS,tI as installDependencies,eU as join,er as logNodeJS,eh as lstatSync,ey as mkdirSync,nq as mongo,nN as mongoosePaginate,ew as path,eb as pathExistsSync,tk as rawCommand,eS as readFileSync,eA as readJsonSync,ev as readdirSync,eN as removeSync,eL as resolve,tK as resolveCommands,ej as resolveWorkingPath,tB as runCommand,tC as setupPackages,eC as statSync,tN as storageNodeJS,et as throwError,eI as unlinkSync,eO as writeFileSync,eT as writeJsonSync};
|
|
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){if(e===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function s(e,t,n,r,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,s)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){s(o,r,i,a,c,"next",e)}function c(e){s(o,r,i,a,c,"throw",e)}a(undefined)})}}function o(e,t,n){t=d(t);return R(e,N()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function u(e,t,n){if(t)c(e.prototype,t);if(n)c(e,n);return e}function l(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 d(e){d=Object.setPrototypeOf?Object.getPrototypeOf:function e(e){return e.__proto__||Object.getPrototypeOf(e)};return d(e)}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function")}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}});if(t)I(e,t)}function p(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function E(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function m(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,a;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw a}}return r}function g(){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 _(){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 h(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){l(e,t,n[t])})}return e}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function y(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{v(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function S(e,t){if(e==null)return{};var n=O(e,t);var r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++){r=i[s];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function O(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var s,i;for(i=0;i<r.length;i++){s=r[i];if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function R(e,t){if(t&&(A(t)==="object"||typeof t==="function")){return t}return r(e)}function I(e,t){I=Object.setPrototypeOf||function e(e,t){e.__proto__=t;return e};return I(e,t)}function C(e,n){return t(e)||m(e,n)||b(e,n)||g()}function T(e){return n(e)||E(e)||b(e)||_()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function b(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 N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function P(e,t){var n,r,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var D=Object.defineProperty;var x=function(e,t,n){return t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n};var G=function(e,t){return D(e,"name",{value:t,configurable:!0})};var w=function(e,t,n){return x(e,(typeof t==="undefined"?"undefined":A(t))!="symbol"?t+"":t,n)};import{ApolloServer as M}from"@apollo/server";import{expressMiddleware as j}from"@apollo/server/express4";import{ApolloServerPluginDrainHttpServer as L}from"@apollo/server/plugin/drainHttpServer";import{ApolloServerPluginLandingPageLocalDefault as U,ApolloServerPluginLandingPageProductionDefault as k}from"@apollo/server/plugin/landingPage/default";var F=function(e){return e.Error="error",e.Warning="warning",e}({});import q from"chalk";import K from"consola";import{GraphQLError as B}from"graphql";var H=".cyberskill-storage";import Y from"@dotenvx/dotenvx";import{bool as W,cleanEnv as V,str as Q}from"envalid";import J from"node:os";import $ from"node:path";import z from"node:process";var X=!1;function Z(){X||(Y.config(),X=!0)}G(Z,"loadEnvFile");function ee(){Z();var e=V(z.env,{CWD:Q({default:z.cwd()}),DEBUG:W({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:Q({default:$.join(J.homedir(),H)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}G(ee,"getEnv");var et={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var en=ee();function er(e){var t=e.message,n=e.status,r=n===void 0?et.INTERNAL_SERVER_ERROR:n,s=e.type,i=s===void 0?"graphql":s;var o;var a=(o=t!==null&&t!==void 0?t:r.MESSAGE)!==null&&o!==void 0?o:"Internal server error";throw i==="graphql"?new B(a,{extensions:{code:r.CODE}}):new Error(a)}G(er,"throwError");en.DEBUG||(K.level=4);function es(e){var t=q[e];return typeof t=="function"?t:q.green}G(es,"chalkKeyword");var ei={silent:K.silent,level:K.level,fatal:K.fatal,error:K.error,warn:K.warn,log:K.log,info:K.info,success:K.success,ready:K.ready,start:K.start,box:K.box,debug:K.debug,trace:K.trace,verbose:K.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)){K.box(q.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;K.log("".concat(q.gray("File:")," ").concat(q.blue("".concat(t).concat(r?":".concat(r):"")))),s&&K.log(" ".concat(es(n)("Rule:")," ").concat(s)),K.log(" ".concat(es(n)("Message:")," ").concat(i))}),K.box(es(n)("".concat(e," : ").concat(t.length))),K.log(q.gray("─".repeat(40)))}};function eo(e){return new M(h({schema:e.schema,plugins:[e.isDev?U():k(),L({httpServer:e.server})].concat(T(e.drainServer?[{serverWillStart:function t(){return /*#__PURE__*/i(function(){return P(this,function(t){return[2,{drainServer:function t(){return /*#__PURE__*/i(function(){var t;return P(this,function(n){(t=e.drainServer)===null||t===void 0?void 0:t.call(e),ei.info("Apollo Server drainServer hook called");return[2]})})()}}]})})()}}]:[]))},e.isDev&&{introspection:!0,includeStacktraceInErrorResponses:!0}))}G(eo,"createApolloServer");import ea from"node:process";import{hideBin as ec}from"yargs/helpers";import eu from"yargs/yargs";var el={name:"@cyberskill/shared",type:"module",version:"1.118.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/env":{types:"./dist/configs/env/index.d.ts",import:"./dist/configs/env/index.js",require:"./dist/configs/env/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"tsup --watch",lint:"tsx src/nodejs/cli/index.ts lint","lint:fix":"tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"tsx src/nodejs/cli/index.ts lint:inspect",reset:"tsx src/nodejs/cli/index.ts reset",setup:"tsx src/nodejs/cli/index.ts setup",inspect:"tsx src/nodejs/cli/index.ts inspect","test:unit":"tsx src/nodejs/cli/index.ts test:unit","test:e2e":"tsx src/nodejs/cli/index.ts test:e2e",commitlint:"tsx src/nodejs/cli/index.ts commitlint","lint-staged":"tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@dotenvx/dotenvx":"1.41.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.22","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.1",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.0","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.3",vitest:"3.1.2","vitest-browser-react":"0.1.1",ws:"8.18.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var ed=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as ef}from"node:child_process";import ep from"node:process";import*as eE from"node:util";var em={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import eg from"node-fetch";import e_ from"fs-extra";import{extname as eh}from"node:path";var ev=e_,ey=e_.lstatSync,eS=e_.readdirSync,eO=e_.mkdirSync,eR=e_.readFileSync,eI=e_.writeFileSync,eC=e_.appendFileSync,eT=e_.unlinkSync,eA=e_.statSync,eb=e_.readJsonSync,eN=e_.writeJsonSync;function eP(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return e_.pathExistsSync(e)})}G(eP,"pathExistsSync");function eD(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){eP(e)&&e_.removeSync(e)})}G(eD,"removeSync");function ex(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.extensions,s=S(n,["extensions"]);e_.copySync(e,t,h({filter:G(function(e){return eA(e).isDirectory()||!r||r.length===0?!0:r.includes(eh(e))},"filter")},s))}G(ex,"copySync");import eG,{join as ew,resolve as eM}from"node:path";var ej=ee(),eL=eG;function eU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return eM.apply(void 0,[ej.CWD].concat(T(t)))}G(eU,"resolveWorkingPath");function ek(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return eM.apply(void 0,T(t))}G(ek,"resolve");function eF(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return ew.apply(void 0,T(t))}G(eF,"join");var eq=ee(),eK=eq.CWD,eB="@cyberskill/shared",eH="node_modules",eY="dist",eW="package.json",eV="package-lock.json",eQ="tsconfig.json",eJ=".gitignore",e$=".simple-git-hooks.json",ez="pnpm-lock.yaml",eX=".git/hooks/",eZ=".git/COMMIT_EDITMSG",e0=".migrate-mongo.config.js",e1=eF(eK,eH,eB,eY),e2="cyberskill",e4="src/nodejs/cli/index.ts",e3="eslint",e5="eslint",e8="vitest",e6="playwright",e7="vitest",e9="@commitlint/cli",te="commitlint",tt="lint-staged",tn="lint-staged",tr="typescript",ts="tsc",ti="tsx",to="git",ta="pnpm",tc="pnpm exec",tu="simple-git-hooks",tl="simple-git-hooks",td="@eslint/config-inspector",tf="eslint-config-inspector",tp="node-modules-inspector",tE="node-modules-inspector",tm="migrate-mongo",tg="./node_modules/migrate-mongo/bin/migrate-mongo",t_={CYBERSKILL_DIRECTORY:e1,WORKING_DIRECTORY:eK,TS_CONFIG:eU(eQ),GIT_IGNORE:eU(eJ),GIT_HOOK:eU(eX),GIT_COMMIT_MSG:eU(eZ),SIMPLE_GIT_HOOKS_JSON:eU(e$),PACKAGE_JSON:eU(eW),PACKAGE_LOCK_JSON:eU(eV),PNPM_LOCK_YAML:eU(ez),NODE_MODULES:eU(eH),MIGRATE_MONGO_CONFIG:eU(e0),LINT_STAGED_CONFIG:eU("".concat(e1,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eU("".concat(e1,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eU("".concat(e1,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eU("".concat(e1,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eU("".concat(e1,"/react/vitest/vitest.e2e.js"))};function th(e){var t=e.isCurrentProject;return h({"pre-commit":tn,"commit-msg":te},t&&{"pre-push":tq("".concat(to," pull"))})}G(th,"createGitHooksConfig");function tv(e,t,n){return /*#__PURE__*/i(function(){return P(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case ed.CLI:return[3,1];case ed.STRING:return[3,3]}return[3,4];case 1:return[4,tA(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),tB(tq("".concat(tc," ").concat(n))))];case 3:return[2,tB(tq(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}G(tv,"buildCommand");function ty(e,t,n){return function(){return /*#__PURE__*/i(function(){return P(this,function(r){return[2,tv(e,t,n)]})})()}}G(ty,"commandFactory");var tS={simpleGitHooks:ty(ed.CLI,tu,tl),eslintInspect:ty(ed.CLI,td,tf),nodeModulesInspect:ty(ed.CLI,tp,tE),eslintCheck:ty(ed.CLI,e3,"".concat(e5," ").concat(t_.WORKING_DIRECTORY)),eslintFix:ty(ed.CLI,e3,"".concat(e5," ").concat(t_.WORKING_DIRECTORY," --fix")),typescriptCheck:ty(ed.CLI,tr,"".concat(ts," -p ").concat(t_.TS_CONFIG," --noEmit")),configureGitHook:ty(ed.STRING,"".concat(to," config core.hooksPath ").concat(t_.GIT_HOOK)),testUnit:ty(ed.CLI,e8,"".concat(e7," --config ").concat(t_.UNIT_TEST_CONFIG)),testE2e:ty(ed.CLI,"".concat(e8," ").concat(e6),"".concat(e7," --config ").concat(t_.E2E_TEST_CONFIG)),mongoMigrateCreate:G(function(e){return ty(ed.CLI,tm,"".concat(ti," ").concat(tg," create ").concat(e," -f ").concat(t_.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:ty(ed.CLI,tm,"".concat(ti," ").concat(tg," up -f ").concat(t_.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:ty(ed.CLI,tm,"".concat(ti," ").concat(tg," down -f ").concat(t_.MIGRATE_MONGO_CONFIG)),commitLint:ty(ed.CLI,e9,"".concat(te," --edit ").concat(t_.GIT_COMMIT_MSG," --config ").concat(t_.COMMITLINT_CONFIG)),lintStaged:ty(ed.CLI,tt,"".concat(tn," --config ").concat(t_.LINT_STAGED_CONFIG)),stageBuildDirectory:ty(ed.STRING,"".concat(to," add ").concat(eY)),build:ty(ed.STRING,"".concat(ta," run build")),pnpmInstallStandard:ty(ed.STRING,"".concat(ta," install")),pnpmInstallLegacy:ty(ed.STRING,"".concat(ta," install --legacy-peer-deps")),pnpmInstallForce:ty(ed.STRING,"".concat(ta," install --force"))};var tO=ee();function tR(e){var t=eF(tO.CWD,eW);if(!eP(t))return!1;try{var n=eb(t),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in i,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return ei.warn("Failed to read package.json: ".concat(e.message)),!1}}G(tR,"getPackage");function tI(e){return /*#__PURE__*/i(function(){var t,n,r,s;return P(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,eg("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.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=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw ei.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}G(tI,"getLatestPackageVersion");function tC(e,t){return /*#__PURE__*/i(function(){var n,r,s,i,o,a,c,u,l,d,f,p,E,m,g,_,v,y,S,O,R;return P(this,function(I){switch(I.label){case 0:I.trys.push([0,4,,5]);n=tR(e);if(!n)return[2,h({},em)];c=n.path,u=n.file,l=n.isCurrentProject,d=n.isDepend,f=n.isDevDepend,p=(r=u.dependencies)!==null&&r!==void 0?r:{},E=(s=u.devDependencies)!==null&&s!==void 0?s:{},m=l?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(o=p[e])!==null&&o!==void 0?o:"0.0.0":f?(a=E[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!l)return[3,1];v=m;return[3,3];case 1:return[4,tI(e)];case 2:v=I.sent();I.label=3;case 3:g=v,_=l||m===g;if(!_&&(t===null||t===void 0?void 0:t.update)){;S=d?"dependencies":f?"devDependencies":null;S&&((y=u[S])===null||y===void 0?void 0:y[e])!==g&&(u[S]=(O=u[S])!==null&&O!==void 0?O:{},u[S][e]=g,eN(c,u),ei.info('Updated "'.concat(e,'" to version ').concat(g)))}return[2,{isCurrentProject:l,installedPath:c,file:u,isUpToDate:_}];case 4:R=I.sent();return[2,(ei.error('Error checking package "'.concat(e,'": ').concat(R.message)),h({},em))];case 5:return[2]}})})()}G(tC,"checkPackage");function tT(){return /*#__PURE__*/i(function(){var e,t,n,r,s,i,o,a,c,u,l,d;return P(this,function(f){switch(f.label){case 0:e=[{command:G(function(){return tS.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:G(function(){return tS.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:G(function(){return tS.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,tY("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();ei.warn("Installation attempt failed: ".concat(c)),ei.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}G(tT,"installDependencies");function tA(e,t){return /*#__PURE__*/i(function(){var n,r,s,i,o,a,c,u,l,d,f;return P(this,function(p){switch(p.label){case 0:if(!eP(t_.PACKAGE_JSON)){ei.error("package.json not found. Aborting setup.");return[2]}p.label=1;case 1:p.trys.push([1,13,,14]);n=T(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return tC(e,h({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=p.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,tT()];case 3:r=p.sent();p.label=4;case 4:r;i=true,o=false,a=undefined;p.label=5;case 5:p.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();p.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];l=u.value;return[4,l()];case 7:p.sent();p.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=p.sent();o=true;a=d;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:f=p.sent();throw ei.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})})()}G(tA,"setupPackages");import tb from"node-persist";var tN=ee();function tP(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:e=tb.defaultInstance;if(e)return[3,2];return[4,tb.init({dir:tN.CYBERSKILL_STORAGE_DIRECTORY,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]}})})()}G(tP,"initNodePersist");var tD={get:function e(e){return /*#__PURE__*/i(function(){var t,n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tP()];case 1:r.sent();return[4,tb.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(ei.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/i(function(){var n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tP()];case 1:r.sent();return[4,tb.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();ei.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/i(function(){var t;return P(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tP()];case 1:n.sent();return[4,tb.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();ei.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/i(function(){var e,t;return P(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tP()];case 1:n.sent();return[4,tb.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(ei.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(ei.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/i(function(){return P(this,function(t){try{return[2,"".concat(tN.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(ei.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tx=ee(),tG=eE.promisify(ef);function tw(e){return"error_list:".concat(e)}G(tw,"getErrorListKey");function tM(e){return /*#__PURE__*/i(function(){var t,n,r;return P(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=tw(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,tD.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(function(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:return[4,tD.getLogLink(n)];case 1:e=t.sent();e&&ei.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=s.sent();ei.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}G(tM,"saveErrorListToStorage");function tj(){return /*#__PURE__*/i(function(){var e,t,n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tD.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return /*#__PURE__*/i(function(){var t;return P(this,function(n){switch(n.label){case 0:return[4,tD.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(ei.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}G(tj,"getStoredErrorLists");function tL(){return /*#__PURE__*/i(function(){var e,t,n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tD.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return tD.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();ei.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}G(tL,"clearAllErrorLists");function tU(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],E=o.exec(e)||[];var m,g,_,h,v,y;f.length&&r?t.push({file:r,position:"".concat(f[1],":").concat(f[2]),type:f[3]===F.Error?F.Error:F.Warning,message:(m=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&m!==void 0?m:"",rule:(g=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):p.length?t.push({file:(_=p===null||p===void 0?void 0:p[1])!==null&&_!==void 0?_:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===F.Error?F.Error:F.Warning,message:(h=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):E.length?t.push({file:"commitlint",type:F.Error,message:(v=E===null||E===void 0?void 0:(l=E[1])===null||l===void 0?void 0:l.trim())!==null&&v!==void 0?v:"",rule:(y=E===null||E===void 0?void 0:(d=E[2])===null||d===void 0?void 0:d.trim())!==null&&y!==void 0?y:""}):n.push(e.trim())}}),t.length&&tM(t),tx.DEBUG&&n.length&&(ei.warn("Unmatched lines:"),n.forEach(function(e){return ei.info(" ".concat(e))}))}G(tU,"parseTextErrors");function tk(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,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?F.Error:F.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&tM(n)}catch(t){tU(e)}}G(tk,"parseCommandOutput");function tF(e){return /*#__PURE__*/i(function(e){var t,n,r,s,i,o,a,c,u;var l=arguments;return P(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tk;n=new AbortController;ep.on("SIGINT",function(){ei.warn("Process interrupted. Terminating..."),n.abort(),ep.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,tG(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&ei.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}G(tF,"executeCommand");function tq(e){return{raw:!0,cmd:e}}G(tq,"rawCommand");function tK(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(tc," ").concat(eB," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(tc," ").concat(ti," ").concat(e4," ").concat(e):"".concat(tc," ").concat(e2," ").concat(e)}G(tK,"formatCLI");function tB(e,t){return typeof e=="function"?tK(e(t),t):(typeof e==="undefined"?"undefined":A(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tK(e,t):e}G(tB,"formatCommand");function tH(e){return /*#__PURE__*/i(function(e){var t,n,r,s,i,o,a;var c=arguments;return P(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,tC(eB)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=C(e,2),n=t[0],r=t[1];return[n,tB(r,i)]}))]}})}).apply(this,arguments)}G(tH,"resolveCommands");function tY(e,t){return /*#__PURE__*/i(function(){var n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);ei.start("".concat(e)),tx.DEBUG&&ei.info("→ ".concat(t));return[4,tF(t)];case 1:r.sent(),ei.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw ei.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}G(tY,"runCommand");function tW(){return /*#__PURE__*/i(function(){var e,t;return P(this,function(n){switch(n.label){case 0:if(!eP(t_.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,tS.typescriptCheck()];case 1:return[4,tY.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=ei.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}G(tW,"checkTypescript");function tV(){return /*#__PURE__*/i(function(){var e,t,n,r;var s=arguments;return P(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,tS.eslintFix()];case 1:return[4,tY.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,tS.eslintCheck()];case 4:return[4,tY.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}G(tV,"checkEslint");function tQ(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";ei.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}G(tQ,"printIssues");function tJ(){return /*#__PURE__*/i(function(){var e,t,n;return P(this,function(r){switch(r.label){case 0:return[4,tj()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===F.Error}),n=e.filter(function(e){return e.type===F.Warning});!t.length&&!n.length?ei.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tQ("Warnings",n),tQ("Errors",t),(t.length>0||n.length>0)&&ea.exit(1));return[2]}})})()}G(tJ,"showCheckResult");function t$(){return /*#__PURE__*/i(function(){var e,t,n,r,s,i;return P(this,function(o){switch(o.label){case 0:return[4,tL()];case 1:o.sent();return[4,tC(eB)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(eB)];return[4,tS.build()];case 4:return[4,tY.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,tS.stageBuildDirectory()];case 6:return[4,tY.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw ei.error("Error building and staging ".concat(eB,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,tS.lintStaged()];case 10:return[4,tY.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tJ();return[2]}})})()}G(t$,"lintStaged");function tz(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,tS.eslintInspect()];case 1:return[4,tY.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(tz,"inspectLint");function tX(){return /*#__PURE__*/i(function(){return P(this,function(e){switch(e.label){case 0:return[4,tL()];case 1:e.sent();return[4,Promise.all([tW(),tV()])];case 2:e.sent(),tJ();return[2]}})})()}G(tX,"lintCheck");function tZ(){return /*#__PURE__*/i(function(){return P(this,function(e){switch(e.label){case 0:return[4,tL()];case 1:e.sent();return[4,Promise.all([tW(),tV(!0)])];case 2:e.sent(),tJ();return[2]}})})()}G(tZ,"lintFix");function t0(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:return[4,tL()];case 1:t.sent();e=["Validating commit message"];return[4,tS.commitLint()];case 2:return[4,tY.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tJ();return[2]}})})()}G(t0,"commitLint");function t1(){return /*#__PURE__*/i(function(){var e,t,n,r;return P(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,tS.configureGitHook()];case 1:return[4,tY.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eD(t_.GIT_HOOK);return[4,tH(th)];case 3:t=s.sent();eN(t_.SIMPLE_GIT_HOOKS_JSON,t);n="\n".concat(e$,"\n");eP(t_.GIT_IGNORE)?eR(t_.GIT_IGNORE,"utf-8").split("\n").includes(e$)||eC(t_.GIT_IGNORE,n,"utf-8"):eI(t_.GIT_IGNORE,n,"utf-8");r=["Setting up simple-git-hooks"];return[4,tS.simpleGitHooks()];case 4:return[4,tY.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}G(t1,"setupGitHook");function t2(){return /*#__PURE__*/i(function(){return P(this,function(e){switch(e.label){case 0:return[4,tA([eB],{update:!0,postInstallActions:[t1]})];case 1:e.sent();return[2]}})})()}G(t2,"setup");function t4(){return /*#__PURE__*/i(function(){return P(this,function(e){switch(e.label){case 0:eD(t_.NODE_MODULES,t_.PNPM_LOCK_YAML);return[4,tT()];case 1:e.sent();return[4,t1()];case 2:e.sent();return[2]}})})()}G(t4,"reset");function t3(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,tS.nodeModulesInspect()];case 1:return[4,tY.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t3,"inspect");function t5(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,tS.testUnit()];case 1:return[4,tY.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t5,"testUnit");function t8(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,tS.testE2e()];case 1:return[4,tY.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t8,"testE2E");function t6(e){return /*#__PURE__*/i(function(){var t;return P(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,tS.mongoMigrateCreate(e)];case 1:return[4,tY.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}G(t6,"mongoMigrateCreate");function t7(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,tS.mongoMigrateUp()];case 1:return[4,tY.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t7,"mongoMigrateUp");function t9(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,tS.mongoMigrateDown()];case 1:return[4,tY.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}G(t9,"mongoMigrateDown");(function(){return /*#__PURE__*/i(function(){var e;return P(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,eu(ec(ea.argv)).scriptName(e2).usage("$0 <command> [options]").command("lint","Check code for linting issues",tX).command("lint:fix","Fix linting issues automatically",tZ).command("lint:inspect","View active ESLint configuration",tz).command("lint-staged","Run lint checks on staged files",t$).command("commitlint","Validate commit message format",t0).command("setup","Initialize project setup and dependencies",t2).command("reset","Reset the project and reinstall dependencies",t4).command("inspect","Analyze installed project dependencies",t3).command("test:unit","Run unit test suite",t5).command("test:e2e","Run end-to-end test suite",t8).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return /*#__PURE__*/i(function(){return P(this,function(t){switch(t.label){case 0:if(!e.name){ei.error("Migration name is required.");return[2]}return[4,t6(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",t7).command("mongo:migrate:down","Rollback last MongoDB migration",t9).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(el.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();ei.error("Fatal: ".concat(e.message)),ea.exit(1);return[3,3];case 3:return[2]}})})()})();import{Router as ne}from"express";import{NestFactory as nt}from"@nestjs/core";import nn from"body-parser";import nr from"compression";import ns from"cookie-parser";import ni from"cors";import no from"express";import na from"express-device";import nc from"express-session";function nu(e){var t=e.isDev,n=e.whiteList,r=S(e,["isDev","whiteList"]);return h({origin:G(function(e,r){t||(n===null||n===void 0?void 0:n.includes(e!==null&&e!==void 0?e:""))?r(null,!0):r(new Error("Not allowed by CORS"),!1)},"origin"),credentials:!0},r)}G(nu,"createCorsOptions");function nl(e){return ni(nu(e))}G(nl,"createCors");function nd(e){return nc(e)}G(nd,"createSession");function nf(e){var t=no();return t.set("trust proxy",1),t.use(ns()),t.use(no.urlencoded({extended:!0})),t.use(nr()),t.use(na.capture()),(e===null||e===void 0?void 0:e.staticFolder)&&t.use(no.static(e.staticFolder)),t}G(nf,"createExpress");function np(e){return /*#__PURE__*/i(function(){var t,n,r;return P(this,function(s){switch(s.label){case 0:return[4,nt.create(e.module)];case 1:r=s.sent();return[2,(r.getHttpAdapter().getInstance().set("trust proxy",1),r.use(no.urlencoded({extended:!0})),r.use(ns()),r.use(nr()),r.use(na.capture()),e.staticFolder&&r.use(no.static(e.staticFolder)),e.filters&&(t=r).useGlobalFilters.apply(t,T(e.filters)),e.pipes&&(n=r).useGlobalPipes.apply(n,T(e.pipes)),r)]}})})()}G(np,"createNest");var nE="MONGO_MIGRATE_OPTIONS";import{Collection as nm,Db as ng}from"mongodb";import{Document as n_,Model as nh}from"mongoose";var nv=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(ng);G(nv,"C_Db");var ny=nv,nS=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(n_);G(nS,"C_Document");var nO=nS,nR=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nh);G(nR,"C_Model");var nI=nR,nC=/*#__PURE__*/function(e){"use strict";f(t,e);function t(){a(this,t);return o(this,t,arguments)}return t}(nm);G(nC,"C_Collection");var nT=nC;import{format as nA}from"date-fns";import nb from"migrate-mongo";import{Document as nN}from"mongoose";import nP from"mongoose-aggregate-paginate-v2";import nD from"mongoose-paginate-v2";import{v4 as nx}from"uuid";import nG from"unorm";var nw={a:["\xe0","\xe1","ạ","ả","\xe3","\xe2","ầ","ấ","ậ","ẩ","ẫ","ă","ằ","ắ","ặ","ẳ","ẵ"],e:["\xe8","\xe9","ẹ","ẻ","ẽ","\xea","ề","ế","ệ","ể","ễ"],i:["\xec","\xed","ị","ỉ","ĩ"],o:["\xf2","\xf3","ọ","ỏ","\xf5","\xf4","ồ","ố","ộ","ổ","ỗ","ơ","ờ","ớ","ợ","ở","ỡ"],u:["\xf9","\xfa","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ"],y:["ỳ","\xfd","ỵ","ỷ","ỹ"],d:["đ"]},nM=Object.entries(nw).reduce(function(e,t){var n=C(t,2),r=n[0],s=n[1];return e[r.toUpperCase()]=s.map(function(e){return e.toUpperCase()}),e},{});function nj(e){return(typeof e==="undefined"?"undefined":A(e))=="object"&&e!==null&&!Array.isArray(e)}G(nj,"isObject");import nL from"crypto-js";import nU from"slugify";var nk=nU.default||nU;function nF(e,t){var n=G(function(e){var n,r;return nk(e!==null&&e!==void 0?e:"",h({lower:(n=t===null||t===void 0?void 0:t.lower)!==null&&n!==void 0?n:!0,locale:(r=t===null||t===void 0?void 0:t.locale)!==null&&r!==void 0?r:"vi"},t))},"slugifyWithOptions");if(nj(e)){var r={};var s=true,i=false,o=undefined;try{for(var a=Object.entries(e)[Symbol.iterator](),c;!(s=(c=a.next()).done);s=true){var u=C(c.value,2),l=u[0],d=u[1];r[l]=n(d)}}catch(e){i=true;o=e}finally{try{if(!s&&a.return!=null){a.return()}}finally{if(i){throw o}}}return r}return n(e)}G(nF,"generateSlug");function nq(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return nL.SHA256(e).toString(nL.enc.Hex).slice(0,t)}G(nq,"generateShortId");var nK={isEmpty:function e(e){return e==null?!0:typeof e=="string"?e.trim().length===0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":A(e))=="object"?p(e,Date)?!1:p(e,Map)||p(e,Set)?e.size===0:p(e,WeakMap)||p(e,WeakSet)?!0:ArrayBuffer.isView(e)?e.byteLength===0:Object.keys(e).length===0:!1},isValidIP:function e(e){var t=e.split(".");return t.length===4&&t.every(function(e){return/^\d+$/.test(e)&&Number(e)>=0&&Number(e)<=255})?!0:/^(([a-f\d]{1,4}:){7}[a-f\d]{1,4}|((?:[a-f\d]{1,4}:){1,7}:)|((?:[a-f\d]{1,4}:){1,6}:[a-f\d]{1,4})|::)$/i.test(e)}};var nB={getDateTime:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Date;return nA(e,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.returnDateAs,n=t===void 0?"string":t;var r=n==="string"?nB.getDateTime():new Date;return{id:nx(),isDel:!1,createdAt:r,updatedAt:r}},applyPlugins:function e(e,t){t.filter(function(e){return typeof e=="function"}).forEach(function(t){return e.plugin(t)})},applyMiddlewares:function e(e,t){t.forEach(function(t){var n=t.method,r=t.pre,s=t.post;n&&r&&e.pre(n,r),n&&s&&e.post(n,s)})},createGenericSchema:function e(e){return new e.Schema({id:{type:String,default:nx,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})},createSchema:function e(e){var t=e.mongoose,n=e.schema,r=e.virtuals,s=r===void 0?[]:r,i=e.standalone,o=i===void 0?!1:i;var a=new t.Schema(n,{strict:!0});return s.forEach(function(e){var t=e.name,n=e.options,r=e.get;var s=a.virtual(t,n);r&&s.get(r)}),o||a.add(nB.createGenericSchema(t)),a},createModel:function e(e){var t=e.mongoose,n=e.name,r=e.schema,s=e.pagination,i=s===void 0?!1:s,o=e.aggregate,a=o===void 0?!1:o,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,d=l===void 0?[]:l;if(!n)throw new Error("Model name is required.");if(t.models[n])return t.models[n];var f=nB.createSchema({mongoose:t,schema:r,virtuals:u});return nB.applyPlugins(f,[i&&nD,a&&nP]),nB.applyMiddlewares(f,d),t.model(n,f)},validator:{isEmpty:function e(){return function(e){return /*#__PURE__*/i(function(){return P(this,function(t){return[2,!nK.isEmpty(e)]})})()}},isUnique:function e(e){return function(t){return /*#__PURE__*/i(function(){var n;return P(this,function(r){switch(r.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");n={$or:e.map(function(e){return l({},e,t)})};return[4,this.constructor.exists(n)];case 1:return[2,!r.sent()]}})}).call(this)}},matchesRegex:function e(e){return function(t){return /*#__PURE__*/i(function(){return P(this,function(n){if(!Array.isArray(e)||e.some(function(e){return!p(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(t)})]})})()}}},migrate:y(h({},nb),{setConfig:G(function(e){var t="// This file is automatically generated by the Cyberskill CLI.\nmodule.exports = ".concat(JSON.stringify(e,null,4));eI(t_.MIGRATE_MONGO_CONFIG,t);var n="\n".concat(e0,"\n");eP(t_.GIT_IGNORE)?eR(t_.GIT_IGNORE,"utf-8").split("\n").includes(e0)||eC(t_.GIT_IGNORE,n,"utf-8"):eI(t_.GIT_IGNORE,n,"utf-8")},"setConfig")})},nH=/*#__PURE__*/function(){"use strict";function e(t,n){a(this,e);w(this,"collection");this.collection=t.collection(n)}u(e,[{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,n,r;return P(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=h({},nB.createGenericFields(),e);n={success:!0,message:"Document created successfully"};return[4,this.collection.insertOne(t)];case 1:return[2,(n.result=s.sent(),n)];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(){var t,n,r;return P(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);t=e.map(function(e){return h({},nB.createGenericFields(),e)});return[4,this.collection.insertMany(t)];case 1:n=s.sent();return[2,n.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(n.insertedCount," documents created successfully"),result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.findOne(e)];case 1:t=r.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found"}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"findAll",value:function e(){return /*#__PURE__*/i(function(){var e,t,n;var r=arguments;return P(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Documents retrieved successfully"};return[4,this.collection.find(e).toArray()];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,{success:!1,message:n.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,n;var r=arguments;return P(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0,message:"Count retrieved successfully"};return[4,this.collection.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,{success:!1,message:n.message}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(e,t){return /*#__PURE__*/i(function(){var n,r;return P(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateOne(e,{$set:t})];case 1:n=s.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"updateMany",value:function e(e,t){return /*#__PURE__*/i(function(){var n,r;return P(this,function(s){switch(s.label){case 0:s.trys.push([0,2,,3]);return[4,this.collection.updateMany(e,{$set:t})];case 1:n=s.sent();return[2,n.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:n}];case 2:r=s.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})}).call(this)}},{key:"deleteOne",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.deleteOne(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}},{key:"deleteMany",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,this.collection.deleteMany(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})}).call(this)}}]);return e}();G(nH,"MongoController");var nY=nH,nW=/*#__PURE__*/function(){"use strict";function e(t){a(this,e);w(this,"model");this.model=t}u(e,[{key:"getModelName",value:function e(){return this.model.modelName}},{key:"findOne",value:function e(e){return /*#__PURE__*/i(function(){var e,t,n,r,s,i,o;var a=arguments;return P(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},n=a.length>2&&a[2]!==void 0?a[2]:{},r=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.findOne(e,t,n);r&&s.populate(r);return[4,s.exec()];case 2:i=c.sent();return[2,i?{success:!0,result:i}:{success:!1,message:"No ".concat(this.getModelName()," found."),code:et.NOT_FOUND.CODE}];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findAll",value:function e(e){return /*#__PURE__*/i(function(){var e,t,n,r,s,i,o;var a=arguments;return P(this,function(c){switch(c.label){case 0:e=a.length>0&&a[0]!==void 0?a[0]:{},t=a.length>1&&a[1]!==void 0?a[1]:{},n=a.length>2&&a[2]!==void 0?a[2]:{},r=a.length>3?a[3]:void 0;c.label=1;case 1:c.trys.push([1,3,,4]);s=this.model.find(e,t,n);r&&s.populate(r);i={success:!0};return[4,s.exec()];case 2:return[2,(i.result=c.sent(),i)];case 3:o=c.sent();return[2,{success:!1,message:o.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPaging",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r;var s=arguments;return P(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.paginate(e,t)];case 2:return[2,(n.result=i.sent(),n)];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"findPagingAggregate",value:function e(e){return /*#__PURE__*/i(function(e){var t,n,r;var s=arguments;return P(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.aggregatePaginate(this.model.aggregate(e),t)];case 2:return[2,(n.result=i.sent(),n)];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"count",value:function e(){return /*#__PURE__*/i(function(){var e,t,n;var r=arguments;return P(this,function(s){switch(s.label){case 0:e=r.length>0&&r[0]!==void 0?r[0]:{};s.label=1;case 1:s.trys.push([1,3,,4]);t={success:!0};return[4,this.model.countDocuments(e)];case 2:return[2,(t.result=s.sent(),t)];case 3:n=s.sent();return[2,{success:!1,message:n.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createOne",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0};return[4,this.model.create(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:n=r.sent();return[2,{success:!1,message:n.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}},{key:"createMany",value:function e(e){return /*#__PURE__*/i(function(e){var t,n,r;var s=arguments;return P(this,function(i){switch(i.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);n={success:!0};return[4,this.model.insertMany(e,t)];case 2:return[2,(n.result=i.sent().map(function(e){return p(e,nN)?e.toObject():null}).filter(function(e){return e!==null}),n)];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r,s;var i=arguments;return P(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},n=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);return[4,this.model.findOneAndUpdate(e,t,h({new:!0},n)).exec()];case 2:r=o.sent();return[2,r?{success:!0,result:r}:{success:!1,message:"Failed to update ".concat(this.getModelName(),"."),code:et.NOT_FOUND.CODE}];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"updateMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r,s;var i=arguments;return P(this,function(o){switch(o.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:{},t=i.length>1&&i[1]!==void 0?i[1]:{},n=i.length>2&&i[2]!==void 0?i[2]:{};o.label=1;case 1:o.trys.push([1,3,,4]);r={success:!0};return[4,this.model.updateMany(e,t,n).exec()];case 2:return[2,(r.result=o.sent(),r)];case 3:s=o.sent();return[2,{success:!1,message:s.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteOne",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r;var s=arguments;return P(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.findOneAndDelete(e,t).exec()];case 2:n=i.sent();return[2,n?{success:!0,result:n}:{success:!1,message:"No ".concat(this.getModelName()," found to delete."),code:et.NOT_FOUND.CODE}];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"deleteMany",value:function e(){return /*#__PURE__*/i(function(){var e,t,n,r;var s=arguments;return P(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:{},t=s.length>1&&s[1]!==void 0?s[1]:{};i.label=1;case 1:i.trys.push([1,3,,4]);return[4,this.model.deleteMany(e,t).exec()];case 2:n=i.sent();return[2,n.deletedCount===0?{success:!1,message:"No documents found to delete.",code:et.NOT_FOUND.CODE}:{success:!0,result:n}];case 3:r=i.sent();return[2,{success:!1,message:r.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 4:return[2]}})}).apply(this,arguments)}},{key:"createShortId",value:function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return /*#__PURE__*/i(function(){var n,r,s,i;return P(this,function(o){switch(o.label){case 0:n=new Set;r=0;o.label=1;case 1:if(!(r<10))return[3,5];s=nq(e,r+t);i=!n.has(s);if(!i)return[3,3];n.add(s);return[4,this.model.exists({shortId:s})];case 2:i=!o.sent();o.label=3;case 3:if(i)return[2,{success:!0,result:s}];o.label=4;case 4:r++;return[3,1];case 5:return[2,{success:!1,message:"Failed to create a unique shortId",code:et.INTERNAL_SERVER_ERROR.CODE}]}})}).call(this)}},{key:"createSlug",value:function e(e,t,n){return /*#__PURE__*/i(function(){var r,s,o,a,c,u,d,f,p,E;return P(this,function(m){switch(m.label){case 0:r=this;m.label=1;case 1:m.trys.push([1,5,,6]);s=t[e],o=nj(s),a=G(function(t){var r=h({},n!==null&&n!==void 0?n:{});return o?y(h({},r),{$or:[l({},"slug.".concat(e),t),{slugHistory:{$elemMatch:l({},"slug.".concat(e),t)}}]}):y(h({},r),{$or:[{slug:t},{slugHistory:t}]})},"generateSlugQuery"),c=G(function(e){return /*#__PURE__*/i(function(){var t,n;return P(this,function(r){switch(r.label){case 0:t=e,n=1;r.label=1;case 1:return[4,this.model.exists(a(t))];case 2:if(!r.sent())return[3,4];t="".concat(e,"-").concat(n++);r.label=3;case 3:return[3,1];case 4:return[2,t]}})}).call(r)},"generateUniqueSlug");if(!o)return[3,3];u={success:!0};d=Object.fromEntries;return[4,Promise.all(Object.entries(s).map(function(e){var t=C(e,2),n=t[0],r=t[1];return /*#__PURE__*/i(function(){var e,t;return P(this,function(s){switch(s.label){case 0:e=nF(r);t=[n];return[4,c(e)];case 1:return[2,t.concat([s.sent()])]}})})()}))];case 2:return[2,(u.result=d.apply(Object,[m.sent()]),u)];case 3:f=nF(s);p={success:!0};return[4,c(f)];case 4:return[2,(p.result=m.sent(),p)];case 5:E=m.sent();return[2,{success:!1,message:"Failed to create a unique slug: ".concat(E.message),code:et.INTERNAL_SERVER_ERROR.CODE}];case 6:return[2]}})}).call(this)}},{key:"aggregate",value:function e(e){return /*#__PURE__*/i(function(){var t,n;return P(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0};return[4,this.model.aggregate(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:n=r.sent();return[2,{success:!1,message:n.message,code:et.INTERNAL_SERVER_ERROR.CODE}];case 3:return[2]}})}).call(this)}}]);return e}();G(nW,"MongooseController");var nV=nW;import{useServer as nQ}from"graphql-ws/use/ws";import{WebSocketServer as nJ}from"ws";function n$(e){return new nJ({server:e.server,path:e.path})}G(n$,"createWSServer");function nz(e){return nQ({schema:e.schema},e.server)}G(nz,"initGraphQLWS");export{eY as BUILD_DIRECTORY,em as CHECK_PACKAGE_EMPTY_RESULT,te as COMMIT_LINT_CLI,e9 as COMMIT_LINT_PACKAGE_NAME,e2 as CYBERSKILL_CLI,e4 as CYBERSKILL_CLI_PATH,e1 as CYBERSKILL_DIRECTORY,eB as CYBERSKILL_PACKAGE_NAME,nT as C_Collection,ny as C_Db,nO as C_Document,nI as C_Model,e5 as ESLINT_CLI,tf as ESLINT_INSPECT_CLI,td as ESLINT_INSPECT_PACKAGE_NAME,e3 as ESLINT_PACKAGE_NAME,ed as E_CommandType,F as E_IssueType,to as GIT_CLI,eZ as GIT_COMMIT_EDITMSG,eX as GIT_HOOK,eJ as GIT_IGNORE,tn as LINT_STAGED_CLI,tt as LINT_STAGED_PACKAGE_NAME,tg as MIGRATE_MONGO_CLI,e0 as MIGRATE_MONGO_CONFIG,tm as MIGRATE_MONGO_PACKAGE_NAME,nE as MONGO_MIGRATE_OPTIONS,nY as MongoController,nV as MongooseController,eH as NODE_MODULES,tE as NODE_MODULES_INSPECT_CLI,tp as NODE_MODULES_INSPECT_PACKAGE_NAME,eW as PACKAGE_JSON,eV as PACKAGE_LOCK_JSON,t_ as PATH,e6 as PLAYWRIGHT_PACKAGE_NAME,ta as PNPM_CLI,tc as PNPM_EXEC_CLI,ez as PNPM_LOCK_YAML,ne as Router,tu as SIMPLE_GIT_HOOKS_PACKAGE_NAME,tl as SIMPLE_GIT_HOOK_CLI,e$ as SIMPLE_GIT_HOOK_JSON,eQ as TSCONFIG_JSON,ts as TSC_CLI,tr as TSC_PACKAGE_NAME,ti as TSX_CLI,e7 as VITEST_CLI,e8 as VITEST_PACKAGE_NAME,eK as WORKING_DIRECTORY,nP as aggregatePaginate,eC as appendFileSync,nn as bodyParser,tC as checkPackage,tL as clearAllErrorLists,tS as command,ex as copySync,eo as createApolloServer,nl as createCors,nu as createCorsOptions,nf as createExpress,th as createGitHooksConfig,np as createNest,nd as createSession,n$ as createWSServer,no as express,j as expressMiddleware,tB as formatCommand,ev as fs,tI as getLatestPackageVersion,tR as getPackage,tj as getStoredErrorLists,nz as initGraphQLWS,tT as installDependencies,eF as join,ei as logNodeJS,ey as lstatSync,eO as mkdirSync,nB as mongo,nD as mongoosePaginate,eL as path,eP as pathExistsSync,tq as rawCommand,eR as readFileSync,eb as readJsonSync,eS as readdirSync,eD as removeSync,ek as resolve,tH as resolveCommands,eU as resolveWorkingPath,tY as runCommand,tA as setupPackages,eA as statSync,tD as storageNodeJS,er as throwError,eT as unlinkSync,eI as writeFileSync,eN as writeJsonSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var E=Object.create;var t=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var a=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty;var S=function(e,E){return t(e,"name",{value:E,configurable:!0})};var u=function(e,E){for(var r in E)t(e,r,{get:E[r],enumerable:!0})},
|
|
1
|
+
"use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var E=Object.create;var t=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var a=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty;var S=function(e,E){return t(e,"name",{value:E,configurable:!0})};var u=function(e,E){for(var r in E)t(e,r,{get:E[r],enumerable:!0})},i=function(E,a,S,u){var i=true,O=false,l=undefined;if(a&&(typeof a==="undefined"?"undefined":e(a))=="object"||typeof a=="function")try{var A=function(){var e=D.value;!n.call(E,e)&&e!==S&&t(E,e,{get:function(){return a[e]},enumerable:!(u=r(a,e))||u.enumerable})};for(var T=o(a)[Symbol.iterator](),D;!(i=(D=T.next()).done);i=true)A()}catch(e){O=true;l=e}finally{try{if(!i&&T.return!=null){T.return()}}finally{if(O){throw l}}}return E};var O=function(e,r,o){return o=e!=null?E(a(e)):{},i(r||!e||!e.__esModule?t(o,"default",{value:e,enumerable:!0}):o,e)},l=function(e){return i(t({},"__esModule",{value:!0}),e)};var A={};u(A,{E_IssueType:function(){return T},logNodeJS:function(){return h},throwError:function(){return L}});module.exports=l(A);var T=function(e){return e.Error="error",e.Warning="warning",e}({});var D=O(require("chalk"),1),d=O(require("consola"),1),R=require("graphql");var s=".cyberskill-storage";var c=O(require("@dotenvx/dotenvx"),1),C=require("envalid"),_=O(require("os"),1),f=O(require("path"),1),I=O(require("process"),1);var M=!1;function N(){M||(c.default.config(),M=!0)}S(N,"loadEnvFile");function G(){N();var e=(0,C.cleanEnv)(I.default.env,{CWD:(0,C.str)({default:I.default.cwd()}),DEBUG:(0,C.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,C.str)({default:f.default.join(_.default.homedir(),s)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}S(G,"getEnv");var v={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var U=G();function L(e){var E=e.message,t=e.status,r=t===void 0?v.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var n;var S=(n=E!==null&&E!==void 0?E:r.MESSAGE)!==null&&n!==void 0?n:"Internal server error";throw a==="graphql"?new R.GraphQLError(S,{extensions:{code:r.CODE}}):new Error(S)}S(L,"throwError");U.DEBUG||(d.default.level=4);function P(e){var E=D.default[e];return typeof E=="function"?E:D.default.green}S(P,"chalkKeyword");var h={silent:d.default.silent,level:d.default.level,fatal:d.default.fatal,error:d.default.error,warn:d.default.warn,log:d.default.log,info:d.default.info,success:d.default.success,ready:d.default.ready,start:d.default.start,box:d.default.box,debug:d.default.debug,trace:d.default.trace,verbose:d.default.verbose,printBoxedLog:function e(e,E){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(E===null||E===void 0?void 0:E.length)){d.default.box(D.default.green(e));return}E.forEach(function(e){var E=e.file,r=e.position,o=e.rule,a=e.message;d.default.log("".concat(D.default.gray("File:")," ").concat(D.default.blue("".concat(E).concat(r?":".concat(r):"")))),o&&d.default.log(" ".concat(P(t)("Rule:")," ").concat(o)),d.default.log(" ".concat(P(t)("Message:")," ").concat(a))}),d.default.box(P(t)("".concat(e," : ").concat(E.length))),d.default.log(D.default.gray("─".repeat(40)))}};0&&(module.exports={E_IssueType:E_IssueType,logNodeJS:logNodeJS,throwError:throwError});
|
package/dist/nodejs/log/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var E=Object.defineProperty;var e=function(e,
|
|
1
|
+
var E=Object.defineProperty;var e=function(e,t){return E(e,"name",{value:t,configurable:!0})};var t=function(E){return E.Error="error",E.Warning="warning",E}({});import o from"chalk";import r from"consola";import{GraphQLError as S}from"graphql";var n=".cyberskill-storage";import a from"@dotenvx/dotenvx";import{bool as O,cleanEnv as A,str as i}from"envalid";import D from"node:os";import T from"node:path";import R from"node:process";var s=!1;function C(){s||(a.config(),s=!0)}e(C,"loadEnvFile");function _(){C();var E=A(R.env,{CWD:i({default:R.cwd()}),DEBUG:O({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:i({default:T.join(D.homedir(),n)})});return{CWD:E.CWD,DEBUG:E.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:E.CYBERSKILL_STORAGE_DIRECTORY}}e(_,"getEnv");var I={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var c=_();function M(E){var e=E.message,t=E.status,o=t===void 0?I.INTERNAL_SERVER_ERROR:t,r=E.type,n=r===void 0?"graphql":r;var a;var O=(a=e!==null&&e!==void 0?e:o.MESSAGE)!==null&&a!==void 0?a:"Internal server error";throw n==="graphql"?new S(O,{extensions:{code:o.CODE}}):new Error(O)}e(M,"throwError");c.DEBUG||(r.level=4);function G(E){var e=o[E];return typeof e=="function"?e:o.green}e(G,"chalkKeyword");var N={silent:r.silent,level:r.level,fatal:r.fatal,error:r.error,warn:r.warn,log:r.log,info:r.info,success:r.success,ready:r.ready,start:r.start,box:r.box,debug:r.debug,trace:r.trace,verbose:r.verbose,printBoxedLog:function E(E,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(e===null||e===void 0?void 0:e.length)){r.box(o.green(E));return}e.forEach(function(E){var e=E.file,S=E.position,n=E.rule,a=E.message;r.log("".concat(o.gray("File:")," ").concat(o.blue("".concat(e).concat(S?":".concat(S):"")))),n&&r.log(" ".concat(G(t)("Rule:")," ").concat(n)),r.log(" ".concat(G(t)("Message:")," ").concat(a))}),r.box(G(t)("".concat(E," : ").concat(e.length))),r.log(o.gray("─".repeat(40)))}};export{t as E_IssueType,N as logNodeJS,M as throwError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var E=Object.create;var t=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var a=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty;var S=function(e,E){return t(e,"name",{value:E,configurable:!0})};var O=function(e,E){for(var r in E)t(e,r,{get:E[r],enumerable:!0})},i=function(E,a,S,O){var i=true,u=false,l=undefined;if(a&&(typeof a==="undefined"?"undefined":e(a))=="object"||typeof a=="function")try{var A=function(){var e=
|
|
1
|
+
"use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var E=Object.create;var t=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var a=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty;var S=function(e,E){return t(e,"name",{value:E,configurable:!0})};var O=function(e,E){for(var r in E)t(e,r,{get:E[r],enumerable:!0})},i=function(E,a,S,O){var i=true,u=false,l=undefined;if(a&&(typeof a==="undefined"?"undefined":e(a))=="object"||typeof a=="function")try{var A=function(){var e=d.value;!n.call(E,e)&&e!==S&&t(E,e,{get:function(){return a[e]},enumerable:!(O=r(a,e))||O.enumerable})};for(var D=o(a)[Symbol.iterator](),d;!(i=(d=D.next()).done);i=true)A()}catch(e){u=true;l=e}finally{try{if(!i&&D.return!=null){D.return()}}finally{if(u){throw l}}}return E};var u=function(e,r,o){return o=e!=null?E(a(e)):{},i(r||!e||!e.__esModule?t(o,"default",{value:e,enumerable:!0}):o,e)},l=function(e){return i(t({},"__esModule",{value:!0}),e)};var A={};O(A,{logNodeJS:function(){return P},throwError:function(){return U}});module.exports=l(A);var D=u(require("chalk"),1),d=u(require("consola"),1),R=require("graphql");var T=".cyberskill-storage";var c=u(require("@dotenvx/dotenvx"),1),s=require("envalid"),C=u(require("os"),1),_=u(require("path"),1),f=u(require("process"),1);var M=!1;function I(){M||(c.default.config(),M=!0)}S(I,"loadEnvFile");function N(){I();var e=(0,s.cleanEnv)(f.default.env,{CWD:(0,s.str)({default:f.default.cwd()}),DEBUG:(0,s.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,s.str)({default:_.default.join(C.default.homedir(),T)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}S(N,"getEnv");var G={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var v=N();function U(e){var E=e.message,t=e.status,r=t===void 0?G.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var n;var S=(n=E!==null&&E!==void 0?E:r.MESSAGE)!==null&&n!==void 0?n:"Internal server error";throw a==="graphql"?new R.GraphQLError(S,{extensions:{code:r.CODE}}):new Error(S)}S(U,"throwError");v.DEBUG||(d.default.level=4);function L(e){var E=D.default[e];return typeof E=="function"?E:D.default.green}S(L,"chalkKeyword");var P={silent:d.default.silent,level:d.default.level,fatal:d.default.fatal,error:d.default.error,warn:d.default.warn,log:d.default.log,info:d.default.info,success:d.default.success,ready:d.default.ready,start:d.default.start,box:d.default.box,debug:d.default.debug,trace:d.default.trace,verbose:d.default.verbose,printBoxedLog:function e(e,E){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(E===null||E===void 0?void 0:E.length)){d.default.box(D.default.green(e));return}E.forEach(function(e){var E=e.file,r=e.position,o=e.rule,a=e.message;d.default.log("".concat(D.default.gray("File:")," ").concat(D.default.blue("".concat(E).concat(r?":".concat(r):"")))),o&&d.default.log(" ".concat(L(t)("Rule:")," ").concat(o)),d.default.log(" ".concat(L(t)("Message:")," ").concat(a))}),d.default.box(L(t)("".concat(e," : ").concat(E.length))),d.default.log(D.default.gray("─".repeat(40)))}};0&&(module.exports={logNodeJS:logNodeJS,throwError:throwError});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var E=Object.defineProperty;var e=function(e,t){return E(e,"name",{value:t,configurable:!0})};import t from"chalk";import o from"consola";import{GraphQLError as S}from"graphql";var r=".cyberskill-storage";import
|
|
1
|
+
var E=Object.defineProperty;var e=function(e,t){return E(e,"name",{value:t,configurable:!0})};import t from"chalk";import o from"consola";import{GraphQLError as S}from"graphql";var r=".cyberskill-storage";import a from"@dotenvx/dotenvx";import{bool as n,cleanEnv as O,str as A}from"envalid";import i from"node:os";import D from"node:path";import R from"node:process";var T=!1;function s(){T||(a.config(),T=!0)}e(s,"loadEnvFile");function C(){s();var E=O(R.env,{CWD:A({default:R.cwd()}),DEBUG:n({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:A({default:D.join(i.homedir(),r)})});return{CWD:E.CWD,DEBUG:E.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:E.CYBERSKILL_STORAGE_DIRECTORY}}e(C,"getEnv");var _={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var I=C();function c(E){var e=E.message,t=E.status,o=t===void 0?_.INTERNAL_SERVER_ERROR:t,r=E.type,a=r===void 0?"graphql":r;var n;var O=(n=e!==null&&e!==void 0?e:o.MESSAGE)!==null&&n!==void 0?n:"Internal server error";throw a==="graphql"?new S(O,{extensions:{code:o.CODE}}):new Error(O)}e(c,"throwError");I.DEBUG||(o.level=4);function M(E){var e=t[E];return typeof e=="function"?e:t.green}e(M,"chalkKeyword");var G={silent:o.silent,level:o.level,fatal:o.fatal,error:o.error,warn:o.warn,log:o.log,info:o.info,success:o.success,ready:o.ready,start:o.start,box:o.box,debug:o.debug,trace:o.trace,verbose:o.verbose,printBoxedLog:function E(E,e){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(e===null||e===void 0?void 0:e.length)){o.box(t.green(E));return}e.forEach(function(E){var e=E.file,r=E.position,a=E.rule,n=E.message;o.log("".concat(t.gray("File:")," ").concat(t.blue("".concat(e).concat(r?":".concat(r):"")))),a&&o.log(" ".concat(M(S)("Rule:")," ").concat(a)),o.log(" ".concat(M(S)("Message:")," ").concat(n))}),o.box(M(S)("".concat(E," : ").concat(e.length))),o.log(t.gray("─".repeat(40)))}};export{G as logNodeJS,c as throwError};
|