@cyberskill/shared 2.25.0 → 2.26.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.
|
@@ -4,10 +4,12 @@ import { CorsOptions, CorsOptionsDelegate, CorsRequest } from 'cors';
|
|
|
4
4
|
export type { NextFunction, Request, Response } from 'express';
|
|
5
5
|
export { Router } from 'express';
|
|
6
6
|
export interface I_ExpressOptions {
|
|
7
|
+
isDev?: boolean;
|
|
7
8
|
static?: string | string[];
|
|
8
9
|
}
|
|
9
10
|
export interface I_NestOptions {
|
|
10
11
|
module: Type<object>;
|
|
12
|
+
isDev?: boolean;
|
|
11
13
|
static?: string | string[];
|
|
12
14
|
filters?: ExceptionFilter[];
|
|
13
15
|
pipes?: ValidationPipe[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("@nestjs/core"),m=require("compression"),h=require("cookie-parser"),w=require("cors"),c=require("express"),q=require("express-session"),x=require("express-useragent"),b=require("graphql-upload/graphqlUploadExpress.mjs"),g=require("helmet");var S=Object.defineProperty,u=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,d=(e,r,t)=>r in e?S(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,E=(e,r)=>{for(var t in r||(r={}))v.call(r,t)&&d(e,t,r[t]);if(u)for(var t of u(r))p.call(r,t)&&d(e,t,r[t]);return e},C=(e,r)=>{var t={};for(var s in e)v.call(e,s)&&r.indexOf(s)<0&&(t[s]=e[s]);if(e!=null&&u)for(var s of u(e))r.indexOf(s)<0&&p.call(e,s)&&(t[s]=e[s]);return t},N=(e,r,t)=>new Promise((s,a)=>{var n=i=>{try{o(t.next(i))}catch(f){a(f)}},l=i=>{try{o(t.throw(i))}catch(f){a(f)}},o=i=>i.done?s(i.value):Promise.resolve(i.value).then(n,l);o((t=t.apply(e,r)).next())});function y(e){var r=e,{isDev:t,whiteList:s}=r,a=C(r,["isDev","whiteList"]);return E({origin:(n,l)=>{t||!n||s!=null&&s.includes(n!=null?n:"")?l(null,!0):l(new Error("Not allowed by CORS"),!1)},credentials:!0},a)}function j(e){return w(y(e))}function A(e){return q(e)}function _(e,r=!1){e.set("trust proxy",1),e.use(g({crossOriginEmbedderPolicy:r?!1:void 0,contentSecurityPolicy:r?!1:void 0})),e.use(h()),e.use(c.urlencoded({extended:!0})),e.use(m()),e.use(x.express())}function O(e,r){r&&(Array.isArray(r)?r:[r]).forEach(s=>{e.use(`/${s}`,c.static(s))})}function I(e){const r=c();return _(r,e==null?void 0:e.isDev),O(r,e==null?void 0:e.static),r.use(b()),r}function D(e){return N(this,null,function*(){const r=yield P.NestFactory.create(e.module);return _(r.getHttpAdapter().getInstance(),e.isDev),O(r.getHttpAdapter().getInstance(),e.static),e.filters&&r.useGlobalFilters(...e.filters),e.pipes&&r.useGlobalPipes(...e.pipes),r})}exports.express=c;exports.createCors=j;exports.createCorsOptions=y;exports.createExpress=I;exports.createNest=D;exports.createSession=A;
|
|
@@ -1,75 +1,80 @@
|
|
|
1
|
-
import { NestFactory as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { NestFactory as _ } from "@nestjs/core";
|
|
2
|
+
import O from "compression";
|
|
3
|
+
import P from "cookie-parser";
|
|
4
|
+
import h from "cors";
|
|
5
5
|
import c from "express";
|
|
6
6
|
import { default as J } from "express";
|
|
7
|
-
import
|
|
8
|
-
import { express as
|
|
7
|
+
import w from "express-session";
|
|
8
|
+
import { express as x } from "express-useragent";
|
|
9
9
|
import b from "graphql-upload/graphqlUploadExpress.mjs";
|
|
10
10
|
import E from "helmet";
|
|
11
|
-
var g = Object.defineProperty,
|
|
11
|
+
var g = Object.defineProperty, o = Object.getOwnPropertySymbols, p = Object.prototype.hasOwnProperty, d = Object.prototype.propertyIsEnumerable, m = (e, r, t) => r in e ? g(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, S = (e, r) => {
|
|
12
12
|
for (var t in r || (r = {}))
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
for (var t of
|
|
16
|
-
|
|
13
|
+
p.call(r, t) && m(e, t, r[t]);
|
|
14
|
+
if (o)
|
|
15
|
+
for (var t of o(r))
|
|
16
|
+
d.call(r, t) && m(e, t, r[t]);
|
|
17
17
|
return e;
|
|
18
18
|
}, A = (e, r) => {
|
|
19
19
|
var t = {};
|
|
20
20
|
for (var s in e)
|
|
21
|
-
|
|
22
|
-
if (e != null &&
|
|
23
|
-
for (var s of
|
|
24
|
-
r.indexOf(s) < 0 &&
|
|
21
|
+
p.call(e, s) && r.indexOf(s) < 0 && (t[s] = e[s]);
|
|
22
|
+
if (e != null && o)
|
|
23
|
+
for (var s of o(e))
|
|
24
|
+
r.indexOf(s) < 0 && d.call(e, s) && (t[s] = e[s]);
|
|
25
25
|
return t;
|
|
26
|
-
}, I = (e, r, t) => new Promise((s,
|
|
27
|
-
var
|
|
26
|
+
}, I = (e, r, t) => new Promise((s, n) => {
|
|
27
|
+
var a = (i) => {
|
|
28
28
|
try {
|
|
29
29
|
f(t.next(i));
|
|
30
30
|
} catch (u) {
|
|
31
|
-
|
|
31
|
+
n(u);
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, l = (i) => {
|
|
34
34
|
try {
|
|
35
35
|
f(t.throw(i));
|
|
36
36
|
} catch (u) {
|
|
37
|
-
|
|
37
|
+
n(u);
|
|
38
38
|
}
|
|
39
|
-
}, f = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(
|
|
39
|
+
}, f = (i) => i.done ? s(i.value) : Promise.resolve(i.value).then(a, l);
|
|
40
40
|
f((t = t.apply(e, r)).next());
|
|
41
41
|
});
|
|
42
42
|
function N(e) {
|
|
43
|
-
var r = e, { isDev: t, whiteList: s } = r,
|
|
43
|
+
var r = e, { isDev: t, whiteList: s } = r, n = A(r, ["isDev", "whiteList"]);
|
|
44
44
|
return S({
|
|
45
|
-
origin: (
|
|
46
|
-
t || !
|
|
45
|
+
origin: (a, l) => {
|
|
46
|
+
t || !a || s != null && s.includes(a != null ? a : "") ? l(null, !0) : l(new Error("Not allowed by CORS"), !1);
|
|
47
47
|
},
|
|
48
48
|
credentials: !0
|
|
49
|
-
},
|
|
49
|
+
}, n);
|
|
50
50
|
}
|
|
51
51
|
function M(e) {
|
|
52
|
-
return
|
|
52
|
+
return h(N(e));
|
|
53
53
|
}
|
|
54
54
|
function U(e) {
|
|
55
|
-
return
|
|
55
|
+
return w(e);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
e.set("trust proxy", 1), e.use(
|
|
57
|
+
function v(e, r = !1) {
|
|
58
|
+
e.set("trust proxy", 1), e.use(
|
|
59
|
+
E({
|
|
60
|
+
crossOriginEmbedderPolicy: r ? !1 : void 0,
|
|
61
|
+
contentSecurityPolicy: r ? !1 : void 0
|
|
62
|
+
})
|
|
63
|
+
), e.use(P()), e.use(c.urlencoded({ extended: !0 })), e.use(O()), e.use(x());
|
|
59
64
|
}
|
|
60
|
-
function
|
|
65
|
+
function y(e, r) {
|
|
61
66
|
r && (Array.isArray(r) ? r : [r]).forEach((s) => {
|
|
62
67
|
e.use(`/${s}`, c.static(s));
|
|
63
68
|
});
|
|
64
69
|
}
|
|
65
70
|
function V(e) {
|
|
66
71
|
const r = c();
|
|
67
|
-
return
|
|
72
|
+
return v(r, e == null ? void 0 : e.isDev), y(r, e == null ? void 0 : e.static), r.use(b()), r;
|
|
68
73
|
}
|
|
69
74
|
function z(e) {
|
|
70
75
|
return I(this, null, function* () {
|
|
71
|
-
const r = yield
|
|
72
|
-
return
|
|
76
|
+
const r = yield _.create(e.module);
|
|
77
|
+
return v(r.getHttpAdapter().getInstance(), e.isDev), y(r.getHttpAdapter().getInstance(), e.static), e.filters && r.useGlobalFilters(...e.filters), e.pipes && r.useGlobalPipes(...e.pipes), r;
|
|
73
78
|
});
|
|
74
79
|
}
|
|
75
80
|
export {
|
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.26.0",
|
|
5
5
|
"description": "CyberSkill Shared",
|
|
6
6
|
"author": "Stephen Cheng",
|
|
7
7
|
"license": "MIT",
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
"react-hot-toast": "2.6.0",
|
|
265
265
|
"react-i18next": "16.5.1",
|
|
266
266
|
"rxjs": "7.8.2",
|
|
267
|
-
"vite": "7.3.
|
|
267
|
+
"vite": "7.3.1",
|
|
268
268
|
"ws": "8.19.0",
|
|
269
269
|
"yargs": "18.0.0"
|
|
270
270
|
},
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
"simple-git-hooks": "2.13.1",
|
|
305
305
|
"tsx": "4.21.0",
|
|
306
306
|
"typescript": "5.9.3",
|
|
307
|
-
"vite": "7.3.
|
|
307
|
+
"vite": "7.3.1",
|
|
308
308
|
"vite-plugin-dts": "4.5.4",
|
|
309
309
|
"vitest": "4.0.16"
|
|
310
310
|
},
|