@cyberskill/shared 1.201.1 → 1.203.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/{path.constant-BT9ilH7U.cjs → path.constant-CPGOAxEp.cjs} +1 -1
- package/dist/{path.constant-C43rx8PK.js → path.constant-DJq0jtD0.js} +5 -5
- package/dist/src/config/vitest/vitest.unit.cjs +1 -1
- package/dist/src/config/vitest/vitest.unit.js +1 -1
- package/dist/src/node/cli/cli.util.cjs +1 -1
- package/dist/src/node/cli/cli.util.js +6 -6
- package/dist/src/node/command/command.util.cjs +1 -1
- package/dist/src/node/command/command.util.js +1 -1
- package/dist/src/node/command/index.cjs +1 -1
- package/dist/src/node/command/index.js +1 -1
- package/dist/src/node/express/express.util.cjs +1 -1
- package/dist/src/node/express/express.util.js +43 -42
- package/dist/src/node/mongo/mongo.util.cjs +1 -1
- package/dist/src/node/mongo/mongo.util.js +1 -1
- package/dist/src/node/package/index.cjs +1 -1
- package/dist/src/node/package/index.js +1 -1
- package/dist/src/node/package/package.util.cjs +1 -1
- package/dist/src/node/package/package.util.js +1 -1
- package/dist/src/node/path/index.cjs +1 -1
- package/dist/src/node/path/index.js +1 -1
- package/dist/src/node/path/path.constant.cjs +1 -1
- package/dist/src/node/path/path.constant.js +1 -1
- package/dist/src/node/upload/upload.util.cjs +1 -1
- package/dist/src/node/upload/upload.util.js +1 -1
- package/dist/src/react/apollo-client/apollo-client.util.cjs +1 -1
- package/dist/src/react/apollo-client/apollo-client.util.js +27 -27
- package/package.json +6 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";var ve=Object.defineProperty;var se=Object.getOwnPropertySymbols;var Ve=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var re=(e,t,n)=>t in e?ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ae=(e,t)=>{for(var n in t||(t={}))Ve.call(t,n)&&re(e,n,t[n]);if(se)for(var n of se(t))we.call(t,n)&&re(e,n,t[n]);return e};var I=(e,t,n)=>new Promise((s,a)=>{var c=r=>{try{o(n.next(r))}catch(T){a(T)}},p=r=>{try{o(n.throw(r))}catch(T){a(T)}},o=r=>r.done?s(r.value):Promise.resolve(r.value).then(c,p);o((n=n.apply(e,t)).next())});const Ye=require("fs-extra"),X=require("./src/config/env/env.util.cjs"),E=require("./src/node/command/command.type.cjs"),je=require("node:child_process"),oe=require("node:process"),Je=require("node:util"),g=require("./src/node/log/log.type.cjs"),C=require("./src/node/log/log.util.cjs"),Ue=require("node-fetch"),y=require("./src/node/fs/fs.util.cjs"),i=require("./src/node/package/package.type.cjs"),m=require("./src/node/path/path.util.cjs"),v=require("./src/node/storage/storage.util.cjs");function Fe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const We=Fe(Je),xe=X.getEnv();function ie(e){return I(this,null,function*(){try{const t=yield Ue(`https://registry.npmjs.org/${e}/latest`);if(!t.ok)throw new Error(`Failed to fetch latest version: ${t.status} ${t.statusText}`);const{version:n}=yield t.json();return{success:!0,result:n}}catch(t){return C.catchError(t)}})}function U(e){return I(this,null,function*(){var t,n;try{if(!e){if(y.pathExistsSync(_.PACKAGE_JSON)){const h=y.readJsonSync(_.PACKAGE_JSON),{name:$="",version:M=""}=h;return{success:!0,result:{name:$,currentVersion:M,latestVersion:M,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:_.PACKAGE_JSON,file:h}}}return{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}}if(!y.pathExistsSync(_.PACKAGE_JSON))return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===i.E_PackageType.DEPENDENCY,isDevDependency:e.type===i.E_PackageType.DEV_DEPENDENCY,installedPath:"",file:{}}};const s=y.readJsonSync(_.PACKAGE_JSON),{name:a,version:c="",dependencies:p={},devDependencies:o={}}=s;if(e.name===a)return{success:!0,result:{name:a,currentVersion:c,latestVersion:c,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===i.E_PackageType.DEPENDENCY,isDevDependency:e.type===i.E_PackageType.DEV_DEPENDENCY,installedPath:_.PACKAGE_JSON,file:s}};const r=e.name in p,T=e.name in o,d=yield ie(e.name);if(!d.success)return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:r,isDevDependency:T,installedPath:"",file:{}}};if(!r&&!T)return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:d.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===i.E_PackageType.DEPENDENCY,isDevDependency:e.type===i.E_PackageType.DEV_DEPENDENCY,installedPath:"",file:{}}};const f=(n=(t=p[e.name])!=null?t:o[e.name])!=null?n:"",O=m.join(xe.CWD,F,e.name,W);if(!y.pathExistsSync(O))return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:d.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:r,isDevDependency:T,installedPath:"",file:{}}};const S=y.readJsonSync(O),{version:A=""}=S;return f!==A?{success:!0,result:{name:e.name,currentVersion:A||f,latestVersion:d.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:r,isDevDependency:T,installedPath:O,file:S}}:{success:!0,result:{name:e.name,currentVersion:f,latestVersion:d.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:f===d.result,isDependency:r,isDevDependency:T,installedPath:O,file:S}}}catch(s){return C.catchError(s)}})}function x(e){return I(this,null,function*(){var t,n;try{const s=y.readJsonSync(_.PACKAGE_JSON),a=(t=s.dependencies)!=null?t:{},c=(n=s.devDependencies)!=null?n:{};e.isDependency?a[e.name]=e.latestVersion:e.isDevDependency&&(c[e.name]=e.latestVersion),y.writeFileSync(_.PACKAGE_JSON,JSON.stringify(s,null,4)),C.log.info(`Updated "${e.name}" to version ${e.latestVersion}`)}catch(s){C.catchError(s)}})}function Ee(){return I(this,null,function*(){try{const e=[{command:()=>k.pnpmInstallStandard(),message:"Installing dependencies (standard)"},{command:()=>k.pnpmInstallLegacy(),message:"Retrying with legacy peer dependencies"},{command:()=>k.pnpmInstallForce(),message:"Retrying with force install"}];for(const{command:t,message:n}of e)try{const s=yield t();yield Q(`${n} using: ${s}`,s);return}catch(s){C.catchError(s)}}catch(e){C.catchError(e)}})}function _e(e,t){return I(this,null,function*(){var n;try{if(!y.pathExistsSync(_.PACKAGE_JSON)){C.log.error("package.json not found. Aborting setup.");return}const a=(yield Promise.all(e.map(U))).filter(r=>r.success&&!!r.result&&!r.result.isCurrentProject).map(r=>r.result),c=a.filter(r=>!r.isInstalled),p=a.filter(r=>!r.isUpToDate),o=[];t!=null&&t.install&&c.length>0&&o.push(...c.map(x)),t!=null&&t.update&&p.length>0&&o.push(...p.map(x)),o.length>0&&(yield Promise.all(o),yield Ee(),yield Q("Running ESLint with auto-fix",yield k.eslintFix()));for(const r of(n=t==null?void 0:t.callbacks)!=null?n:[])yield r()}catch(s){C.catchError(s)}})}const le=X.getEnv(),be=We.promisify(je.exec);function z(){return I(this,null,function*(){const e=yield U();return e.success?e.result.name:Date.now().toString()})}function me(e){return I(this,null,function*(){if(e.length===0)return;const t=yield z();try{yield v.storage.set(t,e),setTimeout(()=>I(null,null,function*(){const n=yield v.storage.getLogLink(t);n&&C.log.info(`📂 Open the error list manually: ${n}`)}),0)}catch(n){C.catchError(n)}})}function He(){return I(this,null,function*(){try{const e=yield z(),t=yield v.storage.get(e);return t!=null?t:[]}catch(e){return C.catchError(e,{returnValue:[]})}})}function Be(){return I(this,null,function*(){try{const e=yield z();yield v.storage.remove(e)}catch(e){C.catchError(e)}})}function qe(e){const t=[],n=[];let s="";const a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,c=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,p=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split(`
|
|
2
|
-
`).forEach(o=>{var r,T,d,f,O,S,A,h,$,M,ne;if(o.startsWith("/"))s=o.trim();else{const u=a.exec(o)||[],N=c.exec(o)||[],D=p.exec(o)||[];u.length&&s?t.push({file:s,position:`${u[1]}:${u[2]}`,type:u[3]===g.E_IssueType.Error?g.E_IssueType.Error:g.E_IssueType.Warning,message:(T=(r=u==null?void 0:u[4])==null?void 0:r.trim())!=null?T:"",rule:(f=(d=u==null?void 0:u[5])==null?void 0:d.trim())!=null?f:""}):N.length?t.push({file:(O=N==null?void 0:N[1])!=null?O:"",position:`${N[2]}:${N[3]}`,type:N[4]===g.E_IssueType.Error?g.E_IssueType.Error:g.E_IssueType.Warning,message:(A=(S=N==null?void 0:N[5])==null?void 0:S.trim())!=null?A:""}):D.length?t.push({file:"commitlint",type:g.E_IssueType.Error,message:($=(h=D==null?void 0:D[1])==null?void 0:h.trim())!=null?$:"",rule:(ne=(M=D==null?void 0:D[2])==null?void 0:M.trim())!=null?ne:""}):n.push(o.trim())}}),t.length&&me(t),le.DEBUG&&n.length&&(C.log.warn("Unmatched lines:"),n.forEach(o=>C.log.info(` ${o}`)))}function Xe(e){try{const t=JSON.parse(e),n=[];t.forEach(({filePath:s,messages:a})=>{a.forEach(({severity:c,line:p,column:o,ruleId:r,message:T})=>{n.push({type:c===2?g.E_IssueType.Error:g.E_IssueType.Warning,file:s,position:`${p}:${o}`,rule:r,message:T})})}),n.length&&me(n)}catch(t){qe(e)}}function ze(n){return I(this,arguments,function*(e,t=Xe){const s=new AbortController;oe.on("SIGINT",()=>{C.log.warn("Process interrupted. Terminating..."),s.abort(),oe.exit()});try{if(typeof e=="string"){const{stdout:a,stderr:c}=yield be(e,{maxBuffer:104857600,signal:s.signal});[a,c].forEach(p=>p&&t(p))}}catch(a){const{stdout:c,stderr:p,message:o}=a;[c,p].forEach(r=>r&&t(r)),!p&&!c&&C.log.error(`Command failed: ${o}`)}})}function V(e){return{raw:!0,cmd:e}}function ce(e,t){return t!=null&&t.isCurrentProject?`${J} ${P} ${Oe} ${e}`:`${J} ${fe} ${e}`}function w(e,t){return typeof e=="function"?ce(e(t),t):typeof e=="object"&&(e==null?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ce(e,t):e}function Qe(e){return I(this,null,function*(){const t=yield U({name:j});if(t.success){const n={isCurrentProject:t.result.isCurrentProject},s=typeof e=="function"?e(n):e;return Object.fromEntries(Object.entries(s).map(([a,c])=>[a,w(c,n)]))}})}function Q(e,t){return I(this,null,function*(){try{C.log.start(`${e}`),le.DEBUG&&C.log.info(`→ ${t}`),yield ze(t),C.log.success(`${e} done.`)}catch(n){C.catchError(n)}})}const Ze=X.getEnv(),Y=Ze.CWD,j="@cyberskill/shared",F="node_modules",Ce="dist",pe="public",W="package.json",Ie="package-lock.json",Te="tsconfig.json",ue=".gitignore",Ne=".simple-git-hooks.json",de="pnpm-lock.yaml",ge=".git/hooks/",ye=".git/COMMIT_EDITMSG",Pe=".migrate-mongo.config.js",G=(()=>{const t=Ye.readJsonSync(m.resolveWorkingPath(W)).name===j?Y:m.join(Y,F,j);return m.join(t,Ce)})(),fe="cyberskill",Oe="src/node/cli/index.ts",b="eslint",H="eslint",B="vitest",q="vitest",De="@commitlint/cli",Ge="@commitlint/config-conventional",Z="commitlint",Le="lint-staged",ee="lint-staged",Se="typescript",Ae="tsc",P="tsx",te="git",L="pnpm",J="pnpm exec",he="simple-git-hooks",Me="simple-git-hooks",ke="@eslint/config-inspector",$e="eslint-config-inspector",Ke="node-modules-inspector",Re="node-modules-inspector",K="migrate-mongo",R="./node_modules/migrate-mongo/bin/migrate-mongo",_={CYBERSKILL_DIRECTORY:G,WORKING_DIRECTORY:Y,PUBLIC_DIRECTORY:m.resolveWorkingPath(pe),TS_CONFIG:m.resolveWorkingPath(Te),GIT_IGNORE:m.resolveWorkingPath(ue),GIT_HOOK:m.resolveWorkingPath(ge),GIT_COMMIT_MSG:m.resolveWorkingPath(ye),SIMPLE_GIT_HOOKS_JSON:m.resolveWorkingPath(Ne),PACKAGE_JSON:m.resolveWorkingPath(W),PACKAGE_LOCK_JSON:m.resolveWorkingPath(Ie),PNPM_LOCK_YAML:m.resolveWorkingPath(de),NODE_MODULES:m.resolveWorkingPath(F),MIGRATE_MONGO_CONFIG:m.resolveWorkingPath(Pe),LINT_STAGED_CONFIG:m.resolveWorkingPath(`${G}/config/lint-staged/index.js`),COMMITLINT_CONFIG:m.resolveWorkingPath(`${G}/config/commitlint/index.js`),VITEST_UNIT_CONFIG:m.resolveWorkingPath(`${G}/config/vitest/vitest.unit.js`),VITEST_UNIT_SETUP_CONFIG:m.resolveWorkingPath(`${G}/config/vitest/vitest.unit.setup.js`),VITEST_E2E_CONFIG:m.resolveWorkingPath(`${G}/config/vitest/vitest.e2e.js`)};function et({isCurrentProject:e}){return ae({"pre-commit":ee,"commit-msg":Z},e&&{"pre-push":V(`${te} pull`)})}function l({type:e,packages:t,command:n}){const s=t==null?void 0:t.reduce((a,c)=>(a.some(p=>p.name===c.name)||a.push(c),a),[]);return()=>I(null,null,function*(){switch(e){case E.E_CommandType.CLI:return s!=null&&s.length&&(yield _e(s,{install:!0})),w(V(`${J} ${n}`));case E.E_CommandType.STRING:return w(V(n));default:throw new Error("Unsupported command type")}})}const k={simpleGitHooks:l({type:E.E_CommandType.CLI,packages:[{name:he,type:i.E_PackageType.DEV_DEPENDENCY}],command:Me}),eslintInspect:l({type:E.E_CommandType.CLI,packages:[{name:ke,type:i.E_PackageType.DEV_DEPENDENCY}],command:$e}),nodeModulesInspect:l({type:E.E_CommandType.CLI,packages:[{name:Ke,type:i.E_PackageType.DEV_DEPENDENCY}],command:Re}),eslintCheck:l({type:E.E_CommandType.CLI,packages:[{name:b,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${H} ${_.WORKING_DIRECTORY} --no-cache`}),eslintFix:l({type:E.E_CommandType.CLI,packages:[{name:b,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${H} ${_.WORKING_DIRECTORY} --fix --no-cache`}),typescriptCheck:l({type:E.E_CommandType.CLI,packages:[{name:Se,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${Ae} -p ${_.TS_CONFIG} --noEmit`}),testUnit:l({type:E.E_CommandType.CLI,packages:[{name:B,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${q} --config ${_.VITEST_UNIT_CONFIG}`}),testE2e:l({type:E.E_CommandType.CLI,packages:[{name:B,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${q} --config ${_.VITEST_E2E_CONFIG}`}),mongoMigrateCreate:e=>l({type:E.E_CommandType.CLI,packages:[{name:P,type:i.E_PackageType.DEPENDENCY},{name:K,type:i.E_PackageType.DEPENDENCY}],command:`${P} ${R} create ${e} -f ${_.MIGRATE_MONGO_CONFIG}`})(),mongoMigrateUp:l({type:E.E_CommandType.CLI,packages:[{name:P,type:i.E_PackageType.DEPENDENCY},{name:K,type:i.E_PackageType.DEPENDENCY}],command:`${P} ${R} up -f ${_.MIGRATE_MONGO_CONFIG}`}),mongoMigrateDown:l({type:E.E_CommandType.CLI,packages:[{name:P,type:i.E_PackageType.DEPENDENCY},{name:K,type:i.E_PackageType.DEPENDENCY}],command:`${P} ${R} down -f ${_.MIGRATE_MONGO_CONFIG}`}),commitLint:l({type:E.E_CommandType.CLI,packages:[{name:De,type:i.E_PackageType.DEV_DEPENDENCY},{name:Ge,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${Z} --edit ${_.GIT_COMMIT_MSG} --config ${_.COMMITLINT_CONFIG}`}),lintStaged:l({type:E.E_CommandType.CLI,packages:[{name:Le,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${ee} --config ${_.LINT_STAGED_CONFIG}`}),configureGitHook:l({type:E.E_CommandType.STRING,command:`${te} config core.hooksPath ${_.GIT_HOOK}`}),build:l({type:E.E_CommandType.STRING,command:`${L} run --if-present build`}),pnpmInstallStandard:l({type:E.E_CommandType.STRING,command:`${L} install --ignore-scripts`}),pnpmInstallLegacy:l({type:E.E_CommandType.STRING,command:`${L} install --ignore-scripts --legacy-peer-deps`}),pnpmInstallForce:l({type:E.E_CommandType.STRING,command:`${L} install --ignore-scripts --force`}),pnpmPruneStore:l({type:E.E_CommandType.STRING,command:`${L} store prune`}),pnpmCleanCache:l({type:E.E_CommandType.STRING,command:`${L} cache delete`})};exports.BUILD_DIRECTORY=Ce;exports.COMMIT_LINT_CLI=Z;exports.COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME=Ge;exports.COMMIT_LINT_PACKAGE_NAME=De;exports.CYBERSKILL_CLI=fe;exports.CYBERSKILL_CLI_PATH=Oe;exports.CYBERSKILL_DIRECTORY=G;exports.CYBERSKILL_PACKAGE_NAME=j;exports.ESLINT_CLI=H;exports.ESLINT_INSPECT_CLI=$e;exports.ESLINT_INSPECT_PACKAGE_NAME=ke;exports.ESLINT_PACKAGE_NAME=b;exports.GIT_CLI=te;exports.GIT_COMMIT_EDITMSG=ye;exports.GIT_HOOK=ge;exports.GIT_IGNORE=ue;exports.LINT_STAGED_CLI=ee;exports.LINT_STAGED_PACKAGE_NAME=Le;exports.MIGRATE_MONGO_CLI=R;exports.MIGRATE_MONGO_CONFIG=Pe;exports.MIGRATE_MONGO_PACKAGE_NAME=K;exports.NODE_MODULES=F;exports.NODE_MODULES_INSPECT_CLI=Re;exports.NODE_MODULES_INSPECT_PACKAGE_NAME=Ke;exports.PACKAGE_JSON=W;exports.PACKAGE_LOCK_JSON=Ie;exports.PATH=_;exports.PNPM_CLI=L;exports.PNPM_EXEC_CLI=J;exports.PNPM_LOCK_YAML=de;exports.PUBLIC_DIRECTORY=pe;exports.SIMPLE_GIT_HOOKS_PACKAGE_NAME=he;exports.SIMPLE_GIT_HOOK_CLI=Me;exports.SIMPLE_GIT_HOOK_JSON=Ne;exports.TSCONFIG_JSON=Te;exports.TSC_CLI=Ae;exports.TSC_PACKAGE_NAME=Se;exports.TSX_CLI=P;exports.VITEST_CLI=q;exports.VITEST_PACKAGE_NAME=B;exports.WORKING_DIRECTORY=Y;exports.clearAllErrorLists=Be;exports.command=k;exports.createGitHooksConfig=et;exports.formatCommand=w;exports.getLatestPackageVersion=ie;exports.getPackage=U;exports.getStoredErrorLists=He;exports.installDependencies=Ee;exports.rawCommand=V;exports.resolveCommands=Qe;exports.runCommand=Q;exports.setupPackages=_e;exports.updatePackage=x;
|
|
2
|
+
`).forEach(o=>{var r,T,d,f,O,S,A,h,$,M,ne;if(o.startsWith("/"))s=o.trim();else{const u=a.exec(o)||[],N=c.exec(o)||[],D=p.exec(o)||[];u.length&&s?t.push({file:s,position:`${u[1]}:${u[2]}`,type:u[3]===g.E_IssueType.Error?g.E_IssueType.Error:g.E_IssueType.Warning,message:(T=(r=u==null?void 0:u[4])==null?void 0:r.trim())!=null?T:"",rule:(f=(d=u==null?void 0:u[5])==null?void 0:d.trim())!=null?f:""}):N.length?t.push({file:(O=N==null?void 0:N[1])!=null?O:"",position:`${N[2]}:${N[3]}`,type:N[4]===g.E_IssueType.Error?g.E_IssueType.Error:g.E_IssueType.Warning,message:(A=(S=N==null?void 0:N[5])==null?void 0:S.trim())!=null?A:""}):D.length?t.push({file:"commitlint",type:g.E_IssueType.Error,message:($=(h=D==null?void 0:D[1])==null?void 0:h.trim())!=null?$:"",rule:(ne=(M=D==null?void 0:D[2])==null?void 0:M.trim())!=null?ne:""}):n.push(o.trim())}}),t.length&&me(t),le.DEBUG&&n.length&&(C.log.warn("Unmatched lines:"),n.forEach(o=>C.log.info(` ${o}`)))}function Xe(e){try{const t=JSON.parse(e),n=[];t.forEach(({filePath:s,messages:a})=>{a.forEach(({severity:c,line:p,column:o,ruleId:r,message:T})=>{n.push({type:c===2?g.E_IssueType.Error:g.E_IssueType.Warning,file:s,position:`${p}:${o}`,rule:r,message:T})})}),n.length&&me(n)}catch(t){qe(e)}}function ze(n){return I(this,arguments,function*(e,t=Xe){const s=new AbortController;oe.on("SIGINT",()=>{C.log.warn("Process interrupted. Terminating..."),s.abort(),oe.exit()});try{if(typeof e=="string"){const{stdout:a,stderr:c}=yield be(e,{maxBuffer:104857600,signal:s.signal});[a,c].forEach(p=>p&&t(p))}}catch(a){const{stdout:c,stderr:p,message:o}=a;[c,p].forEach(r=>r&&t(r)),!p&&!c&&C.log.error(`Command failed: ${o}`)}})}function V(e){return{raw:!0,cmd:e}}function ce(e,t){return t!=null&&t.isCurrentProject?`${J} ${P} ${Oe} ${e}`:`${J} ${fe} ${e}`}function w(e,t){return typeof e=="function"?ce(e(t),t):typeof e=="object"&&(e==null?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ce(e,t):e}function Qe(e){return I(this,null,function*(){const t=yield U({name:j});if(t.success){const n={isCurrentProject:t.result.isCurrentProject},s=typeof e=="function"?e(n):e;return Object.fromEntries(Object.entries(s).map(([a,c])=>[a,w(c,n)]))}})}function Q(e,t){return I(this,null,function*(){try{C.log.start(`${e}`),le.DEBUG&&C.log.info(`→ ${t}`),yield ze(t),C.log.success(`${e} done.`)}catch(n){C.catchError(n)}})}const Ze=X.getEnv(),Y=Ze.CWD,j="@cyberskill/shared",F="node_modules",Ce="dist",pe="public",W="package.json",Ie="package-lock.json",Te="tsconfig.json",ue=".gitignore",Ne=".simple-git-hooks.json",de="pnpm-lock.yaml",ge=".git/hooks/",ye=".git/COMMIT_EDITMSG",Pe=".migrate-mongo.config.js",G=(()=>{const t=Ye.readJsonSync(m.resolveWorkingPath(W)).name===j?Y:m.join(Y,F,j);return m.join(t,Ce)})(),fe="cyberskill",Oe="src/node/cli/index.ts",b="eslint",H="eslint",B="vitest",q="vitest",De="@commitlint/cli",Ge="@commitlint/config-conventional",Z="commitlint",Le="lint-staged",ee="lint-staged",Se="typescript",Ae="tsc",P="tsx",te="git",L="pnpm",J="pnpm exec",he="simple-git-hooks",Me="simple-git-hooks",ke="@eslint/config-inspector",$e="eslint-config-inspector",Ke="node-modules-inspector",Re="node-modules-inspector",K="migrate-mongo",R="./node_modules/migrate-mongo/bin/migrate-mongo",_={CYBERSKILL_DIRECTORY:G,WORKING_DIRECTORY:Y,PUBLIC_DIRECTORY:m.resolveWorkingPath(pe),TS_CONFIG:m.resolveWorkingPath(Te),GIT_IGNORE:m.resolveWorkingPath(ue),GIT_HOOK:m.resolveWorkingPath(ge),GIT_COMMIT_MSG:m.resolveWorkingPath(ye),SIMPLE_GIT_HOOKS_JSON:m.resolveWorkingPath(Ne),PACKAGE_JSON:m.resolveWorkingPath(W),PACKAGE_LOCK_JSON:m.resolveWorkingPath(Ie),PNPM_LOCK_YAML:m.resolveWorkingPath(de),NODE_MODULES:m.resolveWorkingPath(F),MIGRATE_MONGO_CONFIG:m.resolveWorkingPath(Pe),LINT_STAGED_CONFIG:m.resolveWorkingPath(`${G}/src/config/lint-staged/index.js`),COMMITLINT_CONFIG:m.resolveWorkingPath(`${G}/src/config/commitlint/index.js`),VITEST_UNIT_CONFIG:m.resolveWorkingPath(`${G}/src/config/vitest/vitest.unit.js`),VITEST_UNIT_SETUP_CONFIG:m.resolveWorkingPath(`${G}/src/config/vitest/vitest.unit.setup.js`),VITEST_E2E_CONFIG:m.resolveWorkingPath(`${G}/src/config/vitest/vitest.e2e.js`)};function et({isCurrentProject:e}){return ae({"pre-commit":ee,"commit-msg":Z},e&&{"pre-push":V(`${te} pull`)})}function l({type:e,packages:t,command:n}){const s=t==null?void 0:t.reduce((a,c)=>(a.some(p=>p.name===c.name)||a.push(c),a),[]);return()=>I(null,null,function*(){switch(e){case E.E_CommandType.CLI:return s!=null&&s.length&&(yield _e(s,{install:!0})),w(V(`${J} ${n}`));case E.E_CommandType.STRING:return w(V(n));default:throw new Error("Unsupported command type")}})}const k={simpleGitHooks:l({type:E.E_CommandType.CLI,packages:[{name:he,type:i.E_PackageType.DEV_DEPENDENCY}],command:Me}),eslintInspect:l({type:E.E_CommandType.CLI,packages:[{name:ke,type:i.E_PackageType.DEV_DEPENDENCY}],command:$e}),nodeModulesInspect:l({type:E.E_CommandType.CLI,packages:[{name:Ke,type:i.E_PackageType.DEV_DEPENDENCY}],command:Re}),eslintCheck:l({type:E.E_CommandType.CLI,packages:[{name:b,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${H} ${_.WORKING_DIRECTORY} --no-cache`}),eslintFix:l({type:E.E_CommandType.CLI,packages:[{name:b,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${H} ${_.WORKING_DIRECTORY} --fix --no-cache`}),typescriptCheck:l({type:E.E_CommandType.CLI,packages:[{name:Se,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${Ae} -p ${_.TS_CONFIG} --noEmit`}),testUnit:l({type:E.E_CommandType.CLI,packages:[{name:B,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${q} --config ${_.VITEST_UNIT_CONFIG}`}),testE2e:l({type:E.E_CommandType.CLI,packages:[{name:B,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${q} --config ${_.VITEST_E2E_CONFIG}`}),mongoMigrateCreate:e=>l({type:E.E_CommandType.CLI,packages:[{name:P,type:i.E_PackageType.DEPENDENCY},{name:K,type:i.E_PackageType.DEPENDENCY}],command:`${P} ${R} create ${e} -f ${_.MIGRATE_MONGO_CONFIG}`})(),mongoMigrateUp:l({type:E.E_CommandType.CLI,packages:[{name:P,type:i.E_PackageType.DEPENDENCY},{name:K,type:i.E_PackageType.DEPENDENCY}],command:`${P} ${R} up -f ${_.MIGRATE_MONGO_CONFIG}`}),mongoMigrateDown:l({type:E.E_CommandType.CLI,packages:[{name:P,type:i.E_PackageType.DEPENDENCY},{name:K,type:i.E_PackageType.DEPENDENCY}],command:`${P} ${R} down -f ${_.MIGRATE_MONGO_CONFIG}`}),commitLint:l({type:E.E_CommandType.CLI,packages:[{name:De,type:i.E_PackageType.DEV_DEPENDENCY},{name:Ge,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${Z} --edit ${_.GIT_COMMIT_MSG} --config ${_.COMMITLINT_CONFIG}`}),lintStaged:l({type:E.E_CommandType.CLI,packages:[{name:Le,type:i.E_PackageType.DEV_DEPENDENCY}],command:`${ee} --config ${_.LINT_STAGED_CONFIG}`}),configureGitHook:l({type:E.E_CommandType.STRING,command:`${te} config core.hooksPath ${_.GIT_HOOK}`}),build:l({type:E.E_CommandType.STRING,command:`${L} run --if-present build`}),pnpmInstallStandard:l({type:E.E_CommandType.STRING,command:`${L} install --ignore-scripts`}),pnpmInstallLegacy:l({type:E.E_CommandType.STRING,command:`${L} install --ignore-scripts --legacy-peer-deps`}),pnpmInstallForce:l({type:E.E_CommandType.STRING,command:`${L} install --ignore-scripts --force`}),pnpmPruneStore:l({type:E.E_CommandType.STRING,command:`${L} store prune`}),pnpmCleanCache:l({type:E.E_CommandType.STRING,command:`${L} cache delete`})};exports.BUILD_DIRECTORY=Ce;exports.COMMIT_LINT_CLI=Z;exports.COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME=Ge;exports.COMMIT_LINT_PACKAGE_NAME=De;exports.CYBERSKILL_CLI=fe;exports.CYBERSKILL_CLI_PATH=Oe;exports.CYBERSKILL_DIRECTORY=G;exports.CYBERSKILL_PACKAGE_NAME=j;exports.ESLINT_CLI=H;exports.ESLINT_INSPECT_CLI=$e;exports.ESLINT_INSPECT_PACKAGE_NAME=ke;exports.ESLINT_PACKAGE_NAME=b;exports.GIT_CLI=te;exports.GIT_COMMIT_EDITMSG=ye;exports.GIT_HOOK=ge;exports.GIT_IGNORE=ue;exports.LINT_STAGED_CLI=ee;exports.LINT_STAGED_PACKAGE_NAME=Le;exports.MIGRATE_MONGO_CLI=R;exports.MIGRATE_MONGO_CONFIG=Pe;exports.MIGRATE_MONGO_PACKAGE_NAME=K;exports.NODE_MODULES=F;exports.NODE_MODULES_INSPECT_CLI=Re;exports.NODE_MODULES_INSPECT_PACKAGE_NAME=Ke;exports.PACKAGE_JSON=W;exports.PACKAGE_LOCK_JSON=Ie;exports.PATH=_;exports.PNPM_CLI=L;exports.PNPM_EXEC_CLI=J;exports.PNPM_LOCK_YAML=de;exports.PUBLIC_DIRECTORY=pe;exports.SIMPLE_GIT_HOOKS_PACKAGE_NAME=he;exports.SIMPLE_GIT_HOOK_CLI=Me;exports.SIMPLE_GIT_HOOK_JSON=Ne;exports.TSCONFIG_JSON=Te;exports.TSC_CLI=Ae;exports.TSC_PACKAGE_NAME=Se;exports.TSX_CLI=P;exports.VITEST_CLI=q;exports.VITEST_PACKAGE_NAME=B;exports.WORKING_DIRECTORY=Y;exports.clearAllErrorLists=Be;exports.command=k;exports.createGitHooksConfig=et;exports.formatCommand=w;exports.getLatestPackageVersion=ie;exports.getPackage=U;exports.getStoredErrorLists=He;exports.installDependencies=Ee;exports.rawCommand=V;exports.resolveCommands=Qe;exports.runCommand=Q;exports.setupPackages=_e;exports.updatePackage=x;
|
|
@@ -420,11 +420,11 @@ const Ae = b(), k = Ae.CWD, F = "@cyberskill/shared", W = "node_modules", $e = "
|
|
|
420
420
|
PNPM_LOCK_YAML: u(Ke),
|
|
421
421
|
NODE_MODULES: u(W),
|
|
422
422
|
MIGRATE_MONGO_CONFIG: u(je),
|
|
423
|
-
LINT_STAGED_CONFIG: u(`${S}/config/lint-staged/index.js`),
|
|
424
|
-
COMMITLINT_CONFIG: u(`${S}/config/commitlint/index.js`),
|
|
425
|
-
VITEST_UNIT_CONFIG: u(`${S}/config/vitest/vitest.unit.js`),
|
|
426
|
-
VITEST_UNIT_SETUP_CONFIG: u(`${S}/config/vitest/vitest.unit.setup.js`),
|
|
427
|
-
VITEST_E2E_CONFIG: u(`${S}/config/vitest/vitest.e2e.js`)
|
|
423
|
+
LINT_STAGED_CONFIG: u(`${S}/src/config/lint-staged/index.js`),
|
|
424
|
+
COMMITLINT_CONFIG: u(`${S}/src/config/commitlint/index.js`),
|
|
425
|
+
VITEST_UNIT_CONFIG: u(`${S}/src/config/vitest/vitest.unit.js`),
|
|
426
|
+
VITEST_UNIT_SETUP_CONFIG: u(`${S}/src/config/vitest/vitest.unit.setup.js`),
|
|
427
|
+
VITEST_E2E_CONFIG: u(`${S}/src/config/vitest/vitest.e2e.js`)
|
|
428
428
|
};
|
|
429
429
|
function ft({ isCurrentProject: e }) {
|
|
430
430
|
return q({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var n=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;var r=(i,e,t)=>e in i?o(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,s=(i,e)=>{for(var t in e||(e={}))u.call(e,t)&&r(i,t,e[t]);if(n)for(var t of n(e))c.call(e,t)&&r(i,t,e[t]);return i};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@vitejs/plugin-react-swc"),a=require("../../../config-DDQ9k8fw.cjs"),g=require("../../../path.constant-
|
|
1
|
+
"use strict";var o=Object.defineProperty;var n=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;var r=(i,e,t)=>e in i?o(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,s=(i,e)=>{for(var t in e||(e={}))u.call(e,t)&&r(i,t,e[t]);if(n)for(var t of n(e))c.call(e,t)&&r(i,t,e[t]);return i};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@vitejs/plugin-react-swc"),a=require("../../../config-DDQ9k8fw.cjs"),g=require("../../../path.constant-CPGOAxEp.cjs");require("../../node/path/path.util.cjs");function d(i){return a.defineConfig(s({plugins:[l()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[g.PATH.VITEST_UNIT_SETUP_CONFIG]}},i))}exports.vitestUnit=d;
|
|
@@ -11,7 +11,7 @@ var r = (o, t, e) => t in o ? s(o, t, { enumerable: !0, configurable: !0, writab
|
|
|
11
11
|
};
|
|
12
12
|
import u from "@vitejs/plugin-react-swc";
|
|
13
13
|
import { d as f } from "../../../config-B7WSlzSh.js";
|
|
14
|
-
import { F as l } from "../../../path.constant-
|
|
14
|
+
import { F as l } from "../../../path.constant-DJq0jtD0.js";
|
|
15
15
|
import "../../node/path/path.util.js";
|
|
16
16
|
function v(o) {
|
|
17
17
|
return f(n({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var s=(t,i,n)=>new Promise((a,g)=>{var w=o=>{try{l(n.next(o))}catch(p){g(p)}},h=o=>{try{l(n.throw(o))}catch(p){g(p)}},l=o=>o.done?a(o.value):Promise.resolve(o.value).then(w,h);l((n=n.apply(t,i)).next())});const m=require("node:process"),q=require("yargs/helpers"),k=require("yargs/yargs"),e=require("../../../path.constant-BT9ilH7U.cjs"),r=require("../fs/fs.util.cjs"),u=require("../log/log.type.cjs"),c=require("../log/log.util.cjs");require("../path/path.util.cjs");const C="@cyberskill/shared",v="module",E="1.201.0",_="CyberSkill Shared",S="Stephen Cheng",b="MIT",I="https://github.com/cyberskill-world/shared#readme",L={type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},T={url:"https://github.com/cyberskill-world/shared/issues"},M={"./config":{types:"./dist/src/config/index.d.ts",import:"./dist/src/config/index.js",require:"./dist/src/config/index.cjs"},"./config/commitlint":{types:"./dist/src/config/commitlint/index.d.ts",import:"./dist/src/config/commitlint/index.js",require:"./dist/src/config/commitlint/index.cjs"},"./config/env":{types:"./dist/src/config/env/index.d.ts",import:"./dist/src/config/env/index.js",require:"./dist/src/config/env/index.cjs"},"./config/eslint":{types:"./dist/src/config/eslint/index.d.ts",import:"./dist/src/config/eslint/index.js",require:"./dist/src/config/eslint/index.cjs"},"./config/graphql-codegen":{types:"./dist/src/config/graphql-codegen/index.d.ts",import:"./dist/src/config/graphql-codegen/index.js",require:"./dist/src/config/graphql-codegen/index.cjs"},"./config/lint-staged":{types:"./dist/src/config/lint-staged/index.d.ts",import:"./dist/src/config/lint-staged/index.js",require:"./dist/src/config/lint-staged/index.cjs"},"./config/vitest":{types:"./dist/src/config/vitest/index.d.ts",import:"./dist/src/config/vitest/index.js",require:"./dist/src/config/vitest/index.cjs"},"./constant":{types:"./dist/src/constant/index.d.ts",import:"./dist/src/constant/index.js",require:"./dist/src/constant/index.cjs"},"./node/apollo-server":{types:"./dist/src/node/apollo-server/index.d.ts",import:"./dist/src/node/apollo-server/index.js",require:"./dist/src/node/apollo-server/index.cjs"},"./node/cli":{types:"./dist/src/node/cli/index.d.ts",import:"./dist/src/node/cli/index.js",require:"./dist/src/node/cli/index.cjs"},"./node/command":{types:"./dist/src/node/command/index.d.ts",import:"./dist/src/node/command/index.js",require:"./dist/src/node/command/index.cjs"},"./node/express":{types:"./dist/src/node/express/index.d.ts",import:"./dist/src/node/express/index.js",require:"./dist/src/node/express/index.cjs"},"./node/fs":{types:"./dist/src/node/fs/index.d.ts",import:"./dist/src/node/fs/index.js",require:"./dist/src/node/fs/index.cjs"},"./node/log":{types:"./dist/src/node/log/index.d.ts",import:"./dist/src/node/log/index.js",require:"./dist/src/node/log/index.cjs"},"./node/mongo":{types:"./dist/src/node/mongo/index.d.ts",import:"./dist/src/node/mongo/index.js",require:"./dist/src/node/mongo/index.cjs"},"./node/package":{types:"./dist/src/node/package/index.d.ts",import:"./dist/src/node/package/index.js",require:"./dist/src/node/package/index.cjs"},"./node/path":{types:"./dist/src/node/path/index.d.ts",import:"./dist/src/node/path/index.js",require:"./dist/src/node/path/index.cjs"},"./node/storage":{types:"./dist/src/node/storage/index.d.ts",import:"./dist/src/node/storage/index.js",require:"./dist/src/node/storage/index.cjs"},"./node/upload":{types:"./dist/src/node/upload/index.d.ts",import:"./dist/src/node/upload/index.js",require:"./dist/src/node/upload/index.cjs"},"./node/ws":{types:"./dist/src/node/ws/index.d.ts",import:"./dist/src/node/ws/index.js",require:"./dist/src/node/ws/index.cjs"},"./react/apollo-client":{types:"./dist/src/react/apollo-client/index.d.ts",import:"./dist/src/react/apollo-client/index.js",require:"./dist/src/react/apollo-client/index.cjs"},"./react/apollo-client-nextjs":{types:"./dist/src/react/apollo-client-nextjs/index.d.ts",import:"./dist/src/react/apollo-client-nextjs/index.js",require:"./dist/src/react/apollo-client-nextjs/index.cjs"},"./react/apollo-client-nextjs/rsc":{types:"./dist/src/react/apollo-client-nextjs/apollo-client-nextjs-rsc.d.ts",import:"./dist/src/react/apollo-client-nextjs/apollo-client-nextjs-rsc.js",require:"./dist/src/react/apollo-client-nextjs/apollo-client-nextjs-rsc.cjs"},"./react/apollo-error":{types:"./dist/src/react/apollo-error/index.d.ts",import:"./dist/src/react/apollo-error/index.js",require:"./dist/src/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/src/react/i18next/index.d.ts",import:"./dist/src/react/i18next/index.js",require:"./dist/src/react/i18next/index.cjs"},"./react/loading":{types:"./dist/src/react/loading/index.d.ts",import:"./dist/src/react/loading/index.js",require:"./dist/src/react/loading/index.cjs"},"./react/log":{types:"./dist/src/react/log/index.d.ts",import:"./dist/src/react/log/index.js",require:"./dist/src/react/log/index.cjs"},"./react/next-intl":{types:"./dist/src/react/next-intl/index.d.ts",import:"./dist/src/react/next-intl/index.js",require:"./dist/src/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/src/react/storage/index.d.ts",import:"./dist/src/react/storage/index.js",require:"./dist/src/react/storage/index.cjs"},"./react/toast":{types:"./dist/src/react/toast/index.d.ts",import:"./dist/src/react/toast/index.js",require:"./dist/src/react/toast/index.cjs"},"./react/userback":{types:"./dist/src/react/userback/index.d.ts",import:"./dist/src/react/userback/index.js",require:"./dist/src/react/userback/index.cjs"},"./typescript":{types:"./dist/src/typescript/index.d.ts",import:"./dist/src/typescript/index.js",require:"./dist/src/typescript/index.cjs"},"./util":{types:"./dist/src/util/index.d.ts",import:"./dist/src/util/index.js",require:"./dist/src/util/index.cjs"},"./style.css":{import:"./dist/style.css",require:"./dist/style.css"}},P={cyberskill:"dist/src/node/cli/index.js"},A=["dist","public"],O={build:"vite build",commitlint:"tsx src/node/cli/index.ts commitlint",dev:"vite build --watch",inspect:"tsx src/node/cli/index.ts inspect",lint:"tsx src/node/cli/index.ts lint","lint:fix":"tsx src/node/cli/index.ts lint:fix","lint:inspect":"tsx src/node/cli/index.ts lint:inspect",ready:"tsx src/node/cli/index.ts ready",reset:"tsx src/node/cli/index.ts reset","test:e2e":"tsx src/node/cli/index.ts test:e2e","test:unit":"tsx src/node/cli/index.ts test:unit"},G={"@antfu/eslint-config":"4.16.1","@apollo/client":"3.13.8","@apollo/client-integration-nextjs":"0.12.2","@apollo/server":"4.12.2","@dotenvx/dotenvx":"1.45.1","@eddeee888/gcg-typescript-resolver-files":"0.12.1","@graphql-codegen/cli":"5.0.7","@graphql-codegen/client-preset":"4.8.3","@nestjs/common":"11.1.3","@nestjs/core":"11.1.3","@userback/widget":"0.3.11","@vitejs/plugin-react-swc":"3.10.2","body-parser":"2.2.0",chalk:"5.4.1",clsx:"2.1.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",envalid:"8.0.0",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.2.0",graphql:"16.11.0","graphql-ws":"6.0.5",i18next:"25.3.0",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3",mongodb:"6.17.0",mongoose:"8.16.1","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.1","next-intl":"4.3.1","node-fetch":"3.3.2","node-persist":"4.0.4",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.3",slugify:"1.6.6",unorm:"1.6.0",uuid:"11.1.0",vite:"7.0.0",ws:"8.18.3",yargs:"18.0.0"},R={"@commitlint/cli":"19.8.1","@commitlint/config-conventional":"19.8.1","@eslint-react/eslint-plugin":"1.52.2","@eslint/config-inspector":"1.1.0","@microsoft/api-extractor":"7.52.8","@next/eslint-plugin-next":"15.3.4","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@types/body-parser":"1.19.6","@types/compression":"1.8.1","@types/cookie-parser":"1.4.9","@types/cors":"2.8.19","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.2","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/node":"24.0.7","@types/node-persist":"3.1.8","@types/react":"19.1.8","@types/react-dom":"19.1.6","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33","@vitest/browser":"3.2.4",eslint:"9.30.0","eslint-config-next":"15.3.4","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",glob:"11.0.3","lint-staged":"16.1.2","node-modules-inspector":"1.0.0",sass:"1.89.2","simple-git-hooks":"2.13.0",tsx:"4.20.3",typescript:"5.8.3",vite:"7.0.0","vite-plugin-dts":"4.5.4",vitest:"3.2.4"},H={access:"public",registry:"https://registry.npmjs.org/"},N={name:C,type:v,version:E,description:_,author:S,license:b,homepage:I,repository:L,bugs:T,exports:M,bin:P,files:A,scripts:O,dependencies:G,devDependencies:R,publishConfig:H};function y(){return s(this,null,function*(){r.pathExistsSync(e.PATH.TS_CONFIG)?yield e.runCommand("Performing TypeScript validation",yield e.command.typescriptCheck()):c.log.warn("No TypeScript configuration found. Skipping type check.")})}function f(t=!1){return s(this,null,function*(){t?yield e.runCommand("Running ESLint with auto-fix",yield e.command.eslintFix()):yield e.runCommand("Running ESLint check",yield e.command.eslintCheck())})}function x(t,i){if(!i.length)return;const n=t==="Errors"?"red":"yellow";c.log.printBoxedLog(t==="Errors"?"✖ Errors":"⚠ Warnings",i,n)}function d(){return s(this,null,function*(){setTimeout(()=>s(null,null,function*(){const t=yield e.getStoredErrorLists(),i=t.filter(a=>a.type===u.E_IssueType.Error),n=t.filter(a=>a.type===u.E_IssueType.Warning);!i.length&&!n.length?c.log.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(x("Warnings",n),x("Errors",i),(i.length>0||n.length>0)&&m.exit(1))}),0)})}function D(){return s(this,null,function*(){yield e.clearAllErrorLists();const t=yield e.getPackage({name:e.CYBERSKILL_PACKAGE_NAME});if(!t.success){c.log.error("Failed to retrieve package information. Aborting lint-staged.");return}t.result.isCurrentProject&&(yield e.runCommand(`Building package: ${e.CYBERSKILL_PACKAGE_NAME}`,yield e.command.build())),yield e.runCommand("Executing lint-staged",yield e.command.lintStaged()),d()})}function B(){return s(this,null,function*(){yield e.runCommand("Inspecting ESLint configuration",yield e.command.eslintInspect())})}function F(){return s(this,null,function*(){yield e.clearAllErrorLists(),yield Promise.all([y(),f()]),d()})}function K(){return s(this,null,function*(){yield e.clearAllErrorLists(),yield Promise.all([y(),f(!0)]),d()})}function U(){return s(this,null,function*(){yield e.clearAllErrorLists(),yield e.runCommand("Validating commit message",yield e.command.commitLint()),d()})}function j(){return s(this,null,function*(){yield e.runCommand("Configuring Git hooks",yield e.command.configureGitHook()),r.removeSync(e.PATH.GIT_HOOK);const t=yield e.resolveCommands(e.createGitHooksConfig);r.writeFileSync(e.PATH.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));const i=`
|
|
2
|
+
"use strict";var s=(t,i,n)=>new Promise((a,g)=>{var w=o=>{try{l(n.next(o))}catch(p){g(p)}},h=o=>{try{l(n.throw(o))}catch(p){g(p)}},l=o=>o.done?a(o.value):Promise.resolve(o.value).then(w,h);l((n=n.apply(t,i)).next())});const m=require("node:process"),q=require("yargs/helpers"),k=require("yargs/yargs"),e=require("../../../path.constant-CPGOAxEp.cjs"),r=require("../fs/fs.util.cjs"),u=require("../log/log.type.cjs"),c=require("../log/log.util.cjs");require("../path/path.util.cjs");const C="@cyberskill/shared",v="module",E="1.202.0",_="CyberSkill Shared",S="Stephen Cheng",b="MIT",I="https://github.com/cyberskill-world/shared#readme",L={type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},T={url:"https://github.com/cyberskill-world/shared/issues"},M={"./config":{types:"./dist/src/config/index.d.ts",import:"./dist/src/config/index.js",require:"./dist/src/config/index.cjs"},"./config/commitlint":{types:"./dist/src/config/commitlint/index.d.ts",import:"./dist/src/config/commitlint/index.js",require:"./dist/src/config/commitlint/index.cjs"},"./config/env":{types:"./dist/src/config/env/index.d.ts",import:"./dist/src/config/env/index.js",require:"./dist/src/config/env/index.cjs"},"./config/eslint":{types:"./dist/src/config/eslint/index.d.ts",import:"./dist/src/config/eslint/index.js",require:"./dist/src/config/eslint/index.cjs"},"./config/graphql-codegen":{types:"./dist/src/config/graphql-codegen/index.d.ts",import:"./dist/src/config/graphql-codegen/index.js",require:"./dist/src/config/graphql-codegen/index.cjs"},"./config/lint-staged":{types:"./dist/src/config/lint-staged/index.d.ts",import:"./dist/src/config/lint-staged/index.js",require:"./dist/src/config/lint-staged/index.cjs"},"./config/vitest":{types:"./dist/src/config/vitest/index.d.ts",import:"./dist/src/config/vitest/index.js",require:"./dist/src/config/vitest/index.cjs"},"./constant":{types:"./dist/src/constant/index.d.ts",import:"./dist/src/constant/index.js",require:"./dist/src/constant/index.cjs"},"./node/apollo-server":{types:"./dist/src/node/apollo-server/index.d.ts",import:"./dist/src/node/apollo-server/index.js",require:"./dist/src/node/apollo-server/index.cjs"},"./node/cli":{types:"./dist/src/node/cli/index.d.ts",import:"./dist/src/node/cli/index.js",require:"./dist/src/node/cli/index.cjs"},"./node/command":{types:"./dist/src/node/command/index.d.ts",import:"./dist/src/node/command/index.js",require:"./dist/src/node/command/index.cjs"},"./node/express":{types:"./dist/src/node/express/index.d.ts",import:"./dist/src/node/express/index.js",require:"./dist/src/node/express/index.cjs"},"./node/fs":{types:"./dist/src/node/fs/index.d.ts",import:"./dist/src/node/fs/index.js",require:"./dist/src/node/fs/index.cjs"},"./node/log":{types:"./dist/src/node/log/index.d.ts",import:"./dist/src/node/log/index.js",require:"./dist/src/node/log/index.cjs"},"./node/mongo":{types:"./dist/src/node/mongo/index.d.ts",import:"./dist/src/node/mongo/index.js",require:"./dist/src/node/mongo/index.cjs"},"./node/package":{types:"./dist/src/node/package/index.d.ts",import:"./dist/src/node/package/index.js",require:"./dist/src/node/package/index.cjs"},"./node/path":{types:"./dist/src/node/path/index.d.ts",import:"./dist/src/node/path/index.js",require:"./dist/src/node/path/index.cjs"},"./node/storage":{types:"./dist/src/node/storage/index.d.ts",import:"./dist/src/node/storage/index.js",require:"./dist/src/node/storage/index.cjs"},"./node/upload":{types:"./dist/src/node/upload/index.d.ts",import:"./dist/src/node/upload/index.js",require:"./dist/src/node/upload/index.cjs"},"./node/ws":{types:"./dist/src/node/ws/index.d.ts",import:"./dist/src/node/ws/index.js",require:"./dist/src/node/ws/index.cjs"},"./react/apollo-client":{types:"./dist/src/react/apollo-client/index.d.ts",import:"./dist/src/react/apollo-client/index.js",require:"./dist/src/react/apollo-client/index.cjs"},"./react/apollo-client-nextjs":{types:"./dist/src/react/apollo-client-nextjs/index.d.ts",import:"./dist/src/react/apollo-client-nextjs/index.js",require:"./dist/src/react/apollo-client-nextjs/index.cjs"},"./react/apollo-client-nextjs/rsc":{types:"./dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts",import:"./dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js",require:"./dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs"},"./react/apollo-error":{types:"./dist/src/react/apollo-error/index.d.ts",import:"./dist/src/react/apollo-error/index.js",require:"./dist/src/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/src/react/i18next/index.d.ts",import:"./dist/src/react/i18next/index.js",require:"./dist/src/react/i18next/index.cjs"},"./react/loading":{types:"./dist/src/react/loading/index.d.ts",import:"./dist/src/react/loading/index.js",require:"./dist/src/react/loading/index.cjs"},"./react/log":{types:"./dist/src/react/log/index.d.ts",import:"./dist/src/react/log/index.js",require:"./dist/src/react/log/index.cjs"},"./react/next-intl":{types:"./dist/src/react/next-intl/index.d.ts",import:"./dist/src/react/next-intl/index.js",require:"./dist/src/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/src/react/storage/index.d.ts",import:"./dist/src/react/storage/index.js",require:"./dist/src/react/storage/index.cjs"},"./react/toast":{types:"./dist/src/react/toast/index.d.ts",import:"./dist/src/react/toast/index.js",require:"./dist/src/react/toast/index.cjs"},"./react/userback":{types:"./dist/src/react/userback/index.d.ts",import:"./dist/src/react/userback/index.js",require:"./dist/src/react/userback/index.cjs"},"./typescript":{types:"./dist/src/typescript/index.d.ts",import:"./dist/src/typescript/index.js",require:"./dist/src/typescript/index.cjs"},"./util":{types:"./dist/src/util/index.d.ts",import:"./dist/src/util/index.js",require:"./dist/src/util/index.cjs"},"./style.css":{import:"./dist/style.css",require:"./dist/style.css"}},P={cyberskill:"dist/src/node/cli/index.js"},A=["dist","public"],O={build:"vite build",commitlint:"tsx src/node/cli/index.ts commitlint",dev:"vite build --watch",inspect:"tsx src/node/cli/index.ts inspect",lint:"tsx src/node/cli/index.ts lint","lint:fix":"tsx src/node/cli/index.ts lint:fix","lint:inspect":"tsx src/node/cli/index.ts lint:inspect",ready:"tsx src/node/cli/index.ts ready",reset:"tsx src/node/cli/index.ts reset","test:e2e":"tsx src/node/cli/index.ts test:e2e","test:unit":"tsx src/node/cli/index.ts test:unit"},G={"@antfu/eslint-config":"4.16.1","@apollo/client":"3.13.8","@apollo/client-integration-nextjs":"0.12.2","@apollo/server":"4.12.2","@dotenvx/dotenvx":"1.45.1","@eddeee888/gcg-typescript-resolver-files":"0.12.1","@graphql-codegen/cli":"5.0.7","@graphql-codegen/client-preset":"4.8.3","@nestjs/common":"11.1.3","@nestjs/core":"11.1.3","@userback/widget":"0.3.11","@vitejs/plugin-react-swc":"3.10.2","body-parser":"2.2.0",chalk:"5.4.1",clsx:"2.1.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",envalid:"8.0.0",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.2.0",graphql:"16.11.0","graphql-upload":"17.0.0","graphql-ws":"6.0.5",i18next:"25.3.0",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3",mongodb:"6.17.0",mongoose:"8.16.1","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.1","next-intl":"4.3.1","node-fetch":"3.3.2","node-persist":"4.0.4",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.3",slugify:"1.6.6",unorm:"1.6.0",uuid:"11.1.0",vite:"7.0.0",ws:"8.18.3",yargs:"18.0.0"},R={"@commitlint/cli":"19.8.1","@commitlint/config-conventional":"19.8.1","@eslint-react/eslint-plugin":"1.52.2","@eslint/config-inspector":"1.1.0","@microsoft/api-extractor":"7.52.8","@next/eslint-plugin-next":"15.3.4","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@types/body-parser":"1.19.6","@types/compression":"1.8.1","@types/cookie-parser":"1.4.9","@types/cors":"2.8.19","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.2","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/graphql-upload":"17.0.0","@types/migrate-mongo":"10.0.5","@types/node":"24.0.7","@types/node-persist":"3.1.8","@types/react":"19.1.8","@types/react-dom":"19.1.6","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33","@vitest/browser":"3.2.4",eslint:"9.30.0","eslint-config-next":"15.3.4","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",glob:"11.0.3","lint-staged":"16.1.2","node-modules-inspector":"1.0.0",sass:"1.89.2","simple-git-hooks":"2.13.0",tsx:"4.20.3",typescript:"5.8.3",vite:"7.0.0","vite-plugin-dts":"4.5.4",vitest:"3.2.4"},H={access:"public",registry:"https://registry.npmjs.org/"},N={name:C,type:v,version:E,description:_,author:S,license:b,homepage:I,repository:L,bugs:T,exports:M,bin:P,files:A,scripts:O,dependencies:G,devDependencies:R,publishConfig:H};function y(){return s(this,null,function*(){r.pathExistsSync(e.PATH.TS_CONFIG)?yield e.runCommand("Performing TypeScript validation",yield e.command.typescriptCheck()):c.log.warn("No TypeScript configuration found. Skipping type check.")})}function f(t=!1){return s(this,null,function*(){t?yield e.runCommand("Running ESLint with auto-fix",yield e.command.eslintFix()):yield e.runCommand("Running ESLint check",yield e.command.eslintCheck())})}function x(t,i){if(!i.length)return;const n=t==="Errors"?"red":"yellow";c.log.printBoxedLog(t==="Errors"?"✖ Errors":"⚠ Warnings",i,n)}function d(){return s(this,null,function*(){setTimeout(()=>s(null,null,function*(){const t=yield e.getStoredErrorLists(),i=t.filter(a=>a.type===u.E_IssueType.Error),n=t.filter(a=>a.type===u.E_IssueType.Warning);!i.length&&!n.length?c.log.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(x("Warnings",n),x("Errors",i),(i.length>0||n.length>0)&&m.exit(1))}),0)})}function D(){return s(this,null,function*(){yield e.clearAllErrorLists();const t=yield e.getPackage({name:e.CYBERSKILL_PACKAGE_NAME});if(!t.success){c.log.error("Failed to retrieve package information. Aborting lint-staged.");return}t.result.isCurrentProject&&(yield e.runCommand(`Building package: ${e.CYBERSKILL_PACKAGE_NAME}`,yield e.command.build())),yield e.runCommand("Executing lint-staged",yield e.command.lintStaged()),d()})}function B(){return s(this,null,function*(){yield e.runCommand("Inspecting ESLint configuration",yield e.command.eslintInspect())})}function F(){return s(this,null,function*(){yield e.clearAllErrorLists(),yield Promise.all([y(),f()]),d()})}function K(){return s(this,null,function*(){yield e.clearAllErrorLists(),yield Promise.all([y(),f(!0)]),d()})}function U(){return s(this,null,function*(){yield e.clearAllErrorLists(),yield e.runCommand("Validating commit message",yield e.command.commitLint()),d()})}function j(){return s(this,null,function*(){yield e.runCommand("Configuring Git hooks",yield e.command.configureGitHook()),r.removeSync(e.PATH.GIT_HOOK);const t=yield e.resolveCommands(e.createGitHooksConfig);r.writeFileSync(e.PATH.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));const i=`
|
|
3
3
|
${e.SIMPLE_GIT_HOOK_JSON}
|
|
4
4
|
`;r.pathExistsSync(e.PATH.GIT_IGNORE)?r.readFileSync(e.PATH.GIT_IGNORE,"utf-8").split(`
|
|
5
5
|
`).includes(e.SIMPLE_GIT_HOOK_JSON)||r.appendFileSync(e.PATH.GIT_IGNORE,i):r.writeFileSync(e.PATH.GIT_IGNORE,i),yield e.runCommand("Setting up simple-git-hooks",yield e.command.simpleGitHooks())})}function J(){return s(this,null,function*(){yield e.installDependencies(),yield j()})}function Y(){return s(this,null,function*(){r.removeSync(e.PATH.NODE_MODULES,e.PATH.PNPM_LOCK_YAML),yield e.runCommand("Pruning pnpm store",yield e.command.pnpmPruneStore()),yield e.runCommand("Clearing pnpm cache",yield e.command.pnpmCleanCache()),yield e.installDependencies(),yield j()})}function $(){return s(this,null,function*(){yield e.runCommand("Inspecting project dependencies",yield e.command.nodeModulesInspect())})}function V(){return s(this,null,function*(){yield e.runCommand("Running unit tests",yield e.command.testUnit())})}function W(){return s(this,null,function*(){yield e.runCommand("Running end-to-end tests",yield e.command.testE2e())})}function z(t){return s(this,null,function*(){yield e.runCommand("Creating MongoDB migration",yield e.command.mongoMigrateCreate(t))})}function Q(){return s(this,null,function*(){yield e.runCommand("Running MongoDB migrations",yield e.command.mongoMigrateUp())})}function X(){return s(this,null,function*(){yield e.runCommand("Rolling back MongoDB migration",yield e.command.mongoMigrateDown())})}s(null,null,function*(){try{yield k(q.hideBin(m.argv)).scriptName(e.CYBERSKILL_CLI).usage("$0 <command> [options]").command("lint","Check code for linting issues",F).command("lint:fix","Fix linting issues automatically",K).command("lint:inspect","View active ESLint configuration",B).command("lint-staged","Run lint checks on staged files",D).command("commitlint","Validate commit message format",U).command("ready","Initialize project and dependencies",J).command("reset","Reset the project and reinstall dependencies",Y).command("inspect","Analyze installed project dependencies",$).command("test:unit","Run unit test suite",V).command("test:e2e","Run end-to-end test suite",W).command("mongo:migrate:create <name>","Create a MongoDB migration",t=>t.positional("name",{describe:"Migration name",type:"string"}),t=>s(null,null,function*(){if(!t.name){c.log.error("Migration name is required.");return}yield z(t.name)})).command("mongo:migrate:up","Apply all MongoDB migrations",Q).command("mongo:migrate:down","Rollback last MongoDB migration",X).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(N.version).epilog(`💡 Tip: Use "--help" with any command to see options
|
|
@@ -19,13 +19,13 @@ var t = (e, n, r) => new Promise((a, y) => {
|
|
|
19
19
|
import x from "node:process";
|
|
20
20
|
import { hideBin as _ } from "yargs/helpers";
|
|
21
21
|
import O from "yargs/yargs";
|
|
22
|
-
import { g as R, X as l, $ as s, I as i, K as G, C as f, Q as
|
|
22
|
+
import { g as R, X as l, $ as s, I as i, K as G, C as f, Q as k, F as o, U as T, _ as N, S as j, H as D } from "../../../path.constant-DJq0jtD0.js";
|
|
23
23
|
import { removeSync as v, pathExistsSync as b, writeFileSync as w, readFileSync as P, appendFileSync as B } from "../fs/fs.util.js";
|
|
24
24
|
import { E_IssueType as h } from "../log/log.type.js";
|
|
25
25
|
import { log as d, catchError as F } from "../log/log.util.js";
|
|
26
26
|
import "../path/path.util.js";
|
|
27
27
|
var fe = L((u) => {
|
|
28
|
-
const A = "@cyberskill/shared", H = "module", U = "1.
|
|
28
|
+
const A = "@cyberskill/shared", H = "module", U = "1.202.0", K = "CyberSkill Shared", $ = "Stephen Cheng", J = "MIT", V = "https://github.com/cyberskill-world/shared#readme", W = { type: "git", url: "git+https://github.com/cyberskill-world/shared.git" }, Y = { url: "https://github.com/cyberskill-world/shared/issues" }, z = { "./config": { types: "./dist/src/config/index.d.ts", import: "./dist/src/config/index.js", require: "./dist/src/config/index.cjs" }, "./config/commitlint": { types: "./dist/src/config/commitlint/index.d.ts", import: "./dist/src/config/commitlint/index.js", require: "./dist/src/config/commitlint/index.cjs" }, "./config/env": { types: "./dist/src/config/env/index.d.ts", import: "./dist/src/config/env/index.js", require: "./dist/src/config/env/index.cjs" }, "./config/eslint": { types: "./dist/src/config/eslint/index.d.ts", import: "./dist/src/config/eslint/index.js", require: "./dist/src/config/eslint/index.cjs" }, "./config/graphql-codegen": { types: "./dist/src/config/graphql-codegen/index.d.ts", import: "./dist/src/config/graphql-codegen/index.js", require: "./dist/src/config/graphql-codegen/index.cjs" }, "./config/lint-staged": { types: "./dist/src/config/lint-staged/index.d.ts", import: "./dist/src/config/lint-staged/index.js", require: "./dist/src/config/lint-staged/index.cjs" }, "./config/vitest": { types: "./dist/src/config/vitest/index.d.ts", import: "./dist/src/config/vitest/index.js", require: "./dist/src/config/vitest/index.cjs" }, "./constant": { types: "./dist/src/constant/index.d.ts", import: "./dist/src/constant/index.js", require: "./dist/src/constant/index.cjs" }, "./node/apollo-server": { types: "./dist/src/node/apollo-server/index.d.ts", import: "./dist/src/node/apollo-server/index.js", require: "./dist/src/node/apollo-server/index.cjs" }, "./node/cli": { types: "./dist/src/node/cli/index.d.ts", import: "./dist/src/node/cli/index.js", require: "./dist/src/node/cli/index.cjs" }, "./node/command": { types: "./dist/src/node/command/index.d.ts", import: "./dist/src/node/command/index.js", require: "./dist/src/node/command/index.cjs" }, "./node/express": { types: "./dist/src/node/express/index.d.ts", import: "./dist/src/node/express/index.js", require: "./dist/src/node/express/index.cjs" }, "./node/fs": { types: "./dist/src/node/fs/index.d.ts", import: "./dist/src/node/fs/index.js", require: "./dist/src/node/fs/index.cjs" }, "./node/log": { types: "./dist/src/node/log/index.d.ts", import: "./dist/src/node/log/index.js", require: "./dist/src/node/log/index.cjs" }, "./node/mongo": { types: "./dist/src/node/mongo/index.d.ts", import: "./dist/src/node/mongo/index.js", require: "./dist/src/node/mongo/index.cjs" }, "./node/package": { types: "./dist/src/node/package/index.d.ts", import: "./dist/src/node/package/index.js", require: "./dist/src/node/package/index.cjs" }, "./node/path": { types: "./dist/src/node/path/index.d.ts", import: "./dist/src/node/path/index.js", require: "./dist/src/node/path/index.cjs" }, "./node/storage": { types: "./dist/src/node/storage/index.d.ts", import: "./dist/src/node/storage/index.js", require: "./dist/src/node/storage/index.cjs" }, "./node/upload": { types: "./dist/src/node/upload/index.d.ts", import: "./dist/src/node/upload/index.js", require: "./dist/src/node/upload/index.cjs" }, "./node/ws": { types: "./dist/src/node/ws/index.d.ts", import: "./dist/src/node/ws/index.js", require: "./dist/src/node/ws/index.cjs" }, "./react/apollo-client": { types: "./dist/src/react/apollo-client/index.d.ts", import: "./dist/src/react/apollo-client/index.js", require: "./dist/src/react/apollo-client/index.cjs" }, "./react/apollo-client-nextjs": { types: "./dist/src/react/apollo-client-nextjs/index.d.ts", import: "./dist/src/react/apollo-client-nextjs/index.js", require: "./dist/src/react/apollo-client-nextjs/index.cjs" }, "./react/apollo-client-nextjs/rsc": { types: "./dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts", import: "./dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js", require: "./dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs" }, "./react/apollo-error": { types: "./dist/src/react/apollo-error/index.d.ts", import: "./dist/src/react/apollo-error/index.js", require: "./dist/src/react/apollo-error/index.cjs" }, "./react/i18next": { types: "./dist/src/react/i18next/index.d.ts", import: "./dist/src/react/i18next/index.js", require: "./dist/src/react/i18next/index.cjs" }, "./react/loading": { types: "./dist/src/react/loading/index.d.ts", import: "./dist/src/react/loading/index.js", require: "./dist/src/react/loading/index.cjs" }, "./react/log": { types: "./dist/src/react/log/index.d.ts", import: "./dist/src/react/log/index.js", require: "./dist/src/react/log/index.cjs" }, "./react/next-intl": { types: "./dist/src/react/next-intl/index.d.ts", import: "./dist/src/react/next-intl/index.js", require: "./dist/src/react/next-intl/index.cjs" }, "./react/storage": { types: "./dist/src/react/storage/index.d.ts", import: "./dist/src/react/storage/index.js", require: "./dist/src/react/storage/index.cjs" }, "./react/toast": { types: "./dist/src/react/toast/index.d.ts", import: "./dist/src/react/toast/index.js", require: "./dist/src/react/toast/index.cjs" }, "./react/userback": { types: "./dist/src/react/userback/index.d.ts", import: "./dist/src/react/userback/index.js", require: "./dist/src/react/userback/index.cjs" }, "./typescript": { types: "./dist/src/typescript/index.d.ts", import: "./dist/src/typescript/index.js", require: "./dist/src/typescript/index.cjs" }, "./util": { types: "./dist/src/util/index.d.ts", import: "./dist/src/util/index.js", require: "./dist/src/util/index.cjs" }, "./style.css": { import: "./dist/style.css", require: "./dist/style.css" } }, Q = { cyberskill: "dist/src/node/cli/index.js" }, X = ["dist", "public"], Z = { build: "vite build", commitlint: "tsx src/node/cli/index.ts commitlint", dev: "vite build --watch", inspect: "tsx src/node/cli/index.ts inspect", lint: "tsx src/node/cli/index.ts lint", "lint:fix": "tsx src/node/cli/index.ts lint:fix", "lint:inspect": "tsx src/node/cli/index.ts lint:inspect", ready: "tsx src/node/cli/index.ts ready", reset: "tsx src/node/cli/index.ts reset", "test:e2e": "tsx src/node/cli/index.ts test:e2e", "test:unit": "tsx src/node/cli/index.ts test:unit" }, ee = { "@antfu/eslint-config": "4.16.1", "@apollo/client": "3.13.8", "@apollo/client-integration-nextjs": "0.12.2", "@apollo/server": "4.12.2", "@dotenvx/dotenvx": "1.45.1", "@eddeee888/gcg-typescript-resolver-files": "0.12.1", "@graphql-codegen/cli": "5.0.7", "@graphql-codegen/client-preset": "4.8.3", "@nestjs/common": "11.1.3", "@nestjs/core": "11.1.3", "@userback/widget": "0.3.11", "@vitejs/plugin-react-swc": "3.10.2", "body-parser": "2.2.0", chalk: "5.4.1", clsx: "2.1.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", envalid: "8.0.0", express: "4.21.2", "express-session": "1.18.1", "express-useragent": "1.0.15", "fs-extra": "11.3.0", globals: "16.2.0", graphql: "16.11.0", "graphql-upload": "17.0.0", "graphql-ws": "6.0.5", i18next: "25.3.0", jsdom: "26.1.0", localforage: "1.10.0", "migrate-mongo": "12.1.3", mongodb: "6.17.0", mongoose: "8.16.1", "mongoose-aggregate-paginate-v2": "1.1.4", "mongoose-paginate-v2": "1.9.1", "next-intl": "4.3.1", "node-fetch": "3.3.2", "node-persist": "4.0.4", qs: "6.14.0", react: "19.1.0", "react-dom": "19.1.0", "react-hot-toast": "2.5.2", "react-i18next": "15.5.3", slugify: "1.6.6", unorm: "1.6.0", uuid: "11.1.0", vite: "7.0.0", ws: "8.18.3", yargs: "18.0.0" }, te = { "@commitlint/cli": "19.8.1", "@commitlint/config-conventional": "19.8.1", "@eslint-react/eslint-plugin": "1.52.2", "@eslint/config-inspector": "1.1.0", "@microsoft/api-extractor": "7.52.8", "@next/eslint-plugin-next": "15.3.4", "@testing-library/jest-dom": "6.6.3", "@testing-library/react": "16.3.0", "@types/body-parser": "1.19.6", "@types/compression": "1.8.1", "@types/cookie-parser": "1.4.9", "@types/cors": "2.8.19", "@types/crypto-js": "4.2.2", "@types/express": "4.17.21", "@types/express-session": "1.18.2", "@types/express-useragent": "1.0.5", "@types/fs-extra": "11.0.4", "@types/graphql-upload": "17.0.0", "@types/migrate-mongo": "10.0.5", "@types/node": "24.0.7", "@types/node-persist": "3.1.8", "@types/react": "19.1.8", "@types/react-dom": "19.1.6", "@types/unorm": "1.3.31", "@types/uuid": "10.0.0", "@types/ws": "8.18.1", "@types/yargs": "17.0.33", "@vitest/browser": "3.2.4", eslint: "9.30.0", "eslint-config-next": "15.3.4", "eslint-plugin-format": "1.0.1", "eslint-plugin-react-hooks": "5.2.0", "eslint-plugin-react-refresh": "0.4.20", glob: "11.0.3", "lint-staged": "16.1.2", "node-modules-inspector": "1.0.0", sass: "1.89.2", "simple-git-hooks": "2.13.0", tsx: "4.20.3", typescript: "5.8.3", vite: "7.0.0", "vite-plugin-dts": "4.5.4", vitest: "3.2.4" }, se = { access: "public", registry: "https://registry.npmjs.org/" }, ie = {
|
|
29
29
|
name: A,
|
|
30
30
|
type: H,
|
|
31
31
|
version: U,
|
|
@@ -53,7 +53,7 @@ var fe = L((u) => {
|
|
|
53
53
|
e ? yield s("Running ESLint with auto-fix", yield i.eslintFix()) : yield s("Running ESLint check", yield i.eslintCheck());
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function q(e, n) {
|
|
57
57
|
if (!n.length)
|
|
58
58
|
return;
|
|
59
59
|
const r = e === "Errors" ? "red" : "yellow";
|
|
@@ -63,7 +63,7 @@ var fe = L((u) => {
|
|
|
63
63
|
return t(this, null, function* () {
|
|
64
64
|
setTimeout(() => t(null, null, function* () {
|
|
65
65
|
const e = yield T(), n = e.filter((a) => a.type === h.Error), r = e.filter((a) => a.type === h.Warning);
|
|
66
|
-
!n.length && !r.length ? d.printBoxedLog("✔ NO ISSUES FOUND", [], "green") : (
|
|
66
|
+
!n.length && !r.length ? d.printBoxedLog("✔ NO ISSUES FOUND", [], "green") : (q("Warnings", r), q("Errors", n), (n.length > 0 || r.length > 0) && x.exit(1));
|
|
67
67
|
}), 0);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -112,12 +112,12 @@ ${j}
|
|
|
112
112
|
}
|
|
113
113
|
function de() {
|
|
114
114
|
return t(this, null, function* () {
|
|
115
|
-
yield
|
|
115
|
+
yield k(), yield C();
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
function le() {
|
|
119
119
|
return t(this, null, function* () {
|
|
120
|
-
v(o.NODE_MODULES, o.PNPM_LOCK_YAML), yield s("Pruning pnpm store", yield i.pnpmPruneStore()), yield s("Clearing pnpm cache", yield i.pnpmCleanCache()), yield
|
|
120
|
+
v(o.NODE_MODULES, o.PNPM_LOCK_YAML), yield s("Pruning pnpm store", yield i.pnpmPruneStore()), yield s("Clearing pnpm cache", yield i.pnpmCleanCache()), yield k(), yield C();
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
function pe() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("node:child_process");require("node:process");require("node:util");require("../../config/env/env.util.cjs");require("../log/log.type.cjs");require("../log/log.util.cjs");const r=require("../../../path.constant-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("node:child_process");require("node:process");require("node:util");require("../../config/env/env.util.cjs");require("../log/log.type.cjs");require("../log/log.util.cjs");const r=require("../../../path.constant-CPGOAxEp.cjs");require("../path/path.util.cjs");require("../storage/storage.util.cjs");exports.clearAllErrorLists=r.clearAllErrorLists;exports.formatCommand=r.formatCommand;exports.getStoredErrorLists=r.getStoredErrorLists;exports.rawCommand=r.rawCommand;exports.resolveCommands=r.resolveCommands;exports.runCommand=r.runCommand;
|
|
@@ -4,7 +4,7 @@ import "node:util";
|
|
|
4
4
|
import "../../config/env/env.util.js";
|
|
5
5
|
import "../log/log.type.js";
|
|
6
6
|
import "../log/log.util.js";
|
|
7
|
-
import { X as n, Z as l, U as C, Y as f, _ as E, $ as L } from "../../../path.constant-
|
|
7
|
+
import { X as n, Z as l, U as C, Y as f, _ as E, $ as L } from "../../../path.constant-DJq0jtD0.js";
|
|
8
8
|
import "../path/path.util.js";
|
|
9
9
|
import "../storage/storage.util.js";
|
|
10
10
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./command.type.cjs"),r=require("../../../path.constant-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./command.type.cjs"),r=require("../../../path.constant-CPGOAxEp.cjs");exports.E_CommandType=o.E_CommandType;exports.clearAllErrorLists=r.clearAllErrorLists;exports.formatCommand=r.formatCommand;exports.getStoredErrorLists=r.getStoredErrorLists;exports.rawCommand=r.rawCommand;exports.resolveCommands=r.resolveCommands;exports.runCommand=r.runCommand;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E_CommandType as o } from "./command.type.js";
|
|
2
|
-
import { X as s, Z as e, U as t, Y as d, _ as n, $ as C } from "../../../path.constant-
|
|
2
|
+
import { X as s, Z as e, U as t, Y as d, _ as n, $ as C } from "../../../path.constant-DJq0jtD0.js";
|
|
3
3
|
export {
|
|
4
4
|
o as E_CommandType,
|
|
5
5
|
s as clearAllErrorLists,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var P=Object.defineProperty;var o=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var d=(e,r,s)=>r in e?P(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,y=(e,r)=>{for(var s in r||(r={}))p.call(r,s)&&d(e,s,r[s]);if(o)for(var s of o(r))q.call(r,s)&&d(e,s,r[s]);return e};var x=(e,r)=>{var s={};for(var t in e)p.call(e,t)&&r.indexOf(t)<0&&(s[t]=e[t]);if(e!=null&&o)for(var t of o(e))r.indexOf(t)<0&&q.call(e,t)&&(s[t]=e[t]);return s};var b=(e,r,s)=>new Promise((t,n)=>{var u=c=>{try{l(s.next(c))}catch(f){n(f)}},a=c=>{try{l(s.throw(c))}catch(f){n(f)}},l=c=>c.done?t(c.value):Promise.resolve(c.value).then(u,a);l((s=s.apply(e,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("@nestjs/core"),A=require("body-parser"),N=require("compression"),O=require("cookie-parser"),m=require("cors"),i=require("express"),G=require("express-session"),H=require("express-useragent"),I=require("graphql-upload/graphqlUploadExpress.mjs");function S(t){var n=t,{isDev:e,whiteList:r}=n,s=x(n,["isDev","whiteList"]);return y({origin:(u,a)=>{e||!u||r!=null&&r.includes(u!=null?u:"")?a(null,!0):a(new Error("Not allowed by CORS"),!1)},credentials:!0},s)}function M(e){return m(S(e))}function j(e){return G(e)}function C(e){e.set("trust proxy",1),e.use(O()),e.use(i.urlencoded({extended:!0})),e.use(N()),e.use(H.express())}function E(e,r){r&&(Array.isArray(r)?r:[r]).forEach(t=>{e.use(i.static(t))})}function v(e){const r=i();return C(r),E(r,e==null?void 0:e.static),r.use(I()),r}function R(e){return b(this,null,function*(){const r=yield g.NestFactory.create(e.module);return C(r.getHttpAdapter().getInstance()),E(r.getHttpAdapter().getInstance(),e.static),e.filters&&r.useGlobalFilters(...e.filters),e.pipes&&r.useGlobalPipes(...e.pipes),r})}exports.bodyParser=A;exports.express=i;exports.createCors=M;exports.createCorsOptions=S;exports.createExpress=v;exports.createNest=R;exports.createSession=j;
|
|
@@ -1,87 +1,88 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var f = Object.getOwnPropertySymbols;
|
|
3
3
|
var d = Object.prototype.hasOwnProperty, i = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var
|
|
4
|
+
var l = (e, r, t) => r in e ? C(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, x = (e, r) => {
|
|
5
5
|
for (var t in r || (r = {}))
|
|
6
|
-
d.call(r, t) &&
|
|
7
|
-
if (
|
|
8
|
-
for (var t of
|
|
9
|
-
i.call(r, t) &&
|
|
6
|
+
d.call(r, t) && l(e, t, r[t]);
|
|
7
|
+
if (f)
|
|
8
|
+
for (var t of f(r))
|
|
9
|
+
i.call(r, t) && l(e, t, r[t]);
|
|
10
10
|
return e;
|
|
11
11
|
};
|
|
12
12
|
var y = (e, r) => {
|
|
13
13
|
var t = {};
|
|
14
14
|
for (var s in e)
|
|
15
15
|
d.call(e, s) && r.indexOf(s) < 0 && (t[s] = e[s]);
|
|
16
|
-
if (e != null &&
|
|
17
|
-
for (var s of
|
|
16
|
+
if (e != null && f)
|
|
17
|
+
for (var s of f(e))
|
|
18
18
|
r.indexOf(s) < 0 && i.call(e, s) && (t[s] = e[s]);
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
|
-
var A = (e, r, t) => new Promise((s,
|
|
21
|
+
var A = (e, r, t) => new Promise((s, o) => {
|
|
22
22
|
var a = (u) => {
|
|
23
23
|
try {
|
|
24
24
|
n(t.next(u));
|
|
25
25
|
} catch (m) {
|
|
26
|
-
|
|
26
|
+
o(m);
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, c = (u) => {
|
|
29
29
|
try {
|
|
30
30
|
n(t.throw(u));
|
|
31
31
|
} catch (m) {
|
|
32
|
-
|
|
32
|
+
o(m);
|
|
33
33
|
}
|
|
34
|
-
}, n = (u) => u.done ? s(u.value) : Promise.resolve(u.value).then(a,
|
|
34
|
+
}, n = (u) => u.done ? s(u.value) : Promise.resolve(u.value).then(a, c);
|
|
35
35
|
n((t = t.apply(e, r)).next());
|
|
36
36
|
});
|
|
37
37
|
import { NestFactory as N } from "@nestjs/core";
|
|
38
|
-
import { default as
|
|
38
|
+
import { default as T } from "body-parser";
|
|
39
39
|
import P from "compression";
|
|
40
40
|
import S from "cookie-parser";
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import { default as
|
|
44
|
-
import
|
|
45
|
-
import
|
|
41
|
+
import g from "cors";
|
|
42
|
+
import p from "express";
|
|
43
|
+
import { default as W } from "express";
|
|
44
|
+
import G from "express-session";
|
|
45
|
+
import H from "express-useragent";
|
|
46
|
+
import I from "graphql-upload/graphqlUploadExpress.mjs";
|
|
46
47
|
function O(s) {
|
|
47
|
-
var
|
|
48
|
+
var o = s, { isDev: e, whiteList: r } = o, t = y(o, ["isDev", "whiteList"]);
|
|
48
49
|
return x({
|
|
49
|
-
origin: (a,
|
|
50
|
-
e || !a || r != null && r.includes(a != null ? a : "") ?
|
|
50
|
+
origin: (a, c) => {
|
|
51
|
+
e || !a || r != null && r.includes(a != null ? a : "") ? c(null, !0) : c(new Error("Not allowed by CORS"), !1);
|
|
51
52
|
},
|
|
52
53
|
credentials: !0
|
|
53
54
|
}, t);
|
|
54
55
|
}
|
|
55
|
-
function z(e) {
|
|
56
|
-
return G(O(e));
|
|
57
|
-
}
|
|
58
56
|
function B(e) {
|
|
59
|
-
return
|
|
57
|
+
return g(O(e));
|
|
58
|
+
}
|
|
59
|
+
function D(e) {
|
|
60
|
+
return G(e);
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
e.set("trust proxy", 1), e.use(S()), e.use(
|
|
62
|
+
function E(e) {
|
|
63
|
+
e.set("trust proxy", 1), e.use(S()), e.use(p.urlencoded({ extended: !0 })), e.use(P()), e.use(H.express());
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function b(e, r) {
|
|
65
66
|
r && (Array.isArray(r) ? r : [r]).forEach((s) => {
|
|
66
|
-
e.use(
|
|
67
|
+
e.use(p.static(s));
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
|
-
function D(e) {
|
|
70
|
-
const r = l();
|
|
71
|
-
return b(r), C(r, e == null ? void 0 : e.static), r;
|
|
72
|
-
}
|
|
73
70
|
function F(e) {
|
|
71
|
+
const r = p();
|
|
72
|
+
return E(r), b(r, e == null ? void 0 : e.static), r.use(I()), r;
|
|
73
|
+
}
|
|
74
|
+
function J(e) {
|
|
74
75
|
return A(this, null, function* () {
|
|
75
76
|
const r = yield N.create(e.module);
|
|
76
|
-
return
|
|
77
|
+
return E(r.getHttpAdapter().getInstance()), b(r.getHttpAdapter().getInstance(), e.static), e.filters && r.useGlobalFilters(...e.filters), e.pipes && r.useGlobalPipes(...e.pipes), r;
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
80
|
export {
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
T as bodyParser,
|
|
82
|
+
B as createCors,
|
|
82
83
|
O as createCorsOptions,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
F as createExpress,
|
|
85
|
+
J as createNest,
|
|
86
|
+
D as createSession,
|
|
87
|
+
W as express
|
|
87
88
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var M=Object.defineProperty,x=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var R=(c,t,e)=>t in c?M(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e,g=(c,t)=>{for(var e in t||(t={}))b.call(t,e)&&R(c,e,t[e]);if(T)for(var e of T(t))I.call(t,e)&&R(c,e,t[e]);return c},S=(c,t)=>x(c,C(t));var p=(c,t,e)=>R(c,typeof t!="symbol"?t+"":t,e);var a=(c,t,e)=>new Promise((r,s)=>{var n=l=>{try{i(e.next(l))}catch(m){s(m)}},u=l=>{try{i(e.throw(l))}catch(m){s(m)}},i=l=>l.done?r(l.value):Promise.resolve(l.value).then(n,u);i((e=e.apply(c,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("date-fns"),F=require("migrate-mongo"),G=require("mongoose"),D=require("mongoose-aggregate-paginate-v2"),A=require("mongoose-paginate-v2"),w=require("uuid"),d=require("../../constant/response-status.cjs"),U=require("../../util/common/common.util.cjs"),f=require("../../util/object/object.util.cjs"),O=require("../../util/string/string.util.cjs"),j=require("../../util/validate/validate.util.cjs"),E=require("../fs/fs.util.cjs"),o=require("../log/log.util.cjs"),y=require("../../../path.constant-
|
|
1
|
+
"use strict";var M=Object.defineProperty,x=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var R=(c,t,e)=>t in c?M(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e,g=(c,t)=>{for(var e in t||(t={}))b.call(t,e)&&R(c,e,t[e]);if(T)for(var e of T(t))I.call(t,e)&&R(c,e,t[e]);return c},S=(c,t)=>x(c,C(t));var p=(c,t,e)=>R(c,typeof t!="symbol"?t+"":t,e);var a=(c,t,e)=>new Promise((r,s)=>{var n=l=>{try{i(e.next(l))}catch(m){s(m)}},u=l=>{try{i(e.throw(l))}catch(m){s(m)}},i=l=>l.done?r(l.value):Promise.resolve(l.value).then(n,u);i((e=e.apply(c,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("date-fns"),F=require("migrate-mongo"),G=require("mongoose"),D=require("mongoose-aggregate-paginate-v2"),A=require("mongoose-paginate-v2"),w=require("uuid"),d=require("../../constant/response-status.cjs"),U=require("../../util/common/common.util.cjs"),f=require("../../util/object/object.util.cjs"),O=require("../../util/string/string.util.cjs"),j=require("../../util/validate/validate.util.cjs"),E=require("../fs/fs.util.cjs"),o=require("../log/log.util.cjs"),y=require("../../../path.constant-CPGOAxEp.cjs");require("../path/path.util.cjs");const h={getDateTime(c=new Date){return P.format(c,"yyyy-MM-dd HH:mm:ss.SSS")},createGenericFields({returnDateAs:c="string"}={}){const t=c==="string"?h.getDateTime():new Date;return{id:w.v4(),isDel:!1,createdAt:t,updatedAt:t}},applyPlugins(c,t){t.filter(e=>typeof e=="function").forEach(e=>c.plugin(e))},applyMiddlewares(c,t){t.forEach(({method:e,pre:r,post:s})=>{e&&r&&c.pre(e,r),e&&s&&c.post(e,s)})},createGenericSchema(c){return new c.Schema({id:{type:String,default:w.v4,unique:!0},isDel:{type:Boolean,default:!1}},{timestamps:!0})},createSchema({mongoose:c,schema:t,virtuals:e=[],standalone:r=!1}){const s=new c.Schema(t);return e.forEach(({name:n,options:u,get:i})=>{const l=s.virtual(n,u);i&&l.get(i)}),r||s.add(h.createGenericSchema(c)),s},createModel({mongoose:c,name:t,schema:e,pagination:r=!1,aggregate:s=!1,virtuals:n=[],middlewares:u=[]}){if(!t)throw new Error("Model name is required.");if(c.models[t])return c.models[t];const i=h.createSchema({mongoose:c,schema:e,virtuals:n});return h.applyPlugins(i,[r&&A,s&&D]),h.applyMiddlewares(i,u),c.model(t,i)},validator:{isRequired(){return function(c){return a(this,null,function*(){return!j.validate.isEmpty(c)})}},isUnique(c){return function(t){return a(this,null,function*(){if(!Array.isArray(c)||c.length===0)throw new Error("Fields must be a non-empty array of strings.");const e={$or:c.map(s=>({[s]:t}))};return!(yield this.constructor.exists(e))})}},matchesRegex(c){return function(t){return a(this,null,function*(){if(!Array.isArray(c)||c.some(e=>!(e instanceof RegExp)))throw new Error("regexArray must be an array of valid RegExp objects.");return c.every(e=>e.test(t))})}}},migrate:S(g({},F),{setConfig:c=>{const t=`// This file is automatically generated by the Cyberskill CLI.
|
|
2
2
|
module.exports = ${JSON.stringify(c,null,4)}`;E.writeFileSync(y.PATH.MIGRATE_MONGO_CONFIG,t);const e=`
|
|
3
3
|
${y.MIGRATE_MONGO_CONFIG}
|
|
4
4
|
`;E.pathExistsSync(y.PATH.GIT_IGNORE)?E.readFileSync(y.PATH.GIT_IGNORE,"utf-8").split(`
|
|
@@ -42,7 +42,7 @@ import { generateShortId as L, generateSlug as E } from "../../util/string/strin
|
|
|
42
42
|
import { validate as H } from "../../util/validate/validate.util.js";
|
|
43
43
|
import { writeFileSync as x, pathExistsSync as Q, readFileSync as k, appendFileSync as J } from "../fs/fs.util.js";
|
|
44
44
|
import { catchError as o } from "../log/log.util.js";
|
|
45
|
-
import { F as y, M as C } from "../../../path.constant-
|
|
45
|
+
import { F as y, M as C } from "../../../path.constant-DJq0jtD0.js";
|
|
46
46
|
import "../path/path.util.js";
|
|
47
47
|
const g = {
|
|
48
48
|
getDateTime(c = /* @__PURE__ */ new Date()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./package.type.cjs"),e=require("../../../path.constant-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./package.type.cjs"),e=require("../../../path.constant-CPGOAxEp.cjs");exports.E_PackageType=a.E_PackageType;exports.getLatestPackageVersion=e.getLatestPackageVersion;exports.getPackage=e.getPackage;exports.installDependencies=e.installDependencies;exports.setupPackages=e.setupPackages;exports.updatePackage=e.updatePackage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E_PackageType as s } from "./package.type.js";
|
|
2
|
-
import { J as g, K as c, Q as p, R as k, O as o } from "../../../path.constant-
|
|
2
|
+
import { J as g, K as c, Q as p, R as k, O as o } from "../../../path.constant-DJq0jtD0.js";
|
|
3
3
|
export {
|
|
4
4
|
s as E_PackageType,
|
|
5
5
|
g as getLatestPackageVersion,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("node-fetch");require("../../config/env/env.util.cjs");const e=require("../../../path.constant-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("node-fetch");require("../../config/env/env.util.cjs");const e=require("../../../path.constant-CPGOAxEp.cjs");require("../fs/fs.util.cjs");require("../log/log.util.cjs");require("../path/path.util.cjs");require("./package.type.cjs");exports.getLatestPackageVersion=e.getLatestPackageVersion;exports.getPackage=e.getPackage;exports.installDependencies=e.installDependencies;exports.setupPackages=e.setupPackages;exports.updatePackage=e.updatePackage;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node-fetch";
|
|
2
2
|
import "../../config/env/env.util.js";
|
|
3
|
-
import { J as m, K as g, Q as c, R as k, O as n } from "../../../path.constant-
|
|
3
|
+
import { J as m, K as g, Q as c, R as k, O as n } from "../../../path.constant-DJq0jtD0.js";
|
|
4
4
|
import "../fs/fs.util.js";
|
|
5
5
|
import "../log/log.util.js";
|
|
6
6
|
import "../path/path.util.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../path.constant-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../path.constant-CPGOAxEp.cjs"),I=require("./path.util.cjs");exports.BUILD_DIRECTORY=_.BUILD_DIRECTORY;exports.COMMIT_LINT_CLI=_.COMMIT_LINT_CLI;exports.COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME=_.COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME;exports.COMMIT_LINT_PACKAGE_NAME=_.COMMIT_LINT_PACKAGE_NAME;exports.CYBERSKILL_CLI=_.CYBERSKILL_CLI;exports.CYBERSKILL_CLI_PATH=_.CYBERSKILL_CLI_PATH;exports.CYBERSKILL_DIRECTORY=_.CYBERSKILL_DIRECTORY;exports.CYBERSKILL_PACKAGE_NAME=_.CYBERSKILL_PACKAGE_NAME;exports.ESLINT_CLI=_.ESLINT_CLI;exports.ESLINT_INSPECT_CLI=_.ESLINT_INSPECT_CLI;exports.ESLINT_INSPECT_PACKAGE_NAME=_.ESLINT_INSPECT_PACKAGE_NAME;exports.ESLINT_PACKAGE_NAME=_.ESLINT_PACKAGE_NAME;exports.GIT_CLI=_.GIT_CLI;exports.GIT_COMMIT_EDITMSG=_.GIT_COMMIT_EDITMSG;exports.GIT_HOOK=_.GIT_HOOK;exports.GIT_IGNORE=_.GIT_IGNORE;exports.LINT_STAGED_CLI=_.LINT_STAGED_CLI;exports.LINT_STAGED_PACKAGE_NAME=_.LINT_STAGED_PACKAGE_NAME;exports.MIGRATE_MONGO_CLI=_.MIGRATE_MONGO_CLI;exports.MIGRATE_MONGO_CONFIG=_.MIGRATE_MONGO_CONFIG;exports.MIGRATE_MONGO_PACKAGE_NAME=_.MIGRATE_MONGO_PACKAGE_NAME;exports.NODE_MODULES=_.NODE_MODULES;exports.NODE_MODULES_INSPECT_CLI=_.NODE_MODULES_INSPECT_CLI;exports.NODE_MODULES_INSPECT_PACKAGE_NAME=_.NODE_MODULES_INSPECT_PACKAGE_NAME;exports.PACKAGE_JSON=_.PACKAGE_JSON;exports.PACKAGE_LOCK_JSON=_.PACKAGE_LOCK_JSON;exports.PATH=_.PATH;exports.PNPM_CLI=_.PNPM_CLI;exports.PNPM_EXEC_CLI=_.PNPM_EXEC_CLI;exports.PNPM_LOCK_YAML=_.PNPM_LOCK_YAML;exports.PUBLIC_DIRECTORY=_.PUBLIC_DIRECTORY;exports.SIMPLE_GIT_HOOKS_PACKAGE_NAME=_.SIMPLE_GIT_HOOKS_PACKAGE_NAME;exports.SIMPLE_GIT_HOOK_CLI=_.SIMPLE_GIT_HOOK_CLI;exports.SIMPLE_GIT_HOOK_JSON=_.SIMPLE_GIT_HOOK_JSON;exports.TSCONFIG_JSON=_.TSCONFIG_JSON;exports.TSC_CLI=_.TSC_CLI;exports.TSC_PACKAGE_NAME=_.TSC_PACKAGE_NAME;exports.TSX_CLI=_.TSX_CLI;exports.VITEST_CLI=_.VITEST_CLI;exports.VITEST_PACKAGE_NAME=_.VITEST_PACKAGE_NAME;exports.WORKING_DIRECTORY=_.WORKING_DIRECTORY;exports.command=_.command;exports.createGitHooksConfig=_.createGitHooksConfig;exports.dirname=I.dirname;exports.join=I.join;exports.path=I.path;exports.resolve=I.resolve;exports.resolveWorkingPath=I.resolveWorkingPath;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as E, m as C, l as a, k as s, g as A, h as N, f as T, C as L, i as O, x as M, w as G, E as S, r as P, e as K, d as R, G as D, n as o, L as e, D as r, M as Y, A as H, N as t, z as B, y as i, a as m, b as n, F as U, s as f, t as p, c as F, P as J, u as V, v as c, S as d, T as g, p as h, o as k, q as l, j as v, V as x, W, I as j, H as X } from "../../../path.constant-
|
|
1
|
+
import { B as E, m as C, l as a, k as s, g as A, h as N, f as T, C as L, i as O, x as M, w as G, E as S, r as P, e as K, d as R, G as D, n as o, L as e, D as r, M as Y, A as H, N as t, z as B, y as i, a as m, b as n, F as U, s as f, t as p, c as F, P as J, u as V, v as c, S as d, T as g, p as h, o as k, q as l, j as v, V as x, W, I as j, H as X } from "../../../path.constant-DJq0jtD0.js";
|
|
2
2
|
import { dirname as q, join as u, path as w, resolve as y, resolveWorkingPath as z } from "./path.util.js";
|
|
3
3
|
export {
|
|
4
4
|
E as BUILD_DIRECTORY,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("fs-extra");require("../../config/env/env.util.cjs");require("../command/command.type.cjs");const _=require("../../../path.constant-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("fs-extra");require("../../config/env/env.util.cjs");require("../command/command.type.cjs");const _=require("../../../path.constant-CPGOAxEp.cjs");require("../package/package.type.cjs");require("./path.util.cjs");exports.BUILD_DIRECTORY=_.BUILD_DIRECTORY;exports.COMMIT_LINT_CLI=_.COMMIT_LINT_CLI;exports.COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME=_.COMMIT_LINT_CONVENTIONAL_CONFIG_PACKAGE_NAME;exports.COMMIT_LINT_PACKAGE_NAME=_.COMMIT_LINT_PACKAGE_NAME;exports.CYBERSKILL_CLI=_.CYBERSKILL_CLI;exports.CYBERSKILL_CLI_PATH=_.CYBERSKILL_CLI_PATH;exports.CYBERSKILL_DIRECTORY=_.CYBERSKILL_DIRECTORY;exports.CYBERSKILL_PACKAGE_NAME=_.CYBERSKILL_PACKAGE_NAME;exports.ESLINT_CLI=_.ESLINT_CLI;exports.ESLINT_INSPECT_CLI=_.ESLINT_INSPECT_CLI;exports.ESLINT_INSPECT_PACKAGE_NAME=_.ESLINT_INSPECT_PACKAGE_NAME;exports.ESLINT_PACKAGE_NAME=_.ESLINT_PACKAGE_NAME;exports.GIT_CLI=_.GIT_CLI;exports.GIT_COMMIT_EDITMSG=_.GIT_COMMIT_EDITMSG;exports.GIT_HOOK=_.GIT_HOOK;exports.GIT_IGNORE=_.GIT_IGNORE;exports.LINT_STAGED_CLI=_.LINT_STAGED_CLI;exports.LINT_STAGED_PACKAGE_NAME=_.LINT_STAGED_PACKAGE_NAME;exports.MIGRATE_MONGO_CLI=_.MIGRATE_MONGO_CLI;exports.MIGRATE_MONGO_CONFIG=_.MIGRATE_MONGO_CONFIG;exports.MIGRATE_MONGO_PACKAGE_NAME=_.MIGRATE_MONGO_PACKAGE_NAME;exports.NODE_MODULES=_.NODE_MODULES;exports.NODE_MODULES_INSPECT_CLI=_.NODE_MODULES_INSPECT_CLI;exports.NODE_MODULES_INSPECT_PACKAGE_NAME=_.NODE_MODULES_INSPECT_PACKAGE_NAME;exports.PACKAGE_JSON=_.PACKAGE_JSON;exports.PACKAGE_LOCK_JSON=_.PACKAGE_LOCK_JSON;exports.PATH=_.PATH;exports.PNPM_CLI=_.PNPM_CLI;exports.PNPM_EXEC_CLI=_.PNPM_EXEC_CLI;exports.PNPM_LOCK_YAML=_.PNPM_LOCK_YAML;exports.PUBLIC_DIRECTORY=_.PUBLIC_DIRECTORY;exports.SIMPLE_GIT_HOOKS_PACKAGE_NAME=_.SIMPLE_GIT_HOOKS_PACKAGE_NAME;exports.SIMPLE_GIT_HOOK_CLI=_.SIMPLE_GIT_HOOK_CLI;exports.SIMPLE_GIT_HOOK_JSON=_.SIMPLE_GIT_HOOK_JSON;exports.TSCONFIG_JSON=_.TSCONFIG_JSON;exports.TSC_CLI=_.TSC_CLI;exports.TSC_PACKAGE_NAME=_.TSC_PACKAGE_NAME;exports.TSX_CLI=_.TSX_CLI;exports.VITEST_CLI=_.VITEST_CLI;exports.VITEST_PACKAGE_NAME=_.VITEST_PACKAGE_NAME;exports.WORKING_DIRECTORY=_.WORKING_DIRECTORY;exports.command=_.command;exports.createGitHooksConfig=_.createGitHooksConfig;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "fs-extra";
|
|
2
2
|
import "../../config/env/env.util.js";
|
|
3
3
|
import "../command/command.type.js";
|
|
4
|
-
import { B as T, m as s, l as L, k as O, g as M, h as G, f as S, C as P, i as K, x as R, w as D, E as o, r as m, e as r, d as t, G as Y, n as i, L as H, D as p, M as B, A as U, N as e, z as F, y as J, a as V, b as c, F as f, s as n, t as d, c as g, P as k, u as x, v as W, S as X, T as b, p as h, o as j, q as l, j as q, V as u, W as v, I as w, H as y } from "../../../path.constant-
|
|
4
|
+
import { B as T, m as s, l as L, k as O, g as M, h as G, f as S, C as P, i as K, x as R, w as D, E as o, r as m, e as r, d as t, G as Y, n as i, L as H, D as p, M as B, A as U, N as e, z as F, y as J, a as V, b as c, F as f, s as n, t as d, c as g, P as k, u as x, v as W, S as X, T as b, p as h, o as j, q as l, j as q, V as u, W as v, I as w, H as y } from "../../../path.constant-DJq0jtD0.js";
|
|
5
5
|
import "../package/package.type.js";
|
|
6
6
|
import "./path.util.js";
|
|
7
7
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var x=Object.defineProperty;var y=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var _=(i,s,e)=>s in i?x(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e,m=(i,s)=>{for(var e in s||(s={}))v.call(s,e)&&_(i,e,s[e]);if(y)for(var e of y(s))z.call(s,e)&&_(i,e,s[e]);return i};var g=(i,s,e)=>new Promise((t,a)=>{var n=r=>{try{l(e.next(r))}catch(c){a(c)}},o=r=>{try{l(e.throw(r))}catch(c){a(c)}},l=r=>r.done?t(r.value):Promise.resolve(r.value).then(n,o);l((e=e.apply(i,s)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../fs/fs.util.cjs");require("../../../path.constant-
|
|
1
|
+
"use strict";var x=Object.defineProperty;var y=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var _=(i,s,e)=>s in i?x(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e,m=(i,s)=>{for(var e in s||(s={}))v.call(s,e)&&_(i,e,s[e]);if(y)for(var e of y(s))z.call(s,e)&&_(i,e,s[e]);return i};var g=(i,s,e)=>new Promise((t,a)=>{var n=r=>{try{l(e.next(r))}catch(c){a(c)}},o=r=>{try{l(e.throw(r))}catch(c){a(c)}},l=r=>r.done?t(r.value):Promise.resolve(r.value).then(n,o);l((e=e.apply(i,s)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../fs/fs.util.cjs");require("../../../path.constant-CPGOAxEp.cjs");const T=require("../path/path.util.cjs"),d=require("./upload.type.cjs");function U(i){return g(this,null,function*(){return new Promise((s,e)=>{let t=0;i.on("data",a=>{t+=a.length}),i.on("end",()=>s(t)),i.on("error",e)})})}function L(i,s){const e=i.lastIndexOf(".");if(e===-1)return!1;const t=i.substring(e+1).toLowerCase();return s.includes(t)}function S(i,s,e){const{filename:t,fileSize:a}=i,n=s[e],{allowedExtensions:o,sizeLimit:l}=n;if(!L(t,o))return{isValid:!1,error:`File extension not allowed for ${e.toLowerCase()} files. Allowed extensions: ${o.join(", ")}`};if(a!==void 0&&a>l){const r=Math.round(l/1048576);return{isValid:!1,error:`File size exceeds limit for ${e.toLowerCase()} files. Maximum size: ${r}MB`}}return{isValid:!0}}function C(i){const s={[d.E_UploadType.IMAGE]:{allowedExtensions:["jpg","jpeg","png","gif","webp","svg"],sizeLimit:5242880},[d.E_UploadType.VIDEO]:{allowedExtensions:["mp4","avi","mov","wmv","flv","webm"],sizeLimit:524288e3},[d.E_UploadType.DOCUMENT]:{allowedExtensions:["pdf","doc","docx","txt","rtf"],sizeLimit:10485760},[d.E_UploadType.OTHER]:{allowedExtensions:["zip","rar","tar","gz"],sizeLimit:5242880}};return m(m({},s),i)}function h(i){return g(this,null,function*(){const{path:s,file:e,config:t,type:a}=i;if(!s||typeof s!="string")return{success:!1,message:"Invalid path provided",result:""};if(!e||typeof e!="object")return{success:!1,message:"Invalid file provided",result:""};if(t){const n=[d.E_UploadType.IMAGE,d.E_UploadType.VIDEO,d.E_UploadType.DOCUMENT,d.E_UploadType.OTHER];for(const o of n){if(!t[o]||!Array.isArray(t[o].allowedExtensions)||t[o].allowedExtensions.length===0)return{success:!1,message:`Invalid config for ${o.toLowerCase()} files`,result:""};if(typeof t[o].sizeLimit!="number"||t[o].sizeLimit<=0)return{success:!1,message:`Invalid size limit for ${o.toLowerCase()} files`,result:""}}}try{const n=yield(yield e).file,{filename:o,createReadStream:l}=n;if(t){const p=l(),f=yield U(p),w=S({filename:o,fileSize:f},t,a);if(!w.isValid)return{success:!1,message:w.error||"File validation failed",result:""}}const r=T.dirname(s);E.pathExistsSync(r)||E.mkdirSync(r,{recursive:!0});const c=l(),u=E.createWriteStream(s);return c.pipe(u),yield new Promise((p,f)=>{u.on("finish",()=>p()),u.on("error",f),c.on("error",f)}),{success:!0,message:"File uploaded successfully",result:s}}catch(n){return{success:!1,message:n instanceof Error?n.message:"File upload failed",result:""}}})}exports.createUploadConfig=C;exports.upload=h;
|
|
@@ -26,7 +26,7 @@ var g = (s, i, e) => new Promise((t, a) => {
|
|
|
26
26
|
l((e = e.apply(s, i)).next());
|
|
27
27
|
});
|
|
28
28
|
import { pathExistsSync as L, mkdirSync as C, createWriteStream as I } from "../fs/fs.util.js";
|
|
29
|
-
import "../../../path.constant-
|
|
29
|
+
import "../../../path.constant-DJq0jtD0.js";
|
|
30
30
|
import { dirname as S } from "../path/path.util.js";
|
|
31
31
|
import { E_UploadType as f } from "./upload.type.js";
|
|
32
32
|
function h(s) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var N=Object.defineProperty;var
|
|
1
|
+
"use strict";var N=Object.defineProperty;var $=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var d=(t,e,n)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,h=(t,e)=>{for(var n in e||(e={}))R.call(e,n)&&d(t,n,e[n]);if($)for(var n of $(e))x.call(e,n)&&d(t,n,e[n]);return t};var T=(t,e,n)=>d(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("@apollo/client/core/core.cjs"),m=require("@apollo/client/link/core/core.cjs"),G=require("@apollo/client/link/error/error.cjs"),P=require("@apollo/client/link/http/http.cjs"),S=require("@apollo/client/link/remove-typename/remove-typename.cjs"),H=require("@apollo/client/link/subscriptions/subscriptions.cjs"),I=require("@apollo/client/utilities/utilities.cjs"),F=require("graphql-ws"),k=require("react"),M=require("../apollo-error/apollo-error.util.cjs"),c=require("../log/log.util.cjs"),U=require("react-hot-toast"),v=require("./apollo-client.constant.cjs");class C extends m.ApolloLink{constructor(){super(...arguments);T(this,"count",0)}request(n,r){const g=Date.now();return this.count+=1,r(n).map(_=>{const p=Date.now()-g,a=n.operationName||"Unnamed";return c.log.info(`[Apollo] #${this.count}: ${a} (${p}ms)`),_})}}function D(t){const{uri:e,wsUrl:n,customLinks:r}=t,g=new C,_=G.onError(({graphQLErrors:o,networkError:i,protocolErrors:s,operation:f})=>{var w,y;const j=(f==null?void 0:f.operationName)||"Unknown";if(o&&o.forEach(({message:l,locations:u,path:L})=>{c.log.error(`[GraphQL error] ${j}: ${l}, Location: ${JSON.stringify(u,null,4)}, Path: ${L}`)}),s&&s.forEach(({message:l,extensions:u})=>{c.log.error(`[Protocol error]: ${l}, Extensions: ${JSON.stringify(u,null,4)}`)}),i&&c.log.error(`[Network error]: ${i}`),o||s||i){const l=((w=o==null?void 0:o[0])==null?void 0:w.message)||((y=s==null?void 0:s[0])==null?void 0:y.message)||(i==null?void 0:i.message)||"Unexpected error",u=new q.ApolloError({graphQLErrors:o||[],protocolErrors:s||[],clientErrors:[],networkError:i||null,errorMessage:l,extraInfo:{operation:f}});typeof window!="undefined"&&U.toast.error(L=>k.createElement(k.Fragment,null,l," ",k.createElement("button",{type:"button",className:"text-blue-500 hover:text-blue-700",onClick:()=>{setTimeout(()=>{M.showGlobalApolloError(u)},0),U.toast.dismiss(L.id)}},"Show Details")))}}),p=S.removeTypenameFromVariables();e||c.log.warn(`[Apollo] No GraphQL URI provided — using "${v.GRAPHQL_URI_DEFAULT}" as default`);const a=new P.HttpLink({uri:e!=null?e:v.GRAPHQL_URI_DEFAULT,credentials:"include"}),A=n?new H.GraphQLWsLink(F.createClient({url:n})):m.ApolloLink.empty(),b=A instanceof m.ApolloLink?m.split(({query:o})=>{const i=I.getMainDefinition(o);return i.kind==="OperationDefinition"&&i.operation==="subscription"},A,a):a;return b===a&&n&&c.log.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[g,_,p,...r!=null?r:[],b]}function O(t={}){const e=m.from(D(t));return new q.ApolloClient(h({link:e,cache:new q.InMemoryCache},t))}exports.DevLoggerLink=C;exports.createApolloLinks=D;exports.getClient=O;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
var C = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var h = Object.getOwnPropertySymbols;
|
|
3
3
|
var T = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var
|
|
4
|
+
var w = (t, e, n) => e in t ? C(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, N = (t, e) => {
|
|
5
5
|
for (var n in e || (e = {}))
|
|
6
|
-
T.call(e, n) &&
|
|
7
|
-
if (
|
|
8
|
-
for (var n of
|
|
9
|
-
G.call(e, n) &&
|
|
6
|
+
T.call(e, n) && w(t, n, e[n]);
|
|
7
|
+
if (h)
|
|
8
|
+
for (var n of h(e))
|
|
9
|
+
G.call(e, n) && w(t, n, e[n]);
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
var U = (t, e, n) =>
|
|
12
|
+
var U = (t, e, n) => w(t, typeof e != "symbol" ? e + "" : e, n);
|
|
13
13
|
import { ApolloError as R, ApolloClient as I, InMemoryCache as P } from "@apollo/client/core/core.cjs";
|
|
14
|
-
import { ApolloLink as
|
|
14
|
+
import { ApolloLink as $, split as S, from as _ } from "@apollo/client/link/core/core.cjs";
|
|
15
15
|
import { onError as F } from "@apollo/client/link/error/error.cjs";
|
|
16
16
|
import { HttpLink as H } from "@apollo/client/link/http/http.cjs";
|
|
17
17
|
import { removeTypenameFromVariables as M } from "@apollo/client/link/remove-typename/remove-typename.cjs";
|
|
18
18
|
import { GraphQLWsLink as O } from "@apollo/client/link/subscriptions/subscriptions.cjs";
|
|
19
19
|
import { getMainDefinition as J } from "@apollo/client/utilities/utilities.cjs";
|
|
20
20
|
import { createClient as W } from "graphql-ws";
|
|
21
|
-
import
|
|
21
|
+
import k from "react";
|
|
22
22
|
import { showGlobalApolloError as q } from "../apollo-error/apollo-error.util.js";
|
|
23
23
|
import { log as l } from "../log/log.util.js";
|
|
24
24
|
import { toast as x } from "react-hot-toast";
|
|
25
25
|
import { GRAPHQL_URI_DEFAULT as D } from "./apollo-client.constant.js";
|
|
26
|
-
class V extends
|
|
26
|
+
class V extends $ {
|
|
27
27
|
constructor() {
|
|
28
28
|
super(...arguments);
|
|
29
29
|
U(this, "count", 0);
|
|
@@ -31,25 +31,25 @@ class V extends b {
|
|
|
31
31
|
request(n, a) {
|
|
32
32
|
const u = Date.now();
|
|
33
33
|
return this.count += 1, a(n).map((p) => {
|
|
34
|
-
const d = Date.now() - u,
|
|
35
|
-
return l.info(`[Apollo] #${this.count}: ${
|
|
34
|
+
const d = Date.now() - u, f = n.operationName || "Unnamed";
|
|
35
|
+
return l.info(`[Apollo] #${this.count}: ${f} (${d}ms)`), p;
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
function j(t) {
|
|
40
40
|
const { uri: e, wsUrl: n, customLinks: a } = t, u = new V(), p = F(({ graphQLErrors: o, networkError: i, protocolErrors: m, operation: r }) => {
|
|
41
|
-
var A,
|
|
41
|
+
var A, y;
|
|
42
42
|
const v = (r == null ? void 0 : r.operationName) || "Unknown";
|
|
43
|
-
if (o && o.forEach(({ message: s, locations:
|
|
43
|
+
if (o && o.forEach(({ message: s, locations: c, path: L }) => {
|
|
44
44
|
l.error(
|
|
45
|
-
`[GraphQL error] ${v}: ${s}, Location: ${JSON.stringify(
|
|
45
|
+
`[GraphQL error] ${v}: ${s}, Location: ${JSON.stringify(c, null, 4)}, Path: ${L}`
|
|
46
46
|
);
|
|
47
|
-
}), m && m.forEach(({ message: s, extensions:
|
|
47
|
+
}), m && m.forEach(({ message: s, extensions: c }) => {
|
|
48
48
|
l.error(
|
|
49
|
-
`[Protocol error]: ${s}, Extensions: ${JSON.stringify(
|
|
49
|
+
`[Protocol error]: ${s}, Extensions: ${JSON.stringify(c, null, 4)}`
|
|
50
50
|
);
|
|
51
51
|
}), i && l.error(`[Network error]: ${i}`), o || m || i) {
|
|
52
|
-
const s = ((A = o == null ? void 0 : o[0]) == null ? void 0 : A.message) || ((
|
|
52
|
+
const s = ((A = o == null ? void 0 : o[0]) == null ? void 0 : A.message) || ((y = m == null ? void 0 : m[0]) == null ? void 0 : y.message) || (i == null ? void 0 : i.message) || "Unexpected error", c = new R({
|
|
53
53
|
graphQLErrors: o || [],
|
|
54
54
|
protocolErrors: m || [],
|
|
55
55
|
clientErrors: [],
|
|
@@ -59,14 +59,14 @@ function j(t) {
|
|
|
59
59
|
operation: r
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
x.error((L) => /* @__PURE__ */
|
|
62
|
+
typeof window != "undefined" && x.error((L) => /* @__PURE__ */ k.createElement(k.Fragment, null, s, " ", /* @__PURE__ */ k.createElement(
|
|
63
63
|
"button",
|
|
64
64
|
{
|
|
65
65
|
type: "button",
|
|
66
66
|
className: "text-blue-500 hover:text-blue-700",
|
|
67
67
|
onClick: () => {
|
|
68
68
|
setTimeout(() => {
|
|
69
|
-
q(
|
|
69
|
+
q(c);
|
|
70
70
|
}, 0), x.dismiss(L.id);
|
|
71
71
|
}
|
|
72
72
|
},
|
|
@@ -75,18 +75,18 @@ function j(t) {
|
|
|
75
75
|
}
|
|
76
76
|
}), d = M();
|
|
77
77
|
e || l.warn(`[Apollo] No GraphQL URI provided — using "${D}" as default`);
|
|
78
|
-
const
|
|
78
|
+
const f = new H({
|
|
79
79
|
uri: e != null ? e : D,
|
|
80
80
|
credentials: "include"
|
|
81
|
-
}),
|
|
81
|
+
}), b = n ? new O(W({ url: n })) : $.empty(), g = b instanceof $ ? S(
|
|
82
82
|
({ query: o }) => {
|
|
83
83
|
const i = J(o);
|
|
84
84
|
return i.kind === "OperationDefinition" && i.operation === "subscription";
|
|
85
85
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
) :
|
|
89
|
-
return
|
|
86
|
+
b,
|
|
87
|
+
f
|
|
88
|
+
) : f;
|
|
89
|
+
return g === f && n && l.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."), [
|
|
90
90
|
u,
|
|
91
91
|
// 🪵 custom logger
|
|
92
92
|
p,
|
|
@@ -95,7 +95,7 @@ function j(t) {
|
|
|
95
95
|
// 🧼 cleans up __typename
|
|
96
96
|
...a != null ? a : [],
|
|
97
97
|
// 🔗 custom links
|
|
98
|
-
|
|
98
|
+
g
|
|
99
99
|
// 📡 HTTP vs WS routing
|
|
100
100
|
];
|
|
101
101
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberskill/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.203.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -125,9 +125,9 @@
|
|
|
125
125
|
"require": "./dist/src/react/apollo-client-nextjs/index.cjs"
|
|
126
126
|
},
|
|
127
127
|
"./react/apollo-client-nextjs/rsc": {
|
|
128
|
-
"types": "./dist/src/react/apollo-client-nextjs/apollo-client-nextjs
|
|
129
|
-
"import": "./dist/src/react/apollo-client-nextjs/apollo-client-nextjs
|
|
130
|
-
"require": "./dist/src/react/apollo-client-nextjs/apollo-client-nextjs
|
|
128
|
+
"types": "./dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts",
|
|
129
|
+
"import": "./dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.js",
|
|
130
|
+
"require": "./dist/src/react/apollo-client-nextjs/apollo-client-nextjs.rsc.cjs"
|
|
131
131
|
},
|
|
132
132
|
"./react/apollo-error": {
|
|
133
133
|
"types": "./dist/src/react/apollo-error/index.d.ts",
|
|
@@ -233,6 +233,7 @@
|
|
|
233
233
|
"fs-extra": "11.3.0",
|
|
234
234
|
"globals": "16.2.0",
|
|
235
235
|
"graphql": "16.11.0",
|
|
236
|
+
"graphql-upload": "17.0.0",
|
|
236
237
|
"graphql-ws": "6.0.5",
|
|
237
238
|
"i18next": "25.3.0",
|
|
238
239
|
"jsdom": "26.1.0",
|
|
@@ -275,6 +276,7 @@
|
|
|
275
276
|
"@types/express-session": "1.18.2",
|
|
276
277
|
"@types/express-useragent": "1.0.5",
|
|
277
278
|
"@types/fs-extra": "11.0.4",
|
|
279
|
+
"@types/graphql-upload": "17.0.0",
|
|
278
280
|
"@types/migrate-mongo": "10.0.5",
|
|
279
281
|
"@types/node": "24.0.7",
|
|
280
282
|
"@types/node-persist": "3.1.8",
|