@cyberskill/shared 2.13.0 → 2.14.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/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/mongo.util.cjs +4 -4
- package/dist/node/mongo/mongo.util.d.ts +1 -1
- package/dist/node/mongo/mongo.util.js +793 -458
- package/dist/node/ws/ts.util.cjs +1 -1
- package/dist/node/ws/ts.util.js +64 -11
- package/dist/node/ws/ws.type.d.ts +11 -1
- package/package.json +24 -24
- /package/dist/node_modules/.pnpm/{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 → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.3.0_@vitest_browser@3.2.4_jiti@2.5.1_js_bae9c6abdb9bf325bd1b44dc7dc11e13}/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.1.0_@vitest_browser@3.2.4_jiti@2.5.1_js_7b82ece51006a4f428642448fb1b082c → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.3.0_@vitest_browser@3.2.4_jiti@2.5.1_js_bae9c6abdb9bf325bd1b44dc7dc11e13}/node_modules/vitest/dist/config.js +0 -0
package/dist/node/ws/ts.util.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("graphql-ws/use/ws"),i=require("ws");var S=Object.defineProperty,p=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,v=(t,r,e)=>r in t?S(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,_=(t,r)=>{for(var e in r||(r={}))d.call(r,e)&&v(t,e,r[e]);if(p)for(var e of p(r))h.call(r,e)&&v(t,e,r[e]);return t},f=(t,r,e)=>new Promise((s,o)=>{var n=c=>{try{u(e.next(c))}catch(l){o(l)}},a=c=>{try{u(e.throw(c))}catch(l){o(l)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(n,a);u((e=e.apply(t,r)).next())});function m(t){const{server:r,path:e,sessionParser:s}=t;if(s){const o=new i.WebSocketServer({noServer:!0});return r.on("upgrade",(n,a,u)=>{try{if(new URL(n.url||"","http://localhost").pathname!==e)return;s(n,{},()=>{o.handleUpgrade(n,a,u,l=>{o.emit("connection",l,n)})})}catch(c){a.destroy()}}),o}return new i.WebSocketServer({server:r,path:e})}function w(t){const{schema:r,server:e,context:s,onConnect:o}=t;return y.useServer({schema:r,context:n=>f(null,null,function*(){const a=n.extra.request,u=s?yield s(a):{};return _({req:a},u)}),onConnect:n=>f(null,null,function*(){if(o){const a=n.extra.request;yield o(a)}})},e)}exports.createWSServer=m;exports.initGraphQLWS=w;
|
package/dist/node/ws/ts.util.js
CHANGED
|
@@ -1,15 +1,68 @@
|
|
|
1
|
-
import { useServer as
|
|
2
|
-
import { WebSocketServer as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useServer as m } from "graphql-ws/use/ws";
|
|
2
|
+
import { WebSocketServer as i } from "ws";
|
|
3
|
+
var h = Object.defineProperty, p = Object.getOwnPropertySymbols, y = Object.prototype.hasOwnProperty, _ = Object.prototype.propertyIsEnumerable, f = (t, r, e) => r in t ? h(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e, d = (t, r) => {
|
|
4
|
+
for (var e in r || (r = {}))
|
|
5
|
+
y.call(r, e) && f(t, e, r[e]);
|
|
6
|
+
if (p)
|
|
7
|
+
for (var e of p(r))
|
|
8
|
+
_.call(r, e) && f(t, e, r[e]);
|
|
9
|
+
return t;
|
|
10
|
+
}, v = (t, r, e) => new Promise((l, o) => {
|
|
11
|
+
var n = (c) => {
|
|
12
|
+
try {
|
|
13
|
+
s(e.next(c));
|
|
14
|
+
} catch (u) {
|
|
15
|
+
o(u);
|
|
16
|
+
}
|
|
17
|
+
}, a = (c) => {
|
|
18
|
+
try {
|
|
19
|
+
s(e.throw(c));
|
|
20
|
+
} catch (u) {
|
|
21
|
+
o(u);
|
|
22
|
+
}
|
|
23
|
+
}, s = (c) => c.done ? l(c.value) : Promise.resolve(c.value).then(n, a);
|
|
24
|
+
s((e = e.apply(t, r)).next());
|
|
25
|
+
});
|
|
26
|
+
function S(t) {
|
|
27
|
+
const { server: r, path: e, sessionParser: l } = t;
|
|
28
|
+
if (l) {
|
|
29
|
+
const o = new i({ noServer: !0 });
|
|
30
|
+
return r.on("upgrade", (n, a, s) => {
|
|
31
|
+
try {
|
|
32
|
+
if (new URL(n.url || "", "http://localhost").pathname !== e)
|
|
33
|
+
return;
|
|
34
|
+
l(n, {}, () => {
|
|
35
|
+
o.handleUpgrade(n, a, s, (u) => {
|
|
36
|
+
o.emit("connection", u, n);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
} catch (c) {
|
|
40
|
+
a.destroy();
|
|
41
|
+
}
|
|
42
|
+
}), o;
|
|
43
|
+
}
|
|
44
|
+
return new i({ server: r, path: e });
|
|
8
45
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
46
|
+
function x(t) {
|
|
47
|
+
const { schema: r, server: e, context: l, onConnect: o } = t;
|
|
48
|
+
return m(
|
|
49
|
+
{
|
|
50
|
+
schema: r,
|
|
51
|
+
context: (n) => v(null, null, function* () {
|
|
52
|
+
const a = n.extra.request, s = l ? yield l(a) : {};
|
|
53
|
+
return d({ req: a }, s);
|
|
54
|
+
}),
|
|
55
|
+
onConnect: (n) => v(null, null, function* () {
|
|
56
|
+
if (o) {
|
|
57
|
+
const a = n.extra.request;
|
|
58
|
+
yield o(a);
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
e
|
|
63
|
+
);
|
|
11
64
|
}
|
|
12
65
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
66
|
+
S as createWSServer,
|
|
67
|
+
x as initGraphQLWS
|
|
15
68
|
};
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
import { RequestHandler } from 'express';
|
|
1
2
|
import { GraphQLSchema } from 'graphql';
|
|
2
|
-
import { Server } from 'node:http';
|
|
3
|
+
import { IncomingMessage, Server } from 'node:http';
|
|
3
4
|
import { WebSocketServer } from 'ws';
|
|
4
5
|
export interface I_WSOptions {
|
|
5
6
|
server: Server;
|
|
6
7
|
path: string;
|
|
8
|
+
sessionParser?: RequestHandler;
|
|
7
9
|
}
|
|
8
10
|
export interface I_GraphqlWSOptions {
|
|
9
11
|
schema: GraphQLSchema;
|
|
10
12
|
server: WebSocketServer;
|
|
13
|
+
context?: (req: IncomingMessage & {
|
|
14
|
+
session?: any;
|
|
15
|
+
user?: any;
|
|
16
|
+
}) => Promise<Record<string, any>> | Record<string, any>;
|
|
17
|
+
onConnect?: (req: IncomingMessage & {
|
|
18
|
+
session?: any;
|
|
19
|
+
user?: any;
|
|
20
|
+
}) => Promise<void> | void;
|
|
11
21
|
}
|
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.14.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -207,23 +207,23 @@
|
|
|
207
207
|
"test:unit": "tsx src/node/cli/index.ts test:unit"
|
|
208
208
|
},
|
|
209
209
|
"dependencies": {
|
|
210
|
-
"@antfu/eslint-config": "5.1
|
|
210
|
+
"@antfu/eslint-config": "5.2.1",
|
|
211
211
|
"@apollo/client": "3.13.9",
|
|
212
212
|
"@apollo/client-integration-nextjs": "0.12.3",
|
|
213
213
|
"@apollo/server": "5.0.0",
|
|
214
214
|
"@as-integrations/express5": "1.1.2",
|
|
215
215
|
"@dotenvx/dotenvx": "1.48.4",
|
|
216
216
|
"@eddeee888/gcg-typescript-resolver-files": "0.12.1",
|
|
217
|
-
"@eslint-react/eslint-plugin": "1.52.
|
|
217
|
+
"@eslint-react/eslint-plugin": "1.52.6",
|
|
218
218
|
"@graphql-codegen/cli": "5.0.7",
|
|
219
219
|
"@graphql-codegen/client-preset": "4.8.3",
|
|
220
|
-
"@nestjs/common": "11.1.
|
|
221
|
-
"@nestjs/core": "11.1.
|
|
220
|
+
"@nestjs/common": "11.1.6",
|
|
221
|
+
"@nestjs/core": "11.1.6",
|
|
222
222
|
"@userback/widget": "0.3.11",
|
|
223
|
-
"@vitejs/plugin-react-swc": "
|
|
223
|
+
"@vitejs/plugin-react-swc": "4.0.0",
|
|
224
224
|
"apollo-upload-client": "18.0.1",
|
|
225
225
|
"body-parser": "2.2.0",
|
|
226
|
-
"chalk": "5.
|
|
226
|
+
"chalk": "5.6.0",
|
|
227
227
|
"clsx": "2.1.1",
|
|
228
228
|
"compression": "1.8.1",
|
|
229
229
|
"consola": "3.4.2",
|
|
@@ -238,18 +238,18 @@
|
|
|
238
238
|
"express": "5.1.0",
|
|
239
239
|
"express-session": "1.18.2",
|
|
240
240
|
"express-useragent": "1.0.15",
|
|
241
|
-
"fs-extra": "11.3.
|
|
241
|
+
"fs-extra": "11.3.1",
|
|
242
242
|
"globals": "16.3.0",
|
|
243
243
|
"graphql": "16.11.0",
|
|
244
244
|
"graphql-upload": "17.0.0",
|
|
245
245
|
"graphql-ws": "6.0.6",
|
|
246
|
-
"i18next": "25.3.
|
|
246
|
+
"i18next": "25.3.6",
|
|
247
247
|
"jsdom": "26.1.0",
|
|
248
248
|
"localforage": "1.10.0",
|
|
249
249
|
"lodash-es": "4.17.21",
|
|
250
250
|
"migrate-mongo": "12.1.3",
|
|
251
251
|
"mongodb": "6.18.0",
|
|
252
|
-
"mongoose": "8.17.
|
|
252
|
+
"mongoose": "8.17.1",
|
|
253
253
|
"mongoose-aggregate-paginate-v2": "1.1.4",
|
|
254
254
|
"mongoose-paginate-v2": "1.9.1",
|
|
255
255
|
"next-intl": "4.3.4",
|
|
@@ -258,21 +258,21 @@
|
|
|
258
258
|
"qs": "6.14.0",
|
|
259
259
|
"react": "19.1.1",
|
|
260
260
|
"react-dom": "19.1.1",
|
|
261
|
-
"react-hot-toast": "2.
|
|
261
|
+
"react-hot-toast": "2.6.0",
|
|
262
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.
|
|
266
|
+
"vite": "7.1.2",
|
|
267
267
|
"ws": "8.18.3",
|
|
268
268
|
"yargs": "18.0.0"
|
|
269
269
|
},
|
|
270
270
|
"devDependencies": {
|
|
271
271
|
"@commitlint/cli": "19.8.1",
|
|
272
272
|
"@commitlint/config-conventional": "19.8.1",
|
|
273
|
-
"@eslint/config-inspector": "1.
|
|
274
|
-
"@next/eslint-plugin-next": "15.4.
|
|
275
|
-
"@testing-library/jest-dom": "6.
|
|
273
|
+
"@eslint/config-inspector": "1.2.0",
|
|
274
|
+
"@next/eslint-plugin-next": "15.4.6",
|
|
275
|
+
"@testing-library/jest-dom": "6.7.0",
|
|
276
276
|
"@testing-library/react": "16.3.0",
|
|
277
277
|
"@types/apollo-upload-client": "18.0.0",
|
|
278
278
|
"@types/body-parser": "1.19.6",
|
|
@@ -287,26 +287,26 @@
|
|
|
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.
|
|
290
|
+
"@types/node": "24.3.0",
|
|
291
291
|
"@types/node-persist": "3.1.8",
|
|
292
|
-
"@types/react": "19.1.
|
|
292
|
+
"@types/react": "19.1.10",
|
|
293
293
|
"@types/react-dom": "19.1.7",
|
|
294
294
|
"@types/unorm": "1.3.31",
|
|
295
295
|
"@types/uuid": "10.0.0",
|
|
296
296
|
"@types/ws": "8.18.1",
|
|
297
297
|
"@types/yargs": "17.0.33",
|
|
298
298
|
"@vitest/browser": "3.2.4",
|
|
299
|
-
"eslint": "9.
|
|
300
|
-
"eslint-config-next": "15.4.
|
|
299
|
+
"eslint": "9.33.0",
|
|
300
|
+
"eslint-config-next": "15.4.6",
|
|
301
301
|
"glob": "11.0.3",
|
|
302
|
-
"lint-staged": "16.1.
|
|
303
|
-
"node-modules-inspector": "1.
|
|
302
|
+
"lint-staged": "16.1.5",
|
|
303
|
+
"node-modules-inspector": "1.1.1",
|
|
304
304
|
"npm-run-all2": "8.0.4",
|
|
305
|
-
"sass": "1.
|
|
305
|
+
"sass": "1.90.0",
|
|
306
306
|
"simple-git-hooks": "2.13.1",
|
|
307
|
-
"tsx": "4.20.
|
|
307
|
+
"tsx": "4.20.4",
|
|
308
308
|
"typescript": "5.9.2",
|
|
309
|
-
"vite": "7.
|
|
309
|
+
"vite": "7.1.2",
|
|
310
310
|
"vite-plugin-dts": "4.5.4",
|
|
311
311
|
"vitest": "3.2.4"
|
|
312
312
|
},
|