@cyberskill/shared 2.19.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/eslint/index.d.ts +5 -0
- package/dist/config/storybook/index.cjs +1 -0
- package/dist/config/storybook/index.d.ts +2 -0
- package/dist/config/storybook/index.js +6 -0
- package/dist/config/storybook/storybook.main.cjs +1 -0
- package/dist/config/storybook/storybook.main.d.ts +17 -0
- package/dist/config/storybook/storybook.main.js +18 -0
- package/dist/config/storybook/storybook.preview.cjs +1 -0
- package/dist/config/storybook/storybook.preview.d.ts +18 -0
- package/dist/config/storybook/storybook.preview.js +39 -0
- 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/cli/index.cjs +2 -2
- package/dist/node/cli/index.js +51 -41
- package/dist/node/express/express.util.cjs +1 -1
- package/dist/node/express/express.util.js +21 -21
- package/dist/node/mongo/mongo.type.d.ts +3 -3
- package/dist/node/mongo/mongo.util.cjs +1 -1
- package/dist/node/mongo/mongo.util.d.ts +1019 -125
- package/dist/node/mongo/mongo.util.js +1 -1
- package/dist/node/path/index.cjs +1 -1
- package/dist/node/path/index.js +27 -25
- package/dist/node/path/path.constant.cjs +1 -1
- package/dist/node/path/path.constant.d.ts +6 -0
- package/dist/node/path/path.constant.js +152 -128
- package/dist/node/storage/index.cjs +1 -1
- package/dist/node/storage/index.d.ts +2 -0
- package/dist/node/storage/index.js +7 -2
- package/dist/node/storage/storage.constant.cjs +1 -0
- package/dist/node/storage/storage.constant.d.ts +4 -0
- package/dist/node/storage/storage.constant.js +7 -0
- package/dist/node/storage/storage.type.d.ts +14 -0
- package/dist/node/storage/storage.util.cjs +1 -1
- package/dist/node/storage/storage.util.d.ts +1 -1
- package/dist/node/storage/storage.util.js +160 -50
- package/dist/react/apollo-client/apollo-client.component.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.component.d.ts +3 -2
- package/dist/react/apollo-client/apollo-client.component.js +12 -12
- package/dist/react/apollo-client/apollo-client.type.d.ts +6 -0
- package/dist/react/apollo-client/apollo-client.util.cjs +1 -1
- package/dist/react/apollo-client/apollo-client.util.js +32 -34
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.cjs +1 -1
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +3 -2
- package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js +10 -10
- package/dist/react/apollo-error/apollo-error.provider.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.provider.d.ts +5 -4
- package/dist/react/apollo-error/apollo-error.provider.js +21 -15
- package/dist/react/apollo-error/apollo-error.type.d.ts +5 -0
- package/dist/react/apollo-error/apollo-error.util.cjs +1 -1
- package/dist/react/apollo-error/apollo-error.util.d.ts +13 -1
- package/dist/react/apollo-error/apollo-error.util.js +15 -7
- package/dist/react/apollo-error/index.cjs +1 -1
- package/dist/react/apollo-error/index.js +8 -6
- package/package.json +45 -41
- /package/dist/node_modules/.pnpm/{vitest@4.0.6_@types_debug@4.1.12_@types_node@24.9.2_jiti@2.6.1_jsdom@27.1.0_sass@1.93.3_tsx@4.20.6_yaml@2.8.1 → vitest@4.0.13_@types_debug@4.1.12_@types_node@24.10.1_jiti@2.6.1_jsdom@27.2.0_sass@1.94.2_tsx@4.20.6_yaml@2.8.1}/node_modules/vitest/dist/config.cjs +0 -0
- /package/dist/node_modules/.pnpm/{vitest@4.0.6_@types_debug@4.1.12_@types_node@24.9.2_jiti@2.6.1_jsdom@27.1.0_sass@1.93.3_tsx@4.20.6_yaml@2.8.1 → vitest@4.0.13_@types_debug@4.1.12_@types_node@24.10.1_jiti@2.6.1_jsdom@27.2.0_sass@1.94.2_tsx@4.20.6_yaml@2.8.1}/node_modules/vitest/dist/config.js +0 -0
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ApolloErrorContext as
|
|
3
|
-
import { setGlobalApolloErrorCallback as
|
|
4
|
-
function
|
|
5
|
-
const [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import s, { useState as m, useCallback as c, useEffect as f, useMemo as i } from "react";
|
|
2
|
+
import { ApolloErrorContext as p } from "./apollo-error.context.js";
|
|
3
|
+
import { setGlobalApolloErrorCallback as b, clearGlobalApolloErrorCallback as A } from "./apollo-error.util.js";
|
|
4
|
+
function k({ children: u, onError: l }) {
|
|
5
|
+
const [r, o] = m(null), e = c((a) => {
|
|
6
|
+
if (l) {
|
|
7
|
+
l(a);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
o(a);
|
|
11
|
+
}, [l]);
|
|
12
|
+
f(() => (b(e, !!l), () => {
|
|
13
|
+
A();
|
|
14
|
+
}), [e, l]);
|
|
15
|
+
const t = c(() => o(null), []), n = i(() => ({
|
|
16
|
+
error: l ? null : r,
|
|
17
|
+
showError: e,
|
|
18
|
+
hideError: t
|
|
19
|
+
}), [r, e, t, l]);
|
|
20
|
+
return /* @__PURE__ */ s.createElement(p, { value: n }, u);
|
|
15
21
|
}
|
|
16
22
|
export {
|
|
17
|
-
|
|
23
|
+
k as ApolloErrorProvider
|
|
18
24
|
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { GraphQLError } from 'graphql';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
export type { GraphQLError } from 'graphql';
|
|
3
4
|
export interface I_ApolloErrorContext {
|
|
4
5
|
error: GraphQLError | Error | null;
|
|
5
6
|
showError: (error: GraphQLError | Error) => void;
|
|
6
7
|
hideError: () => void;
|
|
7
8
|
}
|
|
9
|
+
export interface I_ApolloErrorProviderProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
onError?: (error: GraphQLError | Error) => void;
|
|
12
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let l=null,r=!1;function e(o,a=!1){l=o,r=a}function t(){l=null,r=!1}function n(){return r}function s(o){l==null||l(o)}exports.clearGlobalApolloErrorCallback=t;exports.hasCustomApolloErrorHandler=n;exports.setGlobalApolloErrorCallback=e;exports.showGlobalApolloError=s;
|
|
@@ -7,8 +7,20 @@ import { GraphQLError } from 'graphql';
|
|
|
7
7
|
* consistent error handling.
|
|
8
8
|
*
|
|
9
9
|
* @param callback - The function to be called when a global Apollo error occurs.
|
|
10
|
+
* @param isCustomHandler - Flag that identifies whether the handler was provided by the consumer.
|
|
10
11
|
*/
|
|
11
|
-
export declare function setGlobalApolloErrorCallback(callback: (err: GraphQLError | Error) => void): void;
|
|
12
|
+
export declare function setGlobalApolloErrorCallback(callback: (err: GraphQLError | Error) => void, isCustomHandler?: boolean): void;
|
|
13
|
+
/**
|
|
14
|
+
* Clears the global callback function for Apollo error handling.
|
|
15
|
+
* Useful when the ApolloErrorProvider unmounts to avoid stale references.
|
|
16
|
+
*/
|
|
17
|
+
export declare function clearGlobalApolloErrorCallback(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Indicates whether a custom Apollo error handler is registered.
|
|
20
|
+
*
|
|
21
|
+
* @returns True if a custom handler is registered, otherwise false.
|
|
22
|
+
*/
|
|
23
|
+
export declare function hasCustomApolloErrorHandler(): boolean;
|
|
12
24
|
/**
|
|
13
25
|
* Displays a global Apollo error using the registered callback.
|
|
14
26
|
* This function triggers the global error display system by calling the
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
let
|
|
2
|
-
function
|
|
3
|
-
o =
|
|
1
|
+
let l = null, r = !1;
|
|
2
|
+
function n(o, a = !1) {
|
|
3
|
+
l = o, r = a;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
5
|
+
function e() {
|
|
6
|
+
l = null, r = !1;
|
|
7
|
+
}
|
|
8
|
+
function t() {
|
|
9
|
+
return r;
|
|
10
|
+
}
|
|
11
|
+
function s(o) {
|
|
12
|
+
l == null || l(o);
|
|
7
13
|
}
|
|
8
14
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
e as clearGlobalApolloErrorCallback,
|
|
16
|
+
t as hasCustomApolloErrorHandler,
|
|
17
|
+
n as setGlobalApolloErrorCallback,
|
|
18
|
+
s as showGlobalApolloError
|
|
11
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./apollo-error.component.cjs"),l=require("./apollo-error.context.cjs"),e=require("./apollo-error.hook.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./apollo-error.component.cjs"),l=require("./apollo-error.context.cjs"),e=require("./apollo-error.hook.cjs"),a=require("./apollo-error.provider.cjs"),o=require("./apollo-error.util.cjs");exports.ApolloErrorComponent=r.ApolloErrorComponent;exports.ApolloErrorContext=l.ApolloErrorContext;exports.useApolloError=e.useApolloError;exports.ApolloErrorProvider=a.ApolloErrorProvider;exports.clearGlobalApolloErrorCallback=o.clearGlobalApolloErrorCallback;exports.hasCustomApolloErrorHandler=o.hasCustomApolloErrorHandler;exports.setGlobalApolloErrorCallback=o.setGlobalApolloErrorCallback;exports.showGlobalApolloError=o.showGlobalApolloError;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { ApolloErrorComponent as l } from "./apollo-error.component.js";
|
|
2
2
|
import { ApolloErrorContext as e } from "./apollo-error.context.js";
|
|
3
|
-
import { useApolloError as
|
|
4
|
-
import { ApolloErrorProvider as
|
|
5
|
-
import { setGlobalApolloErrorCallback as f, showGlobalApolloError as
|
|
3
|
+
import { useApolloError as t } from "./apollo-error.hook.js";
|
|
4
|
+
import { ApolloErrorProvider as E } from "./apollo-error.provider.js";
|
|
5
|
+
import { clearGlobalApolloErrorCallback as x, hasCustomApolloErrorHandler as b, setGlobalApolloErrorCallback as f, showGlobalApolloError as s } from "./apollo-error.util.js";
|
|
6
6
|
export {
|
|
7
7
|
l as ApolloErrorComponent,
|
|
8
8
|
e as ApolloErrorContext,
|
|
9
|
-
|
|
9
|
+
E as ApolloErrorProvider,
|
|
10
|
+
x as clearGlobalApolloErrorCallback,
|
|
11
|
+
b as hasCustomApolloErrorHandler,
|
|
10
12
|
f as setGlobalApolloErrorCallback,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
s as showGlobalApolloError,
|
|
14
|
+
t as useApolloError
|
|
13
15
|
};
|
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.20.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -50,6 +50,11 @@
|
|
|
50
50
|
"import": "./dist/config/vitest/index.js",
|
|
51
51
|
"require": "./dist/config/vitest/index.cjs"
|
|
52
52
|
},
|
|
53
|
+
"./config/storybook": {
|
|
54
|
+
"types": "./dist/config/storybook/index.d.ts",
|
|
55
|
+
"import": "./dist/config/storybook/index.js",
|
|
56
|
+
"require": "./dist/config/storybook/index.cjs"
|
|
57
|
+
},
|
|
53
58
|
"./constant": {
|
|
54
59
|
"types": "./dist/constant/index.d.ts",
|
|
55
60
|
"import": "./dist/constant/index.js",
|
|
@@ -208,19 +213,19 @@
|
|
|
208
213
|
},
|
|
209
214
|
"dependencies": {
|
|
210
215
|
"@antfu/eslint-config": "6.2.0",
|
|
211
|
-
"@apollo/client": "4.0.
|
|
216
|
+
"@apollo/client": "4.0.9",
|
|
212
217
|
"@apollo/client-integration-nextjs": "0.14.1",
|
|
213
|
-
"@apollo/server": "5.
|
|
218
|
+
"@apollo/server": "5.2.0",
|
|
214
219
|
"@as-integrations/express5": "1.1.2",
|
|
215
|
-
"@dotenvx/dotenvx": "1.51.
|
|
216
|
-
"@eddeee888/gcg-typescript-resolver-files": "0.14.
|
|
217
|
-
"@eslint-react/eslint-plugin": "2.
|
|
218
|
-
"@graphql-codegen/cli": "6.0
|
|
219
|
-
"@graphql-codegen/client-preset": "5.
|
|
220
|
-
"@nestjs/common": "11.1.
|
|
221
|
-
"@nestjs/core": "11.1.
|
|
222
|
-
"@userback/widget": "0.3.
|
|
223
|
-
"@vitejs/plugin-react-swc": "4.2.
|
|
220
|
+
"@dotenvx/dotenvx": "1.51.1",
|
|
221
|
+
"@eddeee888/gcg-typescript-resolver-files": "0.14.1",
|
|
222
|
+
"@eslint-react/eslint-plugin": "2.3.7",
|
|
223
|
+
"@graphql-codegen/cli": "6.1.0",
|
|
224
|
+
"@graphql-codegen/client-preset": "5.2.0",
|
|
225
|
+
"@nestjs/common": "11.1.9",
|
|
226
|
+
"@nestjs/core": "11.1.9",
|
|
227
|
+
"@userback/widget": "0.3.12",
|
|
228
|
+
"@vitejs/plugin-react-swc": "4.2.2",
|
|
224
229
|
"body-parser": "2.2.0",
|
|
225
230
|
"chalk": "5.6.2",
|
|
226
231
|
"clsx": "2.1.1",
|
|
@@ -230,49 +235,50 @@
|
|
|
230
235
|
"cors": "2.8.5",
|
|
231
236
|
"crypto-js": "4.2.0",
|
|
232
237
|
"date-fns": "4.1.0",
|
|
233
|
-
"envalid": "8.1.
|
|
238
|
+
"envalid": "8.1.1",
|
|
234
239
|
"eslint-plugin-format": "1.0.2",
|
|
235
240
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
236
241
|
"eslint-plugin-react-refresh": "0.4.24",
|
|
237
242
|
"express": "5.1.0",
|
|
238
243
|
"express-session": "1.18.2",
|
|
239
|
-
"express-useragent": "2.0.
|
|
244
|
+
"express-useragent": "2.0.2",
|
|
240
245
|
"extract-files": "13.0.0",
|
|
241
246
|
"fs-extra": "11.3.2",
|
|
242
|
-
"globals": "16.
|
|
243
|
-
"graphql": "16.
|
|
247
|
+
"globals": "16.5.0",
|
|
248
|
+
"graphql": "16.12.0",
|
|
244
249
|
"graphql-upload": "17.0.0",
|
|
245
250
|
"graphql-ws": "6.0.6",
|
|
246
|
-
"i18next": "25.6.
|
|
247
|
-
"jsdom": "27.
|
|
251
|
+
"i18next": "25.6.3",
|
|
252
|
+
"jsdom": "27.2.0",
|
|
248
253
|
"localforage": "1.10.0",
|
|
249
254
|
"lodash-es": "4.17.21",
|
|
250
255
|
"migrate-mongo": "12.1.3",
|
|
251
|
-
"mongodb": "
|
|
252
|
-
"mongoose": "
|
|
256
|
+
"mongodb": "7.0.0",
|
|
257
|
+
"mongoose": "9.0.0",
|
|
253
258
|
"mongoose-aggregate-paginate-v2": "1.1.4",
|
|
254
259
|
"mongoose-paginate-v2": "1.9.1",
|
|
255
|
-
"next-intl": "4.
|
|
260
|
+
"next-intl": "4.5.5",
|
|
256
261
|
"node-fetch": "3.3.2",
|
|
257
|
-
"node-persist": "4.0.4",
|
|
258
262
|
"qs": "6.14.0",
|
|
259
263
|
"react": "19.2.0",
|
|
260
264
|
"react-dom": "19.2.0",
|
|
261
265
|
"react-hot-toast": "2.6.0",
|
|
262
|
-
"react-i18next": "16.
|
|
266
|
+
"react-i18next": "16.3.5",
|
|
263
267
|
"rxjs": "7.8.2",
|
|
264
268
|
"slugify": "1.6.6",
|
|
265
269
|
"unorm": "1.6.0",
|
|
266
270
|
"uuid": "13.0.0",
|
|
267
|
-
"vite": "7.
|
|
271
|
+
"vite": "7.2.4",
|
|
268
272
|
"ws": "8.18.3",
|
|
269
273
|
"yargs": "18.0.0"
|
|
270
274
|
},
|
|
271
275
|
"devDependencies": {
|
|
272
276
|
"@commitlint/cli": "20.1.0",
|
|
273
277
|
"@commitlint/config-conventional": "20.0.0",
|
|
274
|
-
"@eslint/config-inspector": "1.
|
|
275
|
-
"@next/eslint-plugin-next": "16.0.
|
|
278
|
+
"@eslint/config-inspector": "1.4.2",
|
|
279
|
+
"@next/eslint-plugin-next": "16.0.3",
|
|
280
|
+
"@storybook/react": "10.0.8",
|
|
281
|
+
"@storybook/react-vite": "10.0.8",
|
|
276
282
|
"@testing-library/jest-dom": "6.9.1",
|
|
277
283
|
"@testing-library/react": "16.3.0",
|
|
278
284
|
"@types/body-parser": "1.19.6",
|
|
@@ -287,29 +293,27 @@
|
|
|
287
293
|
"@types/fs-extra": "11.0.4",
|
|
288
294
|
"@types/graphql-upload": "17.0.0",
|
|
289
295
|
"@types/lodash-es": "4.17.12",
|
|
290
|
-
"@types/migrate-mongo": "10.0.
|
|
291
|
-
"@types/node": "24.
|
|
292
|
-
"@types/
|
|
293
|
-
"@types/react": "19.2.
|
|
294
|
-
"@types/react-dom": "19.2.2",
|
|
296
|
+
"@types/migrate-mongo": "10.0.6",
|
|
297
|
+
"@types/node": "24.10.1",
|
|
298
|
+
"@types/react": "19.2.6",
|
|
299
|
+
"@types/react-dom": "19.2.3",
|
|
295
300
|
"@types/unorm": "1.3.31",
|
|
296
|
-
"@types/uuid": "11.0.0",
|
|
297
301
|
"@types/ws": "8.18.1",
|
|
298
|
-
"@types/yargs": "17.0.
|
|
299
|
-
"@vitest/browser": "4.0.
|
|
300
|
-
"eslint": "9.
|
|
301
|
-
"eslint-config-next": "16.0.
|
|
302
|
-
"glob": "
|
|
303
|
-
"lint-staged": "16.2.
|
|
302
|
+
"@types/yargs": "17.0.35",
|
|
303
|
+
"@vitest/browser": "4.0.13",
|
|
304
|
+
"eslint": "9.39.1",
|
|
305
|
+
"eslint-config-next": "16.0.3",
|
|
306
|
+
"glob": "13.0.0",
|
|
307
|
+
"lint-staged": "16.2.7",
|
|
304
308
|
"node-modules-inspector": "1.2.0",
|
|
305
309
|
"npm-run-all2": "8.0.4",
|
|
306
|
-
"sass": "1.
|
|
310
|
+
"sass": "1.94.2",
|
|
307
311
|
"simple-git-hooks": "2.13.1",
|
|
308
312
|
"tsx": "4.20.6",
|
|
309
313
|
"typescript": "5.9.3",
|
|
310
|
-
"vite": "7.
|
|
314
|
+
"vite": "7.2.4",
|
|
311
315
|
"vite-plugin-dts": "4.5.4",
|
|
312
|
-
"vitest": "4.0.
|
|
316
|
+
"vitest": "4.0.13"
|
|
313
317
|
},
|
|
314
318
|
"publishConfig": {
|
|
315
319
|
"access": "public",
|