@shadimakhoul/ggcoach 1.0.14 → 1.0.16
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/initExpress.d.ts +1 -1
- package/dist/config/initExpress.d.ts.map +1 -1
- package/dist/config/initExpress.js +3 -2
- package/dist/config/initExpress.js.map +1 -1
- package/dist/middleware/cors.d.ts.map +1 -1
- package/dist/middleware/cors.js +1 -14
- package/dist/middleware/cors.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function initExpress(isDevelopment: boolean): import("express-serve-static-core").Express;
|
|
1
|
+
export declare function initExpress(isDevelopment: boolean, allowedOrigins?: string[]): import("express-serve-static-core").Express;
|
|
2
2
|
//# sourceMappingURL=initExpress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initExpress.d.ts","sourceRoot":"","sources":["../../config/initExpress.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initExpress.d.ts","sourceRoot":"","sources":["../../config/initExpress.ts"],"names":[],"mappings":"AAOA,wBAAgB,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,+CAiB5E"}
|
|
@@ -4,15 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.initExpress = void 0;
|
|
7
|
+
const cors_1 = __importDefault(require("cors"));
|
|
7
8
|
const express_1 = __importDefault(require("express"));
|
|
8
9
|
const helmet_1 = __importDefault(require("helmet"));
|
|
9
10
|
const morgan_1 = __importDefault(require("morgan"));
|
|
10
11
|
const middleware_1 = require("../middleware");
|
|
11
12
|
const utils_1 = require("../utils");
|
|
12
|
-
function initExpress(isDevelopment) {
|
|
13
|
+
function initExpress(isDevelopment, allowedOrigins) {
|
|
13
14
|
const app = (0, express_1.default)();
|
|
14
15
|
app.use((0, helmet_1.default)());
|
|
15
|
-
app.use(middleware_1.
|
|
16
|
+
app.use((0, cors_1.default)((0, middleware_1.createCorsOptions)(allowedOrigins)));
|
|
16
17
|
app.use(middleware_1.generalRateLimiter);
|
|
17
18
|
app.use(express_1.default.json({ limit: "10mb" }));
|
|
18
19
|
app.use(express_1.default.urlencoded({ extended: true, limit: "10mb" }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initExpress.js","sourceRoot":"","sources":["../../config/initExpress.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,oDAA4B;AAC5B,oDAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"initExpress.js","sourceRoot":"","sources":["../../config/initExpress.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,sDAA8B;AAC9B,oDAA4B;AAC5B,oDAA4B;AAC5B,8CAAsE;AACtE,oCAAoC;AAEpC,SAAgB,WAAW,CAAC,aAAsB,EAAE,cAAyB;IAC3E,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;IAEtB,GAAG,CAAC,GAAG,CAAC,IAAA,gBAAM,GAAE,CAAC,CAAC;IAClB,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,EAAC,IAAA,8BAAiB,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IACjD,GAAG,CAAC,GAAG,CAAC,+BAAkB,CAAC,CAAC;IAE5B,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAE/D,IAAI,aAAa,EAAE,CAAC;QAClB,GAAG,CAAC,GAAG,CAAC,IAAA,gBAAM,EAAC,KAAK,EAAE,EAAE,MAAM,EAAN,cAAM,EAAS,CAAC,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,IAAA,gBAAM,EAAC,UAAU,EAAE,EAAE,MAAM,EAAN,cAAM,EAAS,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAjBD,kCAiBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../middleware/cors.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../middleware/cors.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,eAAO,MAAM,iBAAiB,oBAAqB,MAAM,EAAE;qBAQ7C,MAAM,GAAG,SAAS,kBACV,KAAK,GAAG,IAAI,UAAU,OAAO,KAAK,IAAI;;;;;;;CAuB3D,CAAC;AAGF,eAAO,MAAM,WAAW;qBA3BV,MAAM,GAAG,SAAS,kBACV,KAAK,GAAG,IAAI,UAAU,OAAO,KAAK,IAAI;;;;;;;CA0Bd,CAAC;AAE/C,eAAO,MAAM,cAAc;;;;oCAAoB,CAAC"}
|
package/dist/middleware/cors.js
CHANGED
|
@@ -5,21 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.corsMiddleware = exports.corsOptions = exports.createCorsOptions = void 0;
|
|
7
7
|
const cors_1 = __importDefault(require("cors"));
|
|
8
|
-
const DEFAULT_ORIGINS = [
|
|
9
|
-
"http://localhost:4000",
|
|
10
|
-
"http://localhost:4001",
|
|
11
|
-
"http://localhost:4002",
|
|
12
|
-
"http://localhost:4003",
|
|
13
|
-
"http://localhost:4004",
|
|
14
|
-
"http://localhost:4005",
|
|
15
|
-
"http://localhost:8080",
|
|
16
|
-
"http://localhost:3000",
|
|
17
|
-
"http://localhost:3001",
|
|
18
|
-
"https://gg.staging.brainexy.com",
|
|
19
|
-
"https://gg.register.brainexy.com",
|
|
20
|
-
];
|
|
21
8
|
const createCorsOptions = (allowedOrigins) => {
|
|
22
|
-
const origins = allowedOrigins ||
|
|
9
|
+
const origins = allowedOrigins || "*";
|
|
23
10
|
const finalAllowedOrigins = Array.from(new Set([...origins].map(o => o.toLowerCase())));
|
|
24
11
|
return {
|
|
25
12
|
origin: (origin, callback) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cors.js","sourceRoot":"","sources":["../../middleware/cors.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;
|
|
1
|
+
{"version":3,"file":"cors.js","sourceRoot":"","sources":["../../middleware/cors.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGjB,MAAM,iBAAiB,GAAG,CAAC,cAAyB,EAAE,EAAE;IAC7D,MAAM,OAAO,GAAG,cAAc,IAAI,GAAG,CAAC;IACtC,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CACpC,IAAI,GAAG,CAAC,CAAC,GAAG,OAAO,CAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CACjD,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,CACN,MAA0B,EAC1B,QAAsD,EACtD,EAAE;YACF,kDAAkD;YAClD,IAAI,CAAC,MAAM;gBAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACzC,IAAI,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;gBACvD,OAAO,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC9B,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;QACpD,CAAC;QAED,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;QAC7D,cAAc,EAAE;YACd,cAAc;YACd,eAAe;YACf,kBAAkB;YAClB,cAAc;SACf;QACD,cAAc,EAAE,CAAC,cAAc,CAAC,EAAE,sBAAsB;QACxD,iBAAiB,EAAE,KAAK;QACxB,oBAAoB,EAAE,GAAG;KAC1B,CAAC;AACJ,CAAC,CAAC;AAhCW,QAAA,iBAAiB,qBAgC5B;AAEF,6CAA6C;AAChC,QAAA,WAAW,GAAG,IAAA,yBAAiB,GAAE,CAAC;AAElC,QAAA,cAAc,GAAG,IAAA,cAAI,EAAC,mBAAW,CAAC,CAAC"}
|