@cyberskill/shared 1.205.3 → 1.206.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.
|
@@ -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-CWtb99gS.cjs"),r=require("../fs/fs.util.cjs"),u=require("../../../log.type-CMvG6Box.cjs"),c=require("../log/log.util.cjs");require("../path/path.util.cjs");const C="@cyberskill/shared",v="module",E="1.205.2",S="CyberSkill Shared",_="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.2","@apollo/client":"3.13.8","@apollo/client-integration-nextjs":"0.12.2","@apollo/server":"4.12.2","@dotenvx/dotenvx":"1.45.2","@eddeee888/gcg-typescript-resolver-files":"0.12.1","@eslint-react/eslint-plugin":"1.52.2","@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","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.3.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.4","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.1",ws:"8.18.3",yargs:"18.0.0"},R={"@commitlint/cli":"19.8.1","@commitlint/config-conventional":"19.8.1","@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.10","@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.1","eslint-config-next":"15.3.4",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.1","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:S,author:_,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&&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-CWtb99gS.cjs"),r=require("../fs/fs.util.cjs"),u=require("../../../log.type-CMvG6Box.cjs"),c=require("../log/log.util.cjs");require("../path/path.util.cjs");const C="@cyberskill/shared",v="module",E="1.205.3",S="CyberSkill Shared",_="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.2","@apollo/client":"3.13.8","@apollo/client-integration-nextjs":"0.12.2","@apollo/server":"4.12.2","@dotenvx/dotenvx":"1.45.2","@eddeee888/gcg-typescript-resolver-files":"0.12.1","@eslint-react/eslint-plugin":"1.52.2","@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","apollo-upload-client":"18.0.1","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","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.3.0",graphql:"16.11.0","graphql-upload":"17.0.0","graphql-ws":"6.0.5",i18next:"25.3.1",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.4","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.6.0",slugify:"1.6.6",unorm:"1.6.0",uuid:"11.1.0",vite:"7.0.2",ws:"8.18.3",yargs:"18.0.0"},R={"@commitlint/cli":"19.8.1","@commitlint/config-conventional":"19.8.1","@eslint/config-inspector":"1.1.0","@microsoft/api-extractor":"7.52.8","@next/eslint-plugin-next":"15.3.5","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@types/apollo-upload-client":"18.0.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.10","@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.1","eslint-config-next":"15.3.5",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.2","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:S,author:_,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&&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
|
|
@@ -25,7 +25,7 @@ import { E as h } from "../../../log.type-DTOvZHyz.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.205.
|
|
28
|
+
const A = "@cyberskill/shared", H = "module", U = "1.205.3", K = "CyberSkill Shared", Y = "Stephen Cheng", J = "MIT", V = "https://github.com/cyberskill-world/shared#readme", W = { type: "git", url: "git+https://github.com/cyberskill-world/shared.git" }, $ = { 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" } }, Z = { cyberskill: "dist/src/node/cli/index.js" }, Q = ["dist", "public"], X = { 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.2", "@apollo/client": "3.13.8", "@apollo/client-integration-nextjs": "0.12.2", "@apollo/server": "4.12.2", "@dotenvx/dotenvx": "1.45.2", "@eddeee888/gcg-typescript-resolver-files": "0.12.1", "@eslint-react/eslint-plugin": "1.52.2", "@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", "apollo-upload-client": "18.0.1", "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", "eslint-plugin-format": "1.0.1", "eslint-plugin-react-hooks": "5.2.0", "eslint-plugin-react-refresh": "0.4.20", express: "4.21.2", "express-session": "1.18.1", "express-useragent": "1.0.15", "fs-extra": "11.3.0", globals: "16.3.0", graphql: "16.11.0", "graphql-upload": "17.0.0", "graphql-ws": "6.0.5", i18next: "25.3.1", 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.4", "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.6.0", slugify: "1.6.6", unorm: "1.6.0", uuid: "11.1.0", vite: "7.0.2", ws: "8.18.3", yargs: "18.0.0" }, te = { "@commitlint/cli": "19.8.1", "@commitlint/config-conventional": "19.8.1", "@eslint/config-inspector": "1.1.0", "@microsoft/api-extractor": "7.52.8", "@next/eslint-plugin-next": "15.3.5", "@testing-library/jest-dom": "6.6.3", "@testing-library/react": "16.3.0", "@types/apollo-upload-client": "18.0.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.10", "@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.1", "eslint-config-next": "15.3.5", 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.2", "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,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var N=Object.defineProperty;var $=Object.getOwnPropertySymbols;var
|
|
1
|
+
"use strict";var N=Object.defineProperty;var $=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var k=(t,e,n)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,T=(t,e)=>{for(var n in e||(e={}))G.call(e,n)&&k(t,n,e[n]);if($)for(var n of $(e))P.call(e,n)&&k(t,n,e[n]);return t};var D=(t,e,n)=>k(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("@apollo/client/core/core.cjs"),u=require("@apollo/client/link/core/core.cjs"),x=require("@apollo/client/link/error/error.cjs"),H=require("@apollo/client/link/http/http.cjs"),I=require("@apollo/client/link/remove-typename/remove-typename.cjs"),S=require("@apollo/client/link/subscriptions/subscriptions.cjs"),F=require("@apollo/client/utilities/utilities.cjs"),M=require("apollo-upload-client/createUploadLink.mjs"),O=require("graphql-ws"),q=require("react"),W=require("../apollo-error/apollo-error.util.cjs"),c=require("../log/log.util.cjs"),v=require("react-hot-toast"),A=require("./apollo-client.constant.cjs");class C extends u.ApolloLink{constructor(){super(...arguments);D(this,"count",0)}request(n,r){const m=Date.now();return this.count+=1,r(n).map(p=>{const _=Date.now()-m,d=n.operationName||"Unnamed";return c.log.info(`[Apollo] #${this.count}: ${d} (${_}ms)`),p})}}function R(t){const{uri:e,wsUrl:n,customLinks:r}=t,m=new C,p=x.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:a,path:L})=>{c.log.error(`[GraphQL error] ${j}: ${l}, Location: ${JSON.stringify(a,null,4)}, Path: ${L}`)}),s&&s.forEach(({message:l,extensions:a})=>{c.log.error(`[Protocol error]: ${l}, Extensions: ${JSON.stringify(a,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",a=new b.ApolloError({graphQLErrors:o||[],protocolErrors:s||[],clientErrors:[],networkError:i||null,errorMessage:l,extraInfo:{operation:f}});typeof window!="undefined"&&v.toast.error(L=>q.createElement(q.Fragment,null,l," ",q.createElement("button",{type:"button",className:"text-blue-500 hover:text-blue-700",onClick:()=>{setTimeout(()=>{W.showGlobalApolloError(a)},0),v.toast.dismiss(L.id)}},"Show Details")))}}),_=I.removeTypenameFromVariables();e||c.log.warn(`[Apollo] No GraphQL URI provided — using "${A.GRAPHQL_URI_DEFAULT}" as default`);const d=M({uri:e!=null?e:A.GRAPHQL_URI_DEFAULT,credentials:"include",headers:{"apollo-require-preflight":"true"}}),g=new H.HttpLink({uri:e!=null?e:A.GRAPHQL_URI_DEFAULT,credentials:"include"}),U=n?new S.GraphQLWsLink(O.createClient({url:n})):u.ApolloLink.empty(),h=U instanceof u.ApolloLink?u.split(({query:o})=>{const i=F.getMainDefinition(o);return i.kind==="OperationDefinition"&&i.operation==="subscription"},U,g):g;return h===g&&n&&c.log.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."),[m,p,_,d,...r!=null?r:[],h]}function J(t={}){const e=u.from(R(t));return new b.ApolloClient(T({link:e,cache:new b.InMemoryCache},t))}exports.DevLoggerLink=C;exports.createApolloLinks=R;exports.getClient=J;
|
|
@@ -1,113 +1,122 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var w = (t, e, n) => e in t ?
|
|
1
|
+
var T = Object.defineProperty;
|
|
2
|
+
var N = Object.getOwnPropertySymbols;
|
|
3
|
+
var G = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var w = (t, e, n) => e in t ? T(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, x = (t, e) => {
|
|
5
5
|
for (var n in e || (e = {}))
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var n of
|
|
9
|
-
|
|
6
|
+
G.call(e, n) && w(t, n, e[n]);
|
|
7
|
+
if (N)
|
|
8
|
+
for (var n of N(e))
|
|
9
|
+
R.call(e, n) && w(t, n, e[n]);
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
import { ApolloError as
|
|
14
|
-
import { ApolloLink as
|
|
15
|
-
import { onError as
|
|
16
|
-
import { HttpLink as
|
|
17
|
-
import { removeTypenameFromVariables as
|
|
18
|
-
import { GraphQLWsLink as
|
|
12
|
+
var D = (t, e, n) => w(t, typeof e != "symbol" ? e + "" : e, n);
|
|
13
|
+
import { ApolloError as I, ApolloClient as P, InMemoryCache as S } from "@apollo/client/core/core.cjs";
|
|
14
|
+
import { ApolloLink as b, split as _, from as F } from "@apollo/client/link/core/core.cjs";
|
|
15
|
+
import { onError as H } from "@apollo/client/link/error/error.cjs";
|
|
16
|
+
import { HttpLink as M } from "@apollo/client/link/http/http.cjs";
|
|
17
|
+
import { removeTypenameFromVariables as O } from "@apollo/client/link/remove-typename/remove-typename.cjs";
|
|
18
|
+
import { GraphQLWsLink as q } from "@apollo/client/link/subscriptions/subscriptions.cjs";
|
|
19
19
|
import { getMainDefinition as J } from "@apollo/client/utilities/utilities.cjs";
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
|
|
20
|
+
import W from "apollo-upload-client/createUploadLink.mjs";
|
|
21
|
+
import { createClient as V } from "graphql-ws";
|
|
22
|
+
import g from "react";
|
|
23
|
+
import { showGlobalApolloError as j } from "../apollo-error/apollo-error.util.js";
|
|
24
|
+
import { log as s } from "../log/log.util.js";
|
|
25
|
+
import { toast as v } from "react-hot-toast";
|
|
26
|
+
import { GRAPHQL_URI_DEFAULT as $ } from "./apollo-client.constant.js";
|
|
27
|
+
class z extends b {
|
|
27
28
|
constructor() {
|
|
28
29
|
super(...arguments);
|
|
29
|
-
|
|
30
|
+
D(this, "count", 0);
|
|
30
31
|
}
|
|
31
32
|
request(n, a) {
|
|
32
|
-
const
|
|
33
|
-
return this.count += 1, a(n).map((
|
|
34
|
-
const
|
|
35
|
-
return
|
|
33
|
+
const r = Date.now();
|
|
34
|
+
return this.count += 1, a(n).map((u) => {
|
|
35
|
+
const p = Date.now() - r, d = n.operationName || "Unnamed";
|
|
36
|
+
return s.info(`[Apollo] #${this.count}: ${d} (${p}ms)`), u;
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
const { uri: e, wsUrl: n, customLinks: a } = t,
|
|
41
|
-
var
|
|
42
|
-
const
|
|
43
|
-
if (o && o.forEach(({ message:
|
|
44
|
-
|
|
45
|
-
`[GraphQL error] ${
|
|
40
|
+
function B(t) {
|
|
41
|
+
const { uri: e, wsUrl: n, customLinks: a } = t, r = new z(), u = H(({ graphQLErrors: o, networkError: i, protocolErrors: l, operation: f }) => {
|
|
42
|
+
var y, U;
|
|
43
|
+
const C = (f == null ? void 0 : f.operationName) || "Unknown";
|
|
44
|
+
if (o && o.forEach(({ message: m, locations: c, path: k }) => {
|
|
45
|
+
s.error(
|
|
46
|
+
`[GraphQL error] ${C}: ${m}, Location: ${JSON.stringify(c, null, 4)}, Path: ${k}`
|
|
46
47
|
);
|
|
47
|
-
}),
|
|
48
|
-
|
|
49
|
-
`[Protocol error]: ${
|
|
48
|
+
}), l && l.forEach(({ message: m, extensions: c }) => {
|
|
49
|
+
s.error(
|
|
50
|
+
`[Protocol error]: ${m}, Extensions: ${JSON.stringify(c, null, 4)}`
|
|
50
51
|
);
|
|
51
|
-
}), i &&
|
|
52
|
-
const
|
|
52
|
+
}), i && s.error(`[Network error]: ${i}`), o || l || i) {
|
|
53
|
+
const m = ((y = o == null ? void 0 : o[0]) == null ? void 0 : y.message) || ((U = l == null ? void 0 : l[0]) == null ? void 0 : U.message) || (i == null ? void 0 : i.message) || "Unexpected error", c = new I({
|
|
53
54
|
graphQLErrors: o || [],
|
|
54
|
-
protocolErrors:
|
|
55
|
+
protocolErrors: l || [],
|
|
55
56
|
clientErrors: [],
|
|
56
57
|
networkError: i || null,
|
|
57
|
-
errorMessage:
|
|
58
|
+
errorMessage: m,
|
|
58
59
|
extraInfo: {
|
|
59
|
-
operation:
|
|
60
|
+
operation: f
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
|
-
typeof window != "undefined" &&
|
|
63
|
+
typeof window != "undefined" && v.error((k) => /* @__PURE__ */ g.createElement(g.Fragment, null, m, " ", /* @__PURE__ */ g.createElement(
|
|
63
64
|
"button",
|
|
64
65
|
{
|
|
65
66
|
type: "button",
|
|
66
67
|
className: "text-blue-500 hover:text-blue-700",
|
|
67
68
|
onClick: () => {
|
|
68
69
|
setTimeout(() => {
|
|
69
|
-
|
|
70
|
-
}, 0),
|
|
70
|
+
j(c);
|
|
71
|
+
}, 0), v.dismiss(k.id);
|
|
71
72
|
}
|
|
72
73
|
},
|
|
73
74
|
"Show Details"
|
|
74
75
|
)));
|
|
75
76
|
}
|
|
76
|
-
}),
|
|
77
|
-
e ||
|
|
78
|
-
const
|
|
79
|
-
uri: e != null ? e :
|
|
77
|
+
}), p = O();
|
|
78
|
+
e || s.warn(`[Apollo] No GraphQL URI provided — using "${$}" as default`);
|
|
79
|
+
const d = W({
|
|
80
|
+
uri: e != null ? e : $,
|
|
81
|
+
credentials: "include",
|
|
82
|
+
headers: {
|
|
83
|
+
"apollo-require-preflight": "true"
|
|
84
|
+
}
|
|
85
|
+
}), L = new M({
|
|
86
|
+
uri: e != null ? e : $,
|
|
80
87
|
credentials: "include"
|
|
81
|
-
}),
|
|
88
|
+
}), h = n ? new q(V({ url: n })) : b.empty(), A = h instanceof b ? _(
|
|
82
89
|
({ query: o }) => {
|
|
83
90
|
const i = J(o);
|
|
84
91
|
return i.kind === "OperationDefinition" && i.operation === "subscription";
|
|
85
92
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
) :
|
|
89
|
-
return
|
|
90
|
-
|
|
93
|
+
h,
|
|
94
|
+
L
|
|
95
|
+
) : L;
|
|
96
|
+
return A === L && n && s.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."), [
|
|
97
|
+
r,
|
|
91
98
|
// 🪵 custom logger
|
|
92
|
-
|
|
99
|
+
u,
|
|
93
100
|
// ⚠️ Apollo's error handling
|
|
94
|
-
|
|
101
|
+
p,
|
|
95
102
|
// 🧼 cleans up __typename
|
|
103
|
+
d,
|
|
104
|
+
// 📤 file uploads
|
|
96
105
|
...a != null ? a : [],
|
|
97
106
|
// 🔗 custom links
|
|
98
|
-
|
|
107
|
+
A
|
|
99
108
|
// 📡 HTTP vs WS routing
|
|
100
109
|
];
|
|
101
110
|
}
|
|
102
|
-
function
|
|
103
|
-
const e =
|
|
104
|
-
return new
|
|
111
|
+
function ce(t = {}) {
|
|
112
|
+
const e = F(B(t));
|
|
113
|
+
return new P(x({
|
|
105
114
|
link: e,
|
|
106
|
-
cache: new
|
|
115
|
+
cache: new S()
|
|
107
116
|
}, t));
|
|
108
117
|
}
|
|
109
118
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
119
|
+
z as DevLoggerLink,
|
|
120
|
+
B as createApolloLinks,
|
|
121
|
+
ce as getClient
|
|
113
122
|
};
|
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.206.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -218,6 +218,7 @@
|
|
|
218
218
|
"@nestjs/core": "11.1.3",
|
|
219
219
|
"@userback/widget": "0.3.11",
|
|
220
220
|
"@vitejs/plugin-react-swc": "3.10.2",
|
|
221
|
+
"apollo-upload-client": "18.0.1",
|
|
221
222
|
"body-parser": "2.2.0",
|
|
222
223
|
"chalk": "5.4.1",
|
|
223
224
|
"clsx": "2.1.1",
|
|
@@ -239,7 +240,7 @@
|
|
|
239
240
|
"graphql": "16.11.0",
|
|
240
241
|
"graphql-upload": "17.0.0",
|
|
241
242
|
"graphql-ws": "6.0.5",
|
|
242
|
-
"i18next": "25.3.
|
|
243
|
+
"i18next": "25.3.1",
|
|
243
244
|
"jsdom": "26.1.0",
|
|
244
245
|
"localforage": "1.10.0",
|
|
245
246
|
"migrate-mongo": "12.1.3",
|
|
@@ -254,11 +255,11 @@
|
|
|
254
255
|
"react": "19.1.0",
|
|
255
256
|
"react-dom": "19.1.0",
|
|
256
257
|
"react-hot-toast": "2.5.2",
|
|
257
|
-
"react-i18next": "15.
|
|
258
|
+
"react-i18next": "15.6.0",
|
|
258
259
|
"slugify": "1.6.6",
|
|
259
260
|
"unorm": "1.6.0",
|
|
260
261
|
"uuid": "11.1.0",
|
|
261
|
-
"vite": "7.0.
|
|
262
|
+
"vite": "7.0.2",
|
|
262
263
|
"ws": "8.18.3",
|
|
263
264
|
"yargs": "18.0.0"
|
|
264
265
|
},
|
|
@@ -267,9 +268,10 @@
|
|
|
267
268
|
"@commitlint/config-conventional": "19.8.1",
|
|
268
269
|
"@eslint/config-inspector": "1.1.0",
|
|
269
270
|
"@microsoft/api-extractor": "7.52.8",
|
|
270
|
-
"@next/eslint-plugin-next": "15.3.
|
|
271
|
+
"@next/eslint-plugin-next": "15.3.5",
|
|
271
272
|
"@testing-library/jest-dom": "6.6.3",
|
|
272
273
|
"@testing-library/react": "16.3.0",
|
|
274
|
+
"@types/apollo-upload-client": "18.0.0",
|
|
273
275
|
"@types/body-parser": "1.19.6",
|
|
274
276
|
"@types/compression": "1.8.1",
|
|
275
277
|
"@types/cookie-parser": "1.4.9",
|
|
@@ -291,7 +293,7 @@
|
|
|
291
293
|
"@types/yargs": "17.0.33",
|
|
292
294
|
"@vitest/browser": "3.2.4",
|
|
293
295
|
"eslint": "9.30.1",
|
|
294
|
-
"eslint-config-next": "15.3.
|
|
296
|
+
"eslint-config-next": "15.3.5",
|
|
295
297
|
"glob": "11.0.3",
|
|
296
298
|
"lint-staged": "16.1.2",
|
|
297
299
|
"node-modules-inspector": "1.0.0",
|
|
@@ -299,7 +301,7 @@
|
|
|
299
301
|
"simple-git-hooks": "2.13.0",
|
|
300
302
|
"tsx": "4.20.3",
|
|
301
303
|
"typescript": "5.8.3",
|
|
302
|
-
"vite": "7.0.
|
|
304
|
+
"vite": "7.0.2",
|
|
303
305
|
"vite-plugin-dts": "4.5.4",
|
|
304
306
|
"vitest": "3.2.4"
|
|
305
307
|
},
|