@cyberskill/shared 2.0.0 → 2.2.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/LICENSE +1 -1
- package/README.md +3 -3
- package/dist/config/vitest/vitest.e2e.cjs +1 -1
- package/dist/config/vitest/vitest.e2e.js +1 -1
- package/dist/config/vitest/vitest.unit.cjs +1 -1
- package/dist/config/vitest/vitest.unit.js +1 -1
- package/dist/node/mongo/index.cjs +1 -1
- package/dist/node/mongo/index.js +11 -15
- package/dist/node/mongo/mongo.type.d.ts +29 -11
- package/dist/node/mongo/mongo.util.cjs +5 -5
- package/dist/node/mongo/mongo.util.d.ts +22 -11
- package/dist/node/mongo/mongo.util.js +356 -187
- package/dist/typescript/common.type.d.ts +37 -4
- package/package.json +10 -10
- /package/dist/node_modules/.pnpm/{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 → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.1.0_@vitest_browser@3.2.4_jiti@2.5.1_js_7b82ece51006a4f428642448fb1b082c}/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.15_@vitest_browser@3.2.4_jiti@2.4.2_j_e4a333d8aa4b05d17db10875e249d94f → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.1.0_@vitest_browser@3.2.4_jiti@2.5.1_js_7b82ece51006a4f428642448fb1b082c}/node_modules/vitest/dist/config.js +0 -0
|
@@ -22,17 +22,50 @@ export interface I_Log {
|
|
|
22
22
|
trace: typeof consola['trace'];
|
|
23
23
|
verbose: typeof consola['verbose'];
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Base interface for return types with common properties.
|
|
27
|
+
*/
|
|
28
|
+
export interface I_ReturnBase {
|
|
29
|
+
success: boolean;
|
|
28
30
|
message?: string;
|
|
29
31
|
code?: number | string;
|
|
30
32
|
}
|
|
31
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Success return type with result data.
|
|
35
|
+
* @template T - The main result type
|
|
36
|
+
* @template E - Additional properties to merge with the result (defaults to unknown)
|
|
37
|
+
*/
|
|
38
|
+
export interface I_ReturnSuccess<T, E = unknown> extends I_ReturnBase {
|
|
39
|
+
success: true;
|
|
40
|
+
result: T & E;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Failure return type with error information.
|
|
44
|
+
*/
|
|
45
|
+
export interface I_ReturnFailure extends I_ReturnBase {
|
|
32
46
|
success: false;
|
|
33
47
|
message: string;
|
|
34
48
|
code: number | string;
|
|
35
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Discriminated union type for function return values.
|
|
52
|
+
* Provides type-safe handling of success and failure cases.
|
|
53
|
+
*
|
|
54
|
+
* @template T - The success result type (defaults to void)
|
|
55
|
+
* @template E - Additional properties to merge with the result (defaults to unknown)
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* function fetchUser(id: string): I_Return<User> {
|
|
60
|
+
* try {
|
|
61
|
+
* const user = await getUser(id);
|
|
62
|
+
* return { success: true, result: user };
|
|
63
|
+
* } catch (error) {
|
|
64
|
+
* return { success: false, message: error.message, code: 'USER_NOT_FOUND' };
|
|
65
|
+
* }
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
36
69
|
export type I_Return<T = void, E = unknown> = I_ReturnSuccess<T, E> | I_ReturnFailure;
|
|
37
70
|
export declare enum E_Environment {
|
|
38
71
|
PRODUCTION = "production",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberskill/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -207,12 +207,12 @@
|
|
|
207
207
|
"test:unit": "tsx src/node/cli/index.ts test:unit"
|
|
208
208
|
},
|
|
209
209
|
"dependencies": {
|
|
210
|
-
"@antfu/eslint-config": "
|
|
210
|
+
"@antfu/eslint-config": "5.0.0",
|
|
211
211
|
"@apollo/client": "3.13.8",
|
|
212
212
|
"@apollo/client-integration-nextjs": "0.12.2",
|
|
213
213
|
"@apollo/server": "5.0.0",
|
|
214
214
|
"@as-integrations/express5": "1.1.2",
|
|
215
|
-
"@dotenvx/dotenvx": "1.48.
|
|
215
|
+
"@dotenvx/dotenvx": "1.48.3",
|
|
216
216
|
"@eddeee888/gcg-typescript-resolver-files": "0.12.1",
|
|
217
217
|
"@eslint-react/eslint-plugin": "1.52.3",
|
|
218
218
|
"@graphql-codegen/cli": "5.0.7",
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
"localforage": "1.10.0",
|
|
249
249
|
"lodash-es": "4.17.21",
|
|
250
250
|
"migrate-mongo": "12.1.3",
|
|
251
|
-
"mongodb": "6.
|
|
251
|
+
"mongodb": "6.18.0",
|
|
252
252
|
"mongoose": "8.16.4",
|
|
253
253
|
"mongoose-aggregate-paginate-v2": "1.1.4",
|
|
254
254
|
"mongoose-paginate-v2": "1.9.1",
|
|
@@ -259,11 +259,11 @@
|
|
|
259
259
|
"react": "19.1.0",
|
|
260
260
|
"react-dom": "19.1.0",
|
|
261
261
|
"react-hot-toast": "2.5.2",
|
|
262
|
-
"react-i18next": "15.6.
|
|
262
|
+
"react-i18next": "15.6.1",
|
|
263
263
|
"slugify": "1.6.6",
|
|
264
264
|
"unorm": "1.6.0",
|
|
265
265
|
"uuid": "11.1.0",
|
|
266
|
-
"vite": "7.0.
|
|
266
|
+
"vite": "7.0.6",
|
|
267
267
|
"ws": "8.18.3",
|
|
268
268
|
"yargs": "18.0.0"
|
|
269
269
|
},
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
"@commitlint/cli": "19.8.1",
|
|
272
272
|
"@commitlint/config-conventional": "19.8.1",
|
|
273
273
|
"@eslint/config-inspector": "1.1.0",
|
|
274
|
-
"@next/eslint-plugin-next": "15.4.
|
|
274
|
+
"@next/eslint-plugin-next": "15.4.4",
|
|
275
275
|
"@testing-library/jest-dom": "6.6.3",
|
|
276
276
|
"@testing-library/react": "16.3.0",
|
|
277
277
|
"@types/apollo-upload-client": "18.0.0",
|
|
@@ -287,7 +287,7 @@
|
|
|
287
287
|
"@types/graphql-upload": "17.0.0",
|
|
288
288
|
"@types/lodash-es": "4.17.12",
|
|
289
289
|
"@types/migrate-mongo": "10.0.5",
|
|
290
|
-
"@types/node": "24.0
|
|
290
|
+
"@types/node": "24.1.0",
|
|
291
291
|
"@types/node-persist": "3.1.8",
|
|
292
292
|
"@types/react": "19.1.8",
|
|
293
293
|
"@types/react-dom": "19.1.6",
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
"@types/yargs": "17.0.33",
|
|
298
298
|
"@vitest/browser": "3.2.4",
|
|
299
299
|
"eslint": "9.31.0",
|
|
300
|
-
"eslint-config-next": "15.4.
|
|
300
|
+
"eslint-config-next": "15.4.4",
|
|
301
301
|
"glob": "11.0.3",
|
|
302
302
|
"lint-staged": "16.1.2",
|
|
303
303
|
"node-modules-inspector": "1.0.0",
|
|
@@ -306,7 +306,7 @@
|
|
|
306
306
|
"simple-git-hooks": "2.13.0",
|
|
307
307
|
"tsx": "4.20.3",
|
|
308
308
|
"typescript": "5.8.3",
|
|
309
|
-
"vite": "7.0.
|
|
309
|
+
"vite": "7.0.6",
|
|
310
310
|
"vite-plugin-dts": "4.5.4",
|
|
311
311
|
"vitest": "3.2.4"
|
|
312
312
|
},
|