@cyberskill/shared 1.206.0 → 1.208.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.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=`
|
|
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.207.0",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.
|
|
28
|
+
const A = "@cyberskill/shared", H = "module", U = "1.207.0", 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
|
|
1
|
+
"use strict";var j=Object.defineProperty;var w=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var L=(t,e,n)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,U=(t,e)=>{for(var n in e||(e={}))R.call(e,n)&&L(t,n,e[n]);if(w)for(var n of w(e))x.call(e,n)&&L(t,n,e[n]);return t};var h=(t,e,n)=>L(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@apollo/client/core/core.cjs"),f=require("@apollo/client/link/core/core.cjs"),G=require("@apollo/client/link/error/error.cjs"),P=require("@apollo/client/link/remove-typename/remove-typename.cjs"),S=require("@apollo/client/link/subscriptions/subscriptions.cjs"),I=require("@apollo/client/utilities/utilities.cjs"),F=require("apollo-upload-client/createUploadLink.mjs"),H=require("graphql-ws"),q=require("react"),M=require("../apollo-error/apollo-error.util.cjs"),c=require("../log/log.util.cjs"),T=require("react-hot-toast"),v=require("./apollo-client.constant.cjs");class C extends f.ApolloLink{constructor(){super(...arguments);h(this,"count",0)}request(n,r){const g=Date.now();return this.count+=1,r(n).map(d=>{const p=Date.now()-g,a=n.operationName||"Unnamed";return c.log.info(`[Apollo] #${this.count}: ${a} (${p}ms)`),d})}}function D(t){const{uri:e,wsUrl:n,customLinks:r}=t,g=new C,d=G.onError(({graphQLErrors:o,networkError:i,protocolErrors:s,operation:m})=>{var y,$;const N=(m==null?void 0:m.operationName)||"Unknown";if(o&&o.forEach(({message:l,locations:u,path:_})=>{c.log.error(`[GraphQL error] ${N}: ${l}, Location: ${JSON.stringify(u,null,4)}, Path: ${_}`)}),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=((y=o==null?void 0:o[0])==null?void 0:y.message)||(($=s==null?void 0:s[0])==null?void 0:$.message)||(i==null?void 0:i.message)||"Unexpected error",u=new k.ApolloError({graphQLErrors:o||[],protocolErrors:s||[],clientErrors:[],networkError:i||null,errorMessage:l,extraInfo:{operation:m}});typeof window!="undefined"&&T.toast.error(_=>q.createElement(q.Fragment,null,l," ",q.createElement("button",{type:"button",className:"text-blue-500 hover:text-blue-700",onClick:()=>{setTimeout(()=>{M.showGlobalApolloError(u)},0),T.toast.dismiss(_.id)}},"Show Details")))}}),p=P.removeTypenameFromVariables();e||c.log.warn(`[Apollo] No GraphQL URI provided — using "${v.GRAPHQL_URI_DEFAULT}" as default`);const a=F({uri:e!=null?e:v.GRAPHQL_URI_DEFAULT,credentials:"include",headers:{"apollo-require-preflight":"true"}}),A=n?new S.GraphQLWsLink(H.createClient({url:n})):f.ApolloLink.empty(),b=A instanceof f.ApolloLink?f.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,d,p,...r!=null?r:[],b]}function O(t={}){const e=f.from(D(t));return new k.ApolloClient(U({link:e,cache:new k.InMemoryCache},t))}exports.DevLoggerLink=C;exports.createApolloLinks=D;exports.getClient=O;
|
|
@@ -1,122 +1,116 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var y = Object.getOwnPropertySymbols;
|
|
3
|
+
var T = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var g = (t, e, n) => e in t ? C(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, U = (t, e) => {
|
|
5
5
|
for (var n in e || (e = {}))
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
for (var n of
|
|
9
|
-
|
|
6
|
+
T.call(e, n) && g(t, n, e[n]);
|
|
7
|
+
if (y)
|
|
8
|
+
for (var n of y(e))
|
|
9
|
+
G.call(e, n) && g(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 {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import { showGlobalApolloError as j } from "../apollo-error/apollo-error.util.js";
|
|
12
|
+
var N = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n);
|
|
13
|
+
import { ApolloError as R, ApolloClient as I, InMemoryCache as P } from "@apollo/client/core/core.cjs";
|
|
14
|
+
import { ApolloLink as w, split as S, from as _ } from "@apollo/client/link/core/core.cjs";
|
|
15
|
+
import { onError as F } from "@apollo/client/link/error/error.cjs";
|
|
16
|
+
import { removeTypenameFromVariables as M } from "@apollo/client/link/remove-typename/remove-typename.cjs";
|
|
17
|
+
import { GraphQLWsLink as O } from "@apollo/client/link/subscriptions/subscriptions.cjs";
|
|
18
|
+
import { getMainDefinition as q } from "@apollo/client/utilities/utilities.cjs";
|
|
19
|
+
import H from "apollo-upload-client/createUploadLink.mjs";
|
|
20
|
+
import { createClient as J } from "graphql-ws";
|
|
21
|
+
import k from "react";
|
|
22
|
+
import { showGlobalApolloError as W } from "../apollo-error/apollo-error.util.js";
|
|
24
23
|
import { log as s } from "../log/log.util.js";
|
|
25
|
-
import { toast as
|
|
26
|
-
import { GRAPHQL_URI_DEFAULT as
|
|
27
|
-
class
|
|
24
|
+
import { toast as x } from "react-hot-toast";
|
|
25
|
+
import { GRAPHQL_URI_DEFAULT as D } from "./apollo-client.constant.js";
|
|
26
|
+
class V extends w {
|
|
28
27
|
constructor() {
|
|
29
28
|
super(...arguments);
|
|
30
|
-
|
|
29
|
+
N(this, "count", 0);
|
|
31
30
|
}
|
|
32
31
|
request(n, a) {
|
|
33
|
-
const
|
|
34
|
-
return this.count += 1, a(n).map((
|
|
35
|
-
const
|
|
36
|
-
return s.info(`[Apollo] #${this.count}: ${
|
|
32
|
+
const u = Date.now();
|
|
33
|
+
return this.count += 1, a(n).map((p) => {
|
|
34
|
+
const d = Date.now() - u, f = n.operationName || "Unnamed";
|
|
35
|
+
return s.info(`[Apollo] #${this.count}: ${f} (${d}ms)`), p;
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
function
|
|
41
|
-
const { uri: e, wsUrl: n, customLinks: a } = t,
|
|
42
|
-
var
|
|
43
|
-
const
|
|
44
|
-
if (o && o.forEach(({ message: m, locations: c, path:
|
|
39
|
+
function j(t) {
|
|
40
|
+
const { uri: e, wsUrl: n, customLinks: a } = t, u = new V(), p = F(({ graphQLErrors: o, networkError: i, protocolErrors: l, operation: r }) => {
|
|
41
|
+
var A, h;
|
|
42
|
+
const v = (r == null ? void 0 : r.operationName) || "Unknown";
|
|
43
|
+
if (o && o.forEach(({ message: m, locations: c, path: L }) => {
|
|
45
44
|
s.error(
|
|
46
|
-
`[GraphQL error] ${
|
|
45
|
+
`[GraphQL error] ${v}: ${m}, Location: ${JSON.stringify(c, null, 4)}, Path: ${L}`
|
|
47
46
|
);
|
|
48
47
|
}), l && l.forEach(({ message: m, extensions: c }) => {
|
|
49
48
|
s.error(
|
|
50
49
|
`[Protocol error]: ${m}, Extensions: ${JSON.stringify(c, null, 4)}`
|
|
51
50
|
);
|
|
52
51
|
}), i && s.error(`[Network error]: ${i}`), o || l || i) {
|
|
53
|
-
const m = ((
|
|
52
|
+
const m = ((A = o == null ? void 0 : o[0]) == null ? void 0 : A.message) || ((h = l == null ? void 0 : l[0]) == null ? void 0 : h.message) || (i == null ? void 0 : i.message) || "Unexpected error", c = new R({
|
|
54
53
|
graphQLErrors: o || [],
|
|
55
54
|
protocolErrors: l || [],
|
|
56
55
|
clientErrors: [],
|
|
57
56
|
networkError: i || null,
|
|
58
57
|
errorMessage: m,
|
|
59
58
|
extraInfo: {
|
|
60
|
-
operation:
|
|
59
|
+
operation: r
|
|
61
60
|
}
|
|
62
61
|
});
|
|
63
|
-
typeof window != "undefined" &&
|
|
62
|
+
typeof window != "undefined" && x.error((L) => /* @__PURE__ */ k.createElement(k.Fragment, null, m, " ", /* @__PURE__ */ k.createElement(
|
|
64
63
|
"button",
|
|
65
64
|
{
|
|
66
65
|
type: "button",
|
|
67
66
|
className: "text-blue-500 hover:text-blue-700",
|
|
68
67
|
onClick: () => {
|
|
69
68
|
setTimeout(() => {
|
|
70
|
-
|
|
71
|
-
}, 0),
|
|
69
|
+
W(c);
|
|
70
|
+
}, 0), x.dismiss(L.id);
|
|
72
71
|
}
|
|
73
72
|
},
|
|
74
73
|
"Show Details"
|
|
75
74
|
)));
|
|
76
75
|
}
|
|
77
|
-
}),
|
|
78
|
-
e || s.warn(`[Apollo] No GraphQL URI provided — using "${
|
|
79
|
-
const
|
|
80
|
-
uri: e != null ? e :
|
|
76
|
+
}), d = M();
|
|
77
|
+
e || s.warn(`[Apollo] No GraphQL URI provided — using "${D}" as default`);
|
|
78
|
+
const f = H({
|
|
79
|
+
uri: e != null ? e : D,
|
|
81
80
|
credentials: "include",
|
|
82
81
|
headers: {
|
|
83
82
|
"apollo-require-preflight": "true"
|
|
84
83
|
}
|
|
85
|
-
}),
|
|
86
|
-
uri: e != null ? e : $,
|
|
87
|
-
credentials: "include"
|
|
88
|
-
}), h = n ? new q(V({ url: n })) : b.empty(), A = h instanceof b ? _(
|
|
84
|
+
}), $ = n ? new O(J({ url: n })) : w.empty(), b = $ instanceof w ? S(
|
|
89
85
|
({ query: o }) => {
|
|
90
|
-
const i =
|
|
86
|
+
const i = q(o);
|
|
91
87
|
return i.kind === "OperationDefinition" && i.operation === "subscription";
|
|
92
88
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
) :
|
|
96
|
-
return
|
|
97
|
-
r,
|
|
98
|
-
// 🪵 custom logger
|
|
89
|
+
$,
|
|
90
|
+
f
|
|
91
|
+
) : f;
|
|
92
|
+
return b === f && n && s.warn("[Apollo] WS URL is set, but subscriptions fallback to HTTP. Check your wsLink config."), [
|
|
99
93
|
u,
|
|
100
|
-
//
|
|
94
|
+
// 🪵 custom logger
|
|
101
95
|
p,
|
|
102
|
-
//
|
|
96
|
+
// ⚠️ Apollo's error handling
|
|
103
97
|
d,
|
|
104
|
-
//
|
|
98
|
+
// 🧼 cleans up __typename
|
|
105
99
|
...a != null ? a : [],
|
|
106
100
|
// 🔗 custom links
|
|
107
|
-
|
|
108
|
-
// 📡 HTTP vs WS routing
|
|
101
|
+
b
|
|
102
|
+
// 📡 HTTP vs WS routing (includes uploadLink)
|
|
109
103
|
];
|
|
110
104
|
}
|
|
111
|
-
function
|
|
112
|
-
const e =
|
|
113
|
-
return new
|
|
105
|
+
function me(t = {}) {
|
|
106
|
+
const e = _(j(t));
|
|
107
|
+
return new I(U({
|
|
114
108
|
link: e,
|
|
115
|
-
cache: new
|
|
109
|
+
cache: new P()
|
|
116
110
|
}, t));
|
|
117
111
|
}
|
|
118
112
|
export {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
V as DevLoggerLink,
|
|
114
|
+
j as createApolloLinks,
|
|
115
|
+
me as getClient
|
|
122
116
|
};
|