@cyberskill/shared 1.216.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +330 -222
- package/dist/config/config.util.d.ts +17 -0
- package/dist/config/env/env.util.d.ts +26 -0
- package/dist/config/eslint/index.d.ts +4 -0
- package/dist/config/graphql-codegen/graphql-codegen.util.cjs +1 -1
- package/dist/config/graphql-codegen/graphql-codegen.util.d.ts +23 -0
- package/dist/config/graphql-codegen/graphql-codegen.util.js +2 -1
- package/dist/config/vitest/vitest.e2e.cjs +1 -1
- package/dist/config/vitest/vitest.e2e.d.ts +16 -0
- package/dist/config/vitest/vitest.e2e.js +1 -1
- package/dist/config/vitest/vitest.unit.cjs +1 -1
- package/dist/config/vitest/vitest.unit.d.ts +18 -0
- package/dist/config/vitest/vitest.unit.js +1 -1
- package/dist/constant/common.d.ts +4 -0
- package/dist/constant/index.d.ts +3 -0
- package/dist/node/apollo-server/apollo-server.util.d.ts +15 -1
- package/dist/node/apollo-server/index.cjs +1 -1
- package/dist/node/apollo-server/index.js +1 -1
- package/dist/node/command/command.type.d.ts +26 -6
- package/dist/node/command/command.util.d.ts +50 -0
- package/dist/node/express/express.util.cjs +1 -1
- package/dist/node/express/express.util.d.ts +47 -0
- package/dist/node/express/express.util.js +9 -9
- package/dist/node/fs/fs.type.d.ts +6 -0
- package/dist/node/fs/fs.util.d.ts +48 -1
- package/dist/node/log/log.type.d.ts +6 -1
- package/dist/node/log/log.util.cjs +1 -1
- package/dist/node/log/log.util.d.ts +30 -2
- package/dist/node/log/log.util.js +33 -20
- package/dist/node/mongo/mongo.constant.d.ts +5 -0
- package/dist/node/mongo/mongo.type.d.ts +4 -4
- package/dist/node/mongo/mongo.util.cjs +5 -5
- package/dist/node/mongo/mongo.util.d.ts +337 -3
- package/dist/node/mongo/mongo.util.js +406 -79
- package/dist/node/package/package.type.d.ts +2 -2
- package/dist/node/package/package.util.cjs +1 -1
- package/dist/node/package/package.util.d.ts +52 -1
- package/dist/node/package/package.util.js +97 -92
- package/dist/node/path/path.constant.d.ts +9 -0
- package/dist/node/path/path.util.d.ts +24 -0
- package/dist/node/storage/storage.util.d.ts +44 -0
- package/dist/node/storage/storage.util.js +39 -0
- package/dist/node/upload/upload.util.d.ts +21 -0
- package/dist/node/ws/ts.util.d.ts +16 -0
- package/dist/react/apollo-client/apollo-client.component.d.ts +19 -1
- package/dist/react/apollo-client/apollo-client.component.js +1 -4
- package/dist/react/apollo-client/apollo-client.constant.d.ts +5 -0
- package/dist/react/apollo-client/apollo-client.context.d.ts +15 -0
- package/dist/react/apollo-client/apollo-client.hook.d.ts +12 -0
- package/dist/react/apollo-client/apollo-client.util.d.ts +48 -0
- package/dist/react/apollo-client/apollo-client.util.js +9 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +19 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js +1 -4
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts +10 -0
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.d.ts +10 -0
- package/dist/react/apollo-error/apollo-error.component.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.component.d.ts +17 -0
- package/dist/react/apollo-error/apollo-error.component.js +10 -10
- package/dist/react/apollo-error/apollo-error.hook.d.ts +12 -0
- package/dist/react/apollo-error/apollo-error.provider.d.ts +15 -0
- package/dist/react/apollo-error/apollo-error.util.d.ts +17 -0
- package/dist/react/i18next/i18next.hook.d.ts +9 -0
- package/dist/react/i18next/i18next.util.d.ts +10 -0
- package/dist/react/loading/loading.component.d.ts +21 -0
- package/dist/react/loading/loading.hook.d.ts +12 -0
- package/dist/react/loading/loading.provider.d.ts +15 -0
- package/dist/react/log/log.util.d.ts +17 -0
- package/dist/react/next-intl/next-intl.constant.d.ts +9 -0
- package/dist/react/next-intl/next-intl.hoc.d.ts +16 -0
- package/dist/react/next-intl/next-intl.hook.d.ts +21 -0
- package/dist/react/next-intl/next-intl.provider.d.ts +21 -0
- package/dist/react/storage/storage.hook.d.ts +19 -0
- package/dist/react/storage/storage.hook.js +28 -30
- package/dist/react/storage/storage.util.d.ts +39 -0
- package/dist/react/storage/storage.util.js +33 -0
- package/dist/react/userback/userback.component.d.ts +18 -0
- package/dist/typescript/common.type.d.ts +6 -0
- package/dist/typescript/index.d.ts +3 -0
- package/dist/util/common/common.util.d.ts +19 -7
- package/dist/util/common/index.d.ts +3 -0
- package/dist/util/index.d.ts +3 -0
- package/dist/util/object/object.util.d.ts +25 -12
- package/dist/util/serializer/serializer.type.d.ts +1 -1
- package/dist/util/serializer/serializer.util.d.ts +8 -0
- package/dist/util/serializer/serializer.util.js +4 -4
- package/dist/util/string/string.util.cjs +1 -1
- package/dist/util/string/string.util.d.ts +30 -17
- package/dist/util/string/string.util.js +14 -16
- package/dist/util/validate/validate.util.d.ts +9 -3
- package/dist/util/validate/validate.util.js +5 -3
- package/package.json +21 -18
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.13_@vitest_browser@3.2.4_jiti@2.4.2_j_cac3da623d5688a51c0b1a2270e144db → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.15_@vitest_browser@3.2.4_jiti@2.4.2_j_e4a333d8aa4b05d17db10875e249d94f}/node_modules/vitest/dist/config.cjs +0 -0
- /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.13_@vitest_browser@3.2.4_jiti@2.4.2_j_cac3da623d5688a51c0b1a2270e144db → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.15_@vitest_browser@3.2.4_jiti@2.4.2_j_e4a333d8aa4b05d17db10875e249d94f}/node_modules/vitest/dist/config.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface I_PackageJson {
|
|
2
2
|
name?: string;
|
|
3
3
|
version?: string;
|
|
4
4
|
dependencies?: Record<string, string>;
|
|
@@ -15,7 +15,7 @@ export interface I_PackageInfo {
|
|
|
15
15
|
isDependency: boolean;
|
|
16
16
|
isDevDependency: boolean;
|
|
17
17
|
installedPath: string;
|
|
18
|
-
file:
|
|
18
|
+
file: I_PackageJson;
|
|
19
19
|
}
|
|
20
20
|
export declare enum E_PackageType {
|
|
21
21
|
DEPENDENCY = "dependencies",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-fetch"),m=require("./package.type.cjs"),d=require("../fs/fs.util.cjs"),l=require("../path/path.constant.cjs"),J=require("../path/path.util.cjs"),c=require("../log/log.util.cjs"),h=require("../command/command.util.cjs"),j=require("../../config/env/env.util.cjs");var p=(e,t,n)=>new Promise((r,i)=>{var o=s=>{try{a(n.next(s))}catch(u){i(u)}},y=s=>{try{a(n.throw(s))}catch(u){i(u)}},a=s=>s.done?r(s.value):Promise.resolve(s.value).then(o,y);a((n=n.apply(e,t)).next())});const O=j.getEnv();function T(e){return p(this,null,function*(){try{const t=yield g(`https://registry.npmjs.org/${e}/latest`);if(!t.ok)throw new Error(`Failed to fetch latest version: ${t.status} ${t.statusText}`);const{version:n}=yield t.json();return{success:!0,result:n}}catch(t){return c.catchError(t)}})}function V(e){return p(this,null,function*(){var t,n;try{if(!e){if(d.pathExistsSync(l.PATH.PACKAGE_JSON)){const C=d.readJsonSync(l.PATH.PACKAGE_JSON),{name:N="",version:A=""}=C;return{success:!0,result:{name:N,currentVersion:A,latestVersion:A,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:l.PATH.PACKAGE_JSON,file:C}}}return{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}}if(!d.pathExistsSync(l.PATH.PACKAGE_JSON))return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===m.E_PackageType.DEPENDENCY,isDevDependency:e.type===m.E_PackageType.DEV_DEPENDENCY,installedPath:"",file:{}}};const r=d.readJsonSync(l.PATH.PACKAGE_JSON),{name:i,version:o="",dependencies:y={},devDependencies:a={}}=r;if(e.name===i)return{success:!0,result:{name:i,currentVersion:o,latestVersion:o,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===m.E_PackageType.DEPENDENCY,isDevDependency:e.type===m.E_PackageType.DEV_DEPENDENCY,installedPath:l.PATH.PACKAGE_JSON,file:r}};const s=e.name in y,u=e.name in a,f=yield T(e.name);if(!f.success)return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:s,isDevDependency:u,installedPath:"",file:{}}};if(!s&&!u)return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:f.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===m.E_PackageType.DEPENDENCY,isDevDependency:e.type===m.E_PackageType.DEV_DEPENDENCY,installedPath:"",file:{}}};const D=(n=(t=y[e.name])!=null?t:a[e.name])!=null?n:"",E=J.join(O.CWD,l.NODE_MODULES,e.name,l.PACKAGE_JSON);if(!d.pathExistsSync(E))return{success:!0,result:{name:e.name,currentVersion:"",latestVersion:f.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:s,isDevDependency:u,installedPath:"",file:{}}};const P=d.readJsonSync(E),{version:_=""}=P;return D!==_?{success:!0,result:{name:e.name,currentVersion:_||D,latestVersion:f.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:s,isDevDependency:u,installedPath:E,file:P}}:{success:!0,result:{name:e.name,currentVersion:D,latestVersion:f.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:D===f.result,isDependency:s,isDevDependency:u,installedPath:E,file:P}}}catch(r){return c.catchError(r)}})}function v(e){return p(this,null,function*(){var t,n;try{const r=d.readJsonSync(l.PATH.PACKAGE_JSON),i=(t=r.dependencies)!=null?t:{},o=(n=r.devDependencies)!=null?n:{};e.isDependency?i[e.name]=e.latestVersion:e.isDevDependency&&(o[e.name]=e.latestVersion),d.writeFileSync(l.PATH.PACKAGE_JSON,JSON.stringify(r,null,4)),c.log.info(`Updated "${e.name}" to version ${e.latestVersion}`)}catch(r){c.catchError(r)}})}function S(){return p(this,null,function*(){try{try{const e=yield l.command.pnpmInstallStandard();yield h.runCommand(`Installing dependencies (standard) using: ${e}`,e);return}catch(e){c.catchError(e)}try{const e=yield l.command.pnpmInstallLegacy();yield h.runCommand(`Retrying with legacy peer dependencies using: ${e}`,e);return}catch(e){c.catchError(e)}try{const e=yield l.command.pnpmInstallForce();yield h.runCommand(`Retrying with force install using: ${e}`,e)}catch(e){c.catchError(e)}}catch(e){c.catchError(e)}})}function U(e,t){return p(this,null,function*(){var n;try{if(!d.pathExistsSync(l.PATH.PACKAGE_JSON)){c.log.error("package.json not found. Aborting setup.");return}const i=(yield Promise.all(e.map(V))).filter(s=>s.success&&!!s.result&&!s.result.isCurrentProject).map(s=>s.result),o=i.filter(s=>!s.isInstalled),y=i.filter(s=>!s.isUpToDate),a=[];t!=null&&t.install&&o.length>0&&a.push(...o.map(v)),t!=null&&t.update&&y.length>0&&a.push(...y.map(v)),a.length>0&&(yield Promise.all(a),yield S(),yield h.runCommand("Running ESLint with auto-fix",yield l.command.eslintFix())),yield(n=t==null?void 0:t.callback)==null?void 0:n.call(t)}catch(r){c.catchError(r)}})}exports.getLatestPackageVersion=T;exports.getPackage=V;exports.installDependencies=S;exports.setupPackages=U;exports.updatePackage=v;
|
|
@@ -1,11 +1,62 @@
|
|
|
1
1
|
import { I_Return } from '../../typescript/index.js';
|
|
2
2
|
import { I_PackageInfo, I_PackageInput } from './package.type.js';
|
|
3
|
+
/**
|
|
4
|
+
* Fetches the latest version of a package from the npm registry.
|
|
5
|
+
* This function makes an HTTP request to the npm registry to get the latest version
|
|
6
|
+
* information for a specified package.
|
|
7
|
+
*
|
|
8
|
+
* @param packageName - The name of the package to fetch the latest version for.
|
|
9
|
+
* @returns A promise that resolves to a standardized response with the latest version string.
|
|
10
|
+
*/
|
|
3
11
|
export declare function getLatestPackageVersion(packageName: string): Promise<I_Return<string>>;
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves comprehensive information about a package.
|
|
14
|
+
* This function analyzes package information including:
|
|
15
|
+
* - Current and latest versions
|
|
16
|
+
* - Installation status and location
|
|
17
|
+
* - Dependency type (regular, dev, peer, etc.)
|
|
18
|
+
* - Whether it's the current project or an external dependency
|
|
19
|
+
*
|
|
20
|
+
* @param inputPackage - Optional package input configuration. If not provided, returns current project info.
|
|
21
|
+
* @returns A promise that resolves to a standardized response with detailed package information.
|
|
22
|
+
*/
|
|
4
23
|
export declare function getPackage(inputPackage?: I_PackageInput): Promise<I_Return<I_PackageInfo>>;
|
|
24
|
+
/**
|
|
25
|
+
* Updates a package to its latest version in package.json.
|
|
26
|
+
* This function modifies the package.json file to update the specified package
|
|
27
|
+
* to its latest version and logs the update action.
|
|
28
|
+
*
|
|
29
|
+
* @param packageInfo - The package information containing the latest version to update to.
|
|
30
|
+
* @returns A promise that resolves when the update is complete.
|
|
31
|
+
*/
|
|
5
32
|
export declare function updatePackage(packageInfo: I_PackageInfo): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Installs project dependencies using pnpm with fallback strategies.
|
|
35
|
+
* This function attempts to install dependencies using different pnpm strategies:
|
|
36
|
+
* 1. Standard installation
|
|
37
|
+
* 2. Legacy peer dependencies mode
|
|
38
|
+
* 3. Force installation mode
|
|
39
|
+
*
|
|
40
|
+
* @returns A promise that resolves when the installation is complete.
|
|
41
|
+
*/
|
|
6
42
|
export declare function installDependencies(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Sets up multiple packages with optional installation and update operations.
|
|
45
|
+
* This function provides a comprehensive package management workflow that can:
|
|
46
|
+
* - Install missing packages
|
|
47
|
+
* - Update outdated packages
|
|
48
|
+
* - Execute custom callbacks after package operations
|
|
49
|
+
* - Run ESLint fixes after package changes
|
|
50
|
+
*
|
|
51
|
+
* @param packages - An array of package inputs to set up.
|
|
52
|
+
* @param options - Optional configuration for installation, updates, and callbacks.
|
|
53
|
+
* @param options.install - Whether to install missing packages (default: false).
|
|
54
|
+
* @param options.update - Whether to update outdated packages (default: false).
|
|
55
|
+
* @param options.callback - Optional callback function to execute after package operations.
|
|
56
|
+
* @returns A promise that resolves when all package operations are complete.
|
|
57
|
+
*/
|
|
7
58
|
export declare function setupPackages(packages: I_PackageInput[], options?: {
|
|
8
59
|
install?: boolean;
|
|
9
60
|
update?: boolean;
|
|
10
|
-
|
|
61
|
+
callback?: () => Promise<void>;
|
|
11
62
|
}): Promise<void>;
|
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
import T from "node-fetch";
|
|
2
2
|
import { E_PackageType as m } from "./package.type.js";
|
|
3
3
|
import { pathExistsSync as h, readJsonSync as E, writeFileSync as j } from "../fs/fs.util.js";
|
|
4
|
-
import { PATH as
|
|
4
|
+
import { PATH as o, command as v, PACKAGE_JSON as O, NODE_MODULES as U } from "../path/path.constant.js";
|
|
5
5
|
import { join as G } from "../path/path.util.js";
|
|
6
|
-
import { catchError as
|
|
7
|
-
import { runCommand as
|
|
6
|
+
import { catchError as u, log as J } from "../log/log.util.js";
|
|
7
|
+
import { runCommand as P } from "../command/command.util.js";
|
|
8
8
|
import { getEnv as K } from "../../config/env/env.util.js";
|
|
9
|
-
var
|
|
9
|
+
var y = (e, t, n) => new Promise((r, i) => {
|
|
10
10
|
var a = (s) => {
|
|
11
11
|
try {
|
|
12
|
-
l(
|
|
13
|
-
} catch (
|
|
14
|
-
i(
|
|
12
|
+
l(n.next(s));
|
|
13
|
+
} catch (c) {
|
|
14
|
+
i(c);
|
|
15
15
|
}
|
|
16
|
-
},
|
|
16
|
+
}, d = (s) => {
|
|
17
17
|
try {
|
|
18
|
-
l(
|
|
19
|
-
} catch (
|
|
20
|
-
i(
|
|
18
|
+
l(n.throw(s));
|
|
19
|
+
} catch (c) {
|
|
20
|
+
i(c);
|
|
21
21
|
}
|
|
22
|
-
}, l = (s) => s.done ?
|
|
23
|
-
l((
|
|
22
|
+
}, l = (s) => s.done ? r(s.value) : Promise.resolve(s.value).then(a, d);
|
|
23
|
+
l((n = n.apply(e, t)).next());
|
|
24
24
|
});
|
|
25
|
-
const
|
|
26
|
-
function
|
|
27
|
-
return
|
|
25
|
+
const w = K();
|
|
26
|
+
function I(e) {
|
|
27
|
+
return y(this, null, function* () {
|
|
28
28
|
try {
|
|
29
29
|
const t = yield T(`https://registry.npmjs.org/${e}/latest`);
|
|
30
30
|
if (!t.ok)
|
|
31
31
|
throw new Error(`Failed to fetch latest version: ${t.status} ${t.statusText}`);
|
|
32
|
-
const { version:
|
|
32
|
+
const { version: n } = yield t.json();
|
|
33
33
|
return {
|
|
34
34
|
success: !0,
|
|
35
|
-
result:
|
|
35
|
+
result: n
|
|
36
36
|
};
|
|
37
37
|
} catch (t) {
|
|
38
|
-
return
|
|
38
|
+
return u(t);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return
|
|
44
|
-
var t,
|
|
42
|
+
function $(e) {
|
|
43
|
+
return y(this, null, function* () {
|
|
44
|
+
var t, n;
|
|
45
45
|
try {
|
|
46
46
|
if (!e) {
|
|
47
|
-
if (h(
|
|
48
|
-
const
|
|
47
|
+
if (h(o.PACKAGE_JSON)) {
|
|
48
|
+
const N = E(o.PACKAGE_JSON), { name: S = "", version: A = "" } = N;
|
|
49
49
|
return {
|
|
50
50
|
success: !0,
|
|
51
51
|
result: {
|
|
52
52
|
name: S,
|
|
53
|
-
currentVersion:
|
|
54
|
-
latestVersion:
|
|
53
|
+
currentVersion: A,
|
|
54
|
+
latestVersion: A,
|
|
55
55
|
isCurrentProject: !0,
|
|
56
56
|
isInstalled: !0,
|
|
57
57
|
isUpToDate: !0,
|
|
58
58
|
isDependency: !1,
|
|
59
59
|
isDevDependency: !1,
|
|
60
|
-
installedPath:
|
|
61
|
-
file:
|
|
60
|
+
installedPath: o.PACKAGE_JSON,
|
|
61
|
+
file: N
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
}
|
|
@@ -78,7 +78,7 @@ function I(e) {
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
if (!h(
|
|
81
|
+
if (!h(o.PACKAGE_JSON))
|
|
82
82
|
return {
|
|
83
83
|
success: !0,
|
|
84
84
|
result: {
|
|
@@ -94,7 +94,7 @@ function I(e) {
|
|
|
94
94
|
file: {}
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
-
const
|
|
97
|
+
const r = E(o.PACKAGE_JSON), { name: i, version: a = "", dependencies: d = {}, devDependencies: l = {} } = r;
|
|
98
98
|
if (e.name === i)
|
|
99
99
|
return {
|
|
100
100
|
success: !0,
|
|
@@ -107,12 +107,12 @@ function I(e) {
|
|
|
107
107
|
isUpToDate: !0,
|
|
108
108
|
isDependency: e.type === m.DEPENDENCY,
|
|
109
109
|
isDevDependency: e.type === m.DEV_DEPENDENCY,
|
|
110
|
-
installedPath:
|
|
111
|
-
file:
|
|
110
|
+
installedPath: o.PACKAGE_JSON,
|
|
111
|
+
file: r
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
const s = e.name in
|
|
115
|
-
if (!
|
|
114
|
+
const s = e.name in d, c = e.name in l, f = yield I(e.name);
|
|
115
|
+
if (!f.success)
|
|
116
116
|
return {
|
|
117
117
|
success: !0,
|
|
118
118
|
result: {
|
|
@@ -123,18 +123,18 @@ function I(e) {
|
|
|
123
123
|
isInstalled: !1,
|
|
124
124
|
isUpToDate: !1,
|
|
125
125
|
isDependency: s,
|
|
126
|
-
isDevDependency:
|
|
126
|
+
isDevDependency: c,
|
|
127
127
|
installedPath: "",
|
|
128
128
|
file: {}
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
|
-
if (!s && !
|
|
131
|
+
if (!s && !c)
|
|
132
132
|
return {
|
|
133
133
|
success: !0,
|
|
134
134
|
result: {
|
|
135
135
|
name: e.name,
|
|
136
136
|
currentVersion: "",
|
|
137
|
-
latestVersion:
|
|
137
|
+
latestVersion: f.result,
|
|
138
138
|
isCurrentProject: !1,
|
|
139
139
|
isInstalled: !1,
|
|
140
140
|
isUpToDate: !1,
|
|
@@ -144,111 +144,116 @@ function I(e) {
|
|
|
144
144
|
file: {}
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
|
-
const
|
|
147
|
+
const D = (n = (t = d[e.name]) != null ? t : l[e.name]) != null ? n : "", p = G(w.CWD, U, e.name, O);
|
|
148
148
|
if (!h(p))
|
|
149
149
|
return {
|
|
150
150
|
success: !0,
|
|
151
151
|
result: {
|
|
152
152
|
name: e.name,
|
|
153
153
|
currentVersion: "",
|
|
154
|
-
latestVersion:
|
|
154
|
+
latestVersion: f.result,
|
|
155
155
|
isCurrentProject: !1,
|
|
156
156
|
isInstalled: !1,
|
|
157
157
|
isUpToDate: !1,
|
|
158
158
|
isDependency: s,
|
|
159
|
-
isDevDependency:
|
|
159
|
+
isDevDependency: c,
|
|
160
160
|
installedPath: "",
|
|
161
161
|
file: {}
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
|
-
const
|
|
165
|
-
return
|
|
164
|
+
const C = E(p), { version: V = "" } = C;
|
|
165
|
+
return D !== V ? {
|
|
166
166
|
success: !0,
|
|
167
167
|
result: {
|
|
168
168
|
name: e.name,
|
|
169
|
-
currentVersion:
|
|
170
|
-
latestVersion:
|
|
169
|
+
currentVersion: V || D,
|
|
170
|
+
latestVersion: f.result,
|
|
171
171
|
isCurrentProject: !1,
|
|
172
172
|
isInstalled: !0,
|
|
173
173
|
isUpToDate: !1,
|
|
174
174
|
isDependency: s,
|
|
175
|
-
isDevDependency:
|
|
175
|
+
isDevDependency: c,
|
|
176
176
|
installedPath: p,
|
|
177
|
-
file:
|
|
177
|
+
file: C
|
|
178
178
|
}
|
|
179
179
|
} : {
|
|
180
180
|
success: !0,
|
|
181
181
|
result: {
|
|
182
182
|
name: e.name,
|
|
183
|
-
currentVersion:
|
|
184
|
-
latestVersion:
|
|
183
|
+
currentVersion: D,
|
|
184
|
+
latestVersion: f.result,
|
|
185
185
|
isCurrentProject: !1,
|
|
186
186
|
isInstalled: !0,
|
|
187
|
-
isUpToDate:
|
|
187
|
+
isUpToDate: D === f.result,
|
|
188
188
|
isDependency: s,
|
|
189
|
-
isDevDependency:
|
|
189
|
+
isDevDependency: c,
|
|
190
190
|
installedPath: p,
|
|
191
|
-
file:
|
|
191
|
+
file: C
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
|
-
} catch (
|
|
195
|
-
return
|
|
194
|
+
} catch (r) {
|
|
195
|
+
return u(r);
|
|
196
196
|
}
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
return
|
|
201
|
-
var t,
|
|
199
|
+
function _(e) {
|
|
200
|
+
return y(this, null, function* () {
|
|
201
|
+
var t, n;
|
|
202
202
|
try {
|
|
203
|
-
const
|
|
204
|
-
e.isDependency ? i[e.name] = e.latestVersion : e.isDevDependency && (a[e.name] = e.latestVersion), j(
|
|
205
|
-
} catch (
|
|
206
|
-
|
|
203
|
+
const r = E(o.PACKAGE_JSON), i = (t = r.dependencies) != null ? t : {}, a = (n = r.devDependencies) != null ? n : {};
|
|
204
|
+
e.isDependency ? i[e.name] = e.latestVersion : e.isDevDependency && (a[e.name] = e.latestVersion), j(o.PACKAGE_JSON, JSON.stringify(r, null, 4)), J.info(`Updated "${e.name}" to version ${e.latestVersion}`);
|
|
205
|
+
} catch (r) {
|
|
206
|
+
u(r);
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
return
|
|
210
|
+
function g() {
|
|
211
|
+
return y(this, null, function* () {
|
|
212
212
|
try {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
213
|
+
try {
|
|
214
|
+
const e = yield v.pnpmInstallStandard();
|
|
215
|
+
yield P(`Installing dependencies (standard) using: ${e}`, e);
|
|
216
|
+
return;
|
|
217
|
+
} catch (e) {
|
|
218
|
+
u(e);
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
const e = yield v.pnpmInstallLegacy();
|
|
222
|
+
yield P(`Retrying with legacy peer dependencies using: ${e}`, e);
|
|
223
|
+
return;
|
|
224
|
+
} catch (e) {
|
|
225
|
+
u(e);
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
const e = yield v.pnpmInstallForce();
|
|
229
|
+
yield P(`Retrying with force install using: ${e}`, e);
|
|
230
|
+
} catch (e) {
|
|
231
|
+
u(e);
|
|
232
|
+
}
|
|
226
233
|
} catch (e) {
|
|
227
|
-
|
|
234
|
+
u(e);
|
|
228
235
|
}
|
|
229
236
|
});
|
|
230
237
|
}
|
|
231
|
-
function
|
|
232
|
-
return
|
|
233
|
-
var
|
|
238
|
+
function M(e, t) {
|
|
239
|
+
return y(this, null, function* () {
|
|
240
|
+
var n;
|
|
234
241
|
try {
|
|
235
|
-
if (!h(
|
|
236
|
-
|
|
242
|
+
if (!h(o.PACKAGE_JSON)) {
|
|
243
|
+
J.error("package.json not found. Aborting setup.");
|
|
237
244
|
return;
|
|
238
245
|
}
|
|
239
|
-
const i = (yield Promise.all(e.map(
|
|
240
|
-
t != null && t.install && a.length > 0 && l.push(...a.map(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
} catch (n) {
|
|
244
|
-
f(n);
|
|
246
|
+
const i = (yield Promise.all(e.map($))).filter((s) => s.success && !!s.result && !s.result.isCurrentProject).map((s) => s.result), a = i.filter((s) => !s.isInstalled), d = i.filter((s) => !s.isUpToDate), l = [];
|
|
247
|
+
t != null && t.install && a.length > 0 && l.push(...a.map(_)), t != null && t.update && d.length > 0 && l.push(...d.map(_)), l.length > 0 && (yield Promise.all(l), yield g(), yield P("Running ESLint with auto-fix", yield v.eslintFix())), yield (n = t == null ? void 0 : t.callback) == null ? void 0 : n.call(t);
|
|
248
|
+
} catch (r) {
|
|
249
|
+
u(r);
|
|
245
250
|
}
|
|
246
251
|
});
|
|
247
252
|
}
|
|
248
253
|
export {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
+
I as getLatestPackageVersion,
|
|
255
|
+
$ as getPackage,
|
|
256
|
+
g as installDependencies,
|
|
257
|
+
M as setupPackages,
|
|
258
|
+
_ as updatePackage
|
|
254
259
|
};
|
|
@@ -58,6 +58,15 @@ export declare const PATH: {
|
|
|
58
58
|
VITEST_UNIT_CONFIG: string;
|
|
59
59
|
VITEST_E2E_CONFIG: string;
|
|
60
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Creates Git hooks configuration based on whether this is the current project.
|
|
63
|
+
* This function generates a configuration object for Git hooks that includes
|
|
64
|
+
* pre-commit and commit-msg hooks, with an optional pre-push hook for the current project.
|
|
65
|
+
*
|
|
66
|
+
* @param context - Context object containing project information.
|
|
67
|
+
* @param context.isCurrentProject - Whether this is the current project being worked on.
|
|
68
|
+
* @returns A Git hooks configuration object with appropriate commands for each hook.
|
|
69
|
+
*/
|
|
61
70
|
export declare function createGitHooksConfig({ isCurrentProject }: Partial<I_CommandContext>): {
|
|
62
71
|
'pre-push'?: {
|
|
63
72
|
raw: boolean;
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import { default as pathNode } from 'node:path';
|
|
2
2
|
export declare const path: pathNode.PlatformPath;
|
|
3
3
|
export declare const dirname: (path: string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Resolves a path relative to the current working directory.
|
|
6
|
+
* This function creates an absolute path by combining the current working directory
|
|
7
|
+
* with the provided path segments, ensuring consistent path resolution across the application.
|
|
8
|
+
*
|
|
9
|
+
* @param urls - Path segments to resolve relative to the current working directory.
|
|
10
|
+
* @returns An absolute path string resolved from the current working directory.
|
|
11
|
+
*/
|
|
4
12
|
export declare function resolveWorkingPath(...urls: string[]): string;
|
|
13
|
+
/**
|
|
14
|
+
* Resolves an absolute path from the provided path segments.
|
|
15
|
+
* This function creates an absolute path by combining the provided path segments,
|
|
16
|
+
* similar to Node.js path.resolve but without using the current working directory as base.
|
|
17
|
+
*
|
|
18
|
+
* @param urls - Path segments to resolve into an absolute path.
|
|
19
|
+
* @returns An absolute path string resolved from the provided segments.
|
|
20
|
+
*/
|
|
5
21
|
export declare function resolve(...urls: string[]): string;
|
|
22
|
+
/**
|
|
23
|
+
* Joins path segments into a single path string.
|
|
24
|
+
* This function combines multiple path segments using the appropriate path separator
|
|
25
|
+
* for the current operating system, similar to Node.js path.join.
|
|
26
|
+
*
|
|
27
|
+
* @param urls - Path segments to join together.
|
|
28
|
+
* @returns A joined path string with appropriate separators.
|
|
29
|
+
*/
|
|
6
30
|
export declare function join(...urls: string[]): string;
|
|
@@ -1,7 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent storage utility object for data persistence across application sessions.
|
|
3
|
+
* This object provides methods for storing, retrieving, and managing data using node-persist,
|
|
4
|
+
* with automatic initialization and error handling.
|
|
5
|
+
*/
|
|
1
6
|
export declare const storage: {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves a value from persistent storage by key.
|
|
9
|
+
* This method fetches data that was previously stored using the set method.
|
|
10
|
+
* Returns null if the key doesn't exist or if an error occurs.
|
|
11
|
+
*
|
|
12
|
+
* @param key - The unique identifier for the stored value.
|
|
13
|
+
* @returns A promise that resolves to the stored value or null if not found.
|
|
14
|
+
*/
|
|
2
15
|
get<T = unknown>(key: string): Promise<T | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Stores a value in persistent storage with a unique key.
|
|
18
|
+
* This method saves data that can be retrieved later using the get method.
|
|
19
|
+
* The data is automatically serialized and stored in the configured storage directory.
|
|
20
|
+
*
|
|
21
|
+
* @param key - The unique identifier for the value to store.
|
|
22
|
+
* @param value - The data to store (will be automatically serialized).
|
|
23
|
+
* @returns A promise that resolves when the storage operation is complete.
|
|
24
|
+
*/
|
|
3
25
|
set<T = unknown>(key: string, value: T): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Removes a value from persistent storage by key.
|
|
28
|
+
* This method permanently deletes the stored data associated with the specified key.
|
|
29
|
+
*
|
|
30
|
+
* @param key - The unique identifier of the value to remove.
|
|
31
|
+
* @returns A promise that resolves when the removal operation is complete.
|
|
32
|
+
*/
|
|
4
33
|
remove(key: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves all storage keys.
|
|
36
|
+
* This method returns an array of all keys that currently have stored values.
|
|
37
|
+
* Returns an empty array if no keys exist or if an error occurs.
|
|
38
|
+
*
|
|
39
|
+
* @returns A promise that resolves to an array of storage keys.
|
|
40
|
+
*/
|
|
5
41
|
keys(): Promise<string[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Gets a human-readable log link for a storage key.
|
|
44
|
+
* This method provides a formatted string that shows the storage directory path
|
|
45
|
+
* and the key name for debugging and manual inspection purposes.
|
|
46
|
+
*
|
|
47
|
+
* @param key - The storage key to generate a log link for.
|
|
48
|
+
* @returns A promise that resolves to a formatted log link string or null if an error occurs.
|
|
49
|
+
*/
|
|
6
50
|
getLogLink(key: string): Promise<string | null>;
|
|
7
51
|
};
|
|
@@ -26,6 +26,14 @@ function o() {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
const R = {
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves a value from persistent storage by key.
|
|
31
|
+
* This method fetches data that was previously stored using the set method.
|
|
32
|
+
* Returns null if the key doesn't exist or if an error occurs.
|
|
33
|
+
*
|
|
34
|
+
* @param key - The unique identifier for the stored value.
|
|
35
|
+
* @returns A promise that resolves to the stored value or null if not found.
|
|
36
|
+
*/
|
|
29
37
|
get(r) {
|
|
30
38
|
return l(this, null, function* () {
|
|
31
39
|
try {
|
|
@@ -37,6 +45,15 @@ const R = {
|
|
|
37
45
|
}
|
|
38
46
|
});
|
|
39
47
|
},
|
|
48
|
+
/**
|
|
49
|
+
* Stores a value in persistent storage with a unique key.
|
|
50
|
+
* This method saves data that can be retrieved later using the get method.
|
|
51
|
+
* The data is automatically serialized and stored in the configured storage directory.
|
|
52
|
+
*
|
|
53
|
+
* @param key - The unique identifier for the value to store.
|
|
54
|
+
* @param value - The data to store (will be automatically serialized).
|
|
55
|
+
* @returns A promise that resolves when the storage operation is complete.
|
|
56
|
+
*/
|
|
40
57
|
set(r, e) {
|
|
41
58
|
return l(this, null, function* () {
|
|
42
59
|
try {
|
|
@@ -46,6 +63,13 @@ const R = {
|
|
|
46
63
|
}
|
|
47
64
|
});
|
|
48
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* Removes a value from persistent storage by key.
|
|
68
|
+
* This method permanently deletes the stored data associated with the specified key.
|
|
69
|
+
*
|
|
70
|
+
* @param key - The unique identifier of the value to remove.
|
|
71
|
+
* @returns A promise that resolves when the removal operation is complete.
|
|
72
|
+
*/
|
|
49
73
|
remove(r) {
|
|
50
74
|
return l(this, null, function* () {
|
|
51
75
|
try {
|
|
@@ -55,6 +79,13 @@ const R = {
|
|
|
55
79
|
}
|
|
56
80
|
});
|
|
57
81
|
},
|
|
82
|
+
/**
|
|
83
|
+
* Retrieves all storage keys.
|
|
84
|
+
* This method returns an array of all keys that currently have stored values.
|
|
85
|
+
* Returns an empty array if no keys exist or if an error occurs.
|
|
86
|
+
*
|
|
87
|
+
* @returns A promise that resolves to an array of storage keys.
|
|
88
|
+
*/
|
|
58
89
|
keys() {
|
|
59
90
|
return l(this, null, function* () {
|
|
60
91
|
try {
|
|
@@ -66,6 +97,14 @@ const R = {
|
|
|
66
97
|
}
|
|
67
98
|
});
|
|
68
99
|
},
|
|
100
|
+
/**
|
|
101
|
+
* Gets a human-readable log link for a storage key.
|
|
102
|
+
* This method provides a formatted string that shows the storage directory path
|
|
103
|
+
* and the key name for debugging and manual inspection purposes.
|
|
104
|
+
*
|
|
105
|
+
* @param key - The storage key to generate a log link for.
|
|
106
|
+
* @returns A promise that resolves to a formatted log link string or null if an error occurs.
|
|
107
|
+
*/
|
|
69
108
|
getLogLink(r) {
|
|
70
109
|
return l(this, null, function* () {
|
|
71
110
|
try {
|
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
import { I_UploadConfig, I_UploadOptions, I_UploadResult } from './upload.type.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a default upload configuration with predefined settings for different file types.
|
|
4
|
+
* This function provides sensible defaults for image, video, document, and other file types,
|
|
5
|
+
* including allowed extensions and size limits. The configuration can be customized with overrides.
|
|
6
|
+
*
|
|
7
|
+
* @param overrides - Optional configuration overrides to merge with the default configuration.
|
|
8
|
+
* @returns A complete upload configuration object with defaults and any provided overrides.
|
|
9
|
+
*/
|
|
2
10
|
export declare function createUploadConfig(overrides?: Partial<I_UploadConfig>): I_UploadConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Uploads a file with comprehensive validation and error handling.
|
|
13
|
+
* This function processes file uploads with the following features:
|
|
14
|
+
* - Input validation for path and file parameters
|
|
15
|
+
* - Configuration validation for all upload types
|
|
16
|
+
* - File size and extension validation
|
|
17
|
+
* - Automatic directory creation
|
|
18
|
+
* - Stream-based file writing
|
|
19
|
+
* - Comprehensive error handling and reporting
|
|
20
|
+
*
|
|
21
|
+
* @param options - Upload configuration including file, path, type, and optional validation config.
|
|
22
|
+
* @returns A promise that resolves to an upload result with success status, message, and file path.
|
|
23
|
+
*/
|
|
3
24
|
export declare function upload(options: I_UploadOptions): Promise<I_UploadResult>;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { WebSocketServer } from 'ws';
|
|
2
2
|
import { I_GraphqlWSOptions, I_WSOptions } from './ws.type.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a WebSocket server with the specified configuration.
|
|
5
|
+
* This function creates a WebSocket server instance that can be attached to an HTTP server
|
|
6
|
+
* and configured with a specific path for WebSocket connections.
|
|
7
|
+
*
|
|
8
|
+
* @param options - Configuration options including the HTTP server instance and WebSocket path.
|
|
9
|
+
* @returns A configured WebSocket server instance ready to handle connections.
|
|
10
|
+
*/
|
|
3
11
|
export declare function createWSServer(options: I_WSOptions): WebSocketServer;
|
|
12
|
+
/**
|
|
13
|
+
* Initializes GraphQL WebSocket server with schema and WebSocket server.
|
|
14
|
+
* This function sets up GraphQL subscriptions over WebSocket by creating a GraphQL WebSocket server
|
|
15
|
+
* that can handle GraphQL operations including queries, mutations, and subscriptions.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Configuration options including the GraphQL schema and WebSocket server instance.
|
|
18
|
+
* @returns A configured GraphQL WebSocket server ready to handle GraphQL operations over WebSocket.
|
|
19
|
+
*/
|
|
4
20
|
export declare function initGraphQLWS(options: I_GraphqlWSOptions): import('graphql-ws').Disposable;
|