@studyportals/cors 2.3.0-beta.1 → 2.3.0-beta.2
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/bin/index.d.ts +2 -0
- package/bin/index.js +18 -0
- package/bin/src/domain/allowed-domain-reg-ex-list.d.ts +10 -0
- package/bin/src/domain/allowed-domain-reg-ex-list.js +27 -0
- package/bin/src/domain/allowed-explicit-domains-rules.d.ts +42 -0
- package/bin/src/domain/allowed-explicit-domains-rules.js +42 -0
- package/bin/src/domain/cors.d.ts +16 -0
- package/bin/src/domain/cors.js +37 -0
- package/bin/src/domain/enums/environment.d.ts +4 -0
- package/bin/src/domain/enums/environment.js +8 -0
- package/bin/src/domain/enums/index.d.ts +2 -0
- package/bin/src/domain/enums/index.js +18 -0
- package/bin/src/domain/enums/scope.d.ts +4 -0
- package/bin/src/domain/enums/scope.js +8 -0
- package/bin/src/domain/index.d.ts +3 -0
- package/bin/src/domain/index.js +19 -0
- package/bin/src/implementations/express-middleware.d.ts +5 -0
- package/bin/src/implementations/express-middleware.js +27 -0
- package/bin/src/implementations/index.d.ts +3 -0
- package/bin/src/implementations/index.js +19 -0
- package/bin/src/implementations/options.d.ts +8 -0
- package/bin/src/implementations/options.js +49 -0
- package/bin/src/implementations/s3-rules.d.ts +5 -0
- package/bin/src/implementations/s3-rules.js +12 -0
- package/package.json +1 -1
package/bin/index.d.ts
ADDED
package/bin/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/domain"), exports);
|
|
18
|
+
__exportStar(require("./src/implementations"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AllowedDomainRegExList = void 0;
|
|
4
|
+
const environment_1 = require("./enums/environment");
|
|
5
|
+
const scope_1 = require("./enums/scope");
|
|
6
|
+
exports.AllowedDomainRegExList = {
|
|
7
|
+
[scope_1.Scope.Student]: {
|
|
8
|
+
[environment_1.Environment.Production]: [
|
|
9
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.mastersportal\.(com|fyi)(?::3030)?$/,
|
|
10
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.bachelorsportal\.(com|fyi)(?::3030)?$/,
|
|
11
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.phdportal\.(com|fyi)(?::3030)?$/,
|
|
12
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.preparationcoursesportal\.(com|fyi)(?::3030)?$/,
|
|
13
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.distancelearningportal\.(com|fyi)(?::3030)?$/,
|
|
14
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.shortcoursesportal\.(com|fyi)(?::3030)?$/,
|
|
15
|
+
/^https?:\/\/studentemailing\.prtl\.co$/,
|
|
16
|
+
/^https?:\/\/scholarship\.mastersportal\.com$/,
|
|
17
|
+
/^https?:\/\/search-page\.prtl\.co$/,
|
|
18
|
+
],
|
|
19
|
+
[environment_1.Environment.Testing]: [
|
|
20
|
+
/(.*?)/,
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
[scope_1.Scope.UniAdmin]: {
|
|
24
|
+
[environment_1.Environment.Production]: [/(.*?)/],
|
|
25
|
+
[environment_1.Environment.Testing]: [/(.*?)/],
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare type AllowedExplicitDomainsRulesType = typeof AllowedExplicitDomainsRules;
|
|
2
|
+
export declare type CorsRule = {
|
|
3
|
+
allowedOrigins: string[];
|
|
4
|
+
allowedMethods: string[];
|
|
5
|
+
allowedHeaders: string[];
|
|
6
|
+
exposedHeaders: string[];
|
|
7
|
+
maxAge: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const AllowedExplicitDomainsRules: {
|
|
10
|
+
0: {
|
|
11
|
+
0: {
|
|
12
|
+
allowedOrigins: string[];
|
|
13
|
+
allowedHeaders: string[];
|
|
14
|
+
allowedMethods: string[];
|
|
15
|
+
exposedHeaders: never[];
|
|
16
|
+
maxAge: number;
|
|
17
|
+
};
|
|
18
|
+
1: {
|
|
19
|
+
allowedOrigins: string[];
|
|
20
|
+
allowedMethods: string[];
|
|
21
|
+
allowedHeaders: string[];
|
|
22
|
+
exposedHeaders: never[];
|
|
23
|
+
maxAge: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
1: {
|
|
27
|
+
0: {
|
|
28
|
+
allowedOrigins: string[];
|
|
29
|
+
allowedHeaders: string[];
|
|
30
|
+
allowedMethods: string[];
|
|
31
|
+
exposedHeaders: never[];
|
|
32
|
+
maxAge: number;
|
|
33
|
+
};
|
|
34
|
+
1: {
|
|
35
|
+
allowedOrigins: string[];
|
|
36
|
+
allowedMethods: string[];
|
|
37
|
+
allowedHeaders: string[];
|
|
38
|
+
exposedHeaders: never[];
|
|
39
|
+
maxAge: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AllowedExplicitDomainsRules = void 0;
|
|
4
|
+
const environment_1 = require("./enums/environment");
|
|
5
|
+
const scope_1 = require("./enums/scope");
|
|
6
|
+
exports.AllowedExplicitDomainsRules = {
|
|
7
|
+
[scope_1.Scope.Student]: {
|
|
8
|
+
[environment_1.Environment.Production]: {
|
|
9
|
+
allowedOrigins: ["*.mastersportal.com", "*.bachelorsportal.com", "*.shortcoursesportal.com",
|
|
10
|
+
"*.distancelearningportal.com", "*.preparationcoursesportal.com", "*.phdportal.com",
|
|
11
|
+
"*.prtl.co", "*.rc.mastersportal.fyi", "*.rc.bachelorsportal.fyi", "*.rc.shortcoursesportal.fyi",
|
|
12
|
+
"*.rc.distancelearningportal.fyi", "*.rc.preparationcoursesportal.fyi", "*.rc.phdportal.fyi"],
|
|
13
|
+
allowedHeaders: ["Authorization"],
|
|
14
|
+
allowedMethods: ["GET"],
|
|
15
|
+
exposedHeaders: [],
|
|
16
|
+
maxAge: 3000
|
|
17
|
+
},
|
|
18
|
+
[environment_1.Environment.Testing]: {
|
|
19
|
+
allowedOrigins: ["*"],
|
|
20
|
+
allowedMethods: ["GET"],
|
|
21
|
+
allowedHeaders: ["Authorization"],
|
|
22
|
+
exposedHeaders: [],
|
|
23
|
+
maxAge: 3000
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
[scope_1.Scope.UniAdmin]: {
|
|
27
|
+
[environment_1.Environment.Production]: {
|
|
28
|
+
allowedOrigins: ["*.studyportals.eu"],
|
|
29
|
+
allowedHeaders: ["Authorization"],
|
|
30
|
+
allowedMethods: ["GET", "POST"],
|
|
31
|
+
exposedHeaders: [],
|
|
32
|
+
maxAge: 3000
|
|
33
|
+
},
|
|
34
|
+
[environment_1.Environment.Testing]: {
|
|
35
|
+
allowedOrigins: ["*-uniadmin.prtl.fyi"],
|
|
36
|
+
allowedMethods: ["GET"],
|
|
37
|
+
allowedHeaders: ["*"],
|
|
38
|
+
exposedHeaders: [],
|
|
39
|
+
maxAge: 3000
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CorsRule } from './allowed-explicit-domains-rules';
|
|
2
|
+
import { Environment } from './enums/environment';
|
|
3
|
+
import { Scope } from './enums/scope';
|
|
4
|
+
export declare class CORS {
|
|
5
|
+
private regExes;
|
|
6
|
+
private s3Rules;
|
|
7
|
+
constructor(scope: Scope, environment?: Environment);
|
|
8
|
+
/**
|
|
9
|
+
* isValidDomain
|
|
10
|
+
*/
|
|
11
|
+
isValidDomain(domain: string): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* getIamRules
|
|
14
|
+
*/
|
|
15
|
+
getS3Rules(): CorsRule[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CORS = void 0;
|
|
13
|
+
const allowed_domain_reg_ex_list_1 = require("./allowed-domain-reg-ex-list");
|
|
14
|
+
const allowed_explicit_domains_rules_1 = require("./allowed-explicit-domains-rules");
|
|
15
|
+
const environment_1 = require("./enums/environment");
|
|
16
|
+
class CORS {
|
|
17
|
+
constructor(scope, environment = environment_1.Environment.Production) {
|
|
18
|
+
this.regExes = allowed_domain_reg_ex_list_1.AllowedDomainRegExList[scope][environment];
|
|
19
|
+
this.s3Rules = [allowed_explicit_domains_rules_1.AllowedExplicitDomainsRules[scope][environment]];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* isValidDomain
|
|
23
|
+
*/
|
|
24
|
+
isValidDomain(domain) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const hasMatch = this.regExes.filter((regex) => domain.match(regex) !== null);
|
|
27
|
+
return (hasMatch.length !== 0);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* getIamRules
|
|
32
|
+
*/
|
|
33
|
+
getS3Rules() {
|
|
34
|
+
return this.s3Rules;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.CORS = CORS;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Environment = void 0;
|
|
4
|
+
var Environment;
|
|
5
|
+
(function (Environment) {
|
|
6
|
+
Environment[Environment["Production"] = 0] = "Production";
|
|
7
|
+
Environment[Environment["Testing"] = 1] = "Testing";
|
|
8
|
+
})(Environment = exports.Environment || (exports.Environment = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./environment"), exports);
|
|
18
|
+
__exportStar(require("./scope"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Scope = void 0;
|
|
4
|
+
var Scope;
|
|
5
|
+
(function (Scope) {
|
|
6
|
+
Scope[Scope["Student"] = 0] = "Student";
|
|
7
|
+
Scope[Scope["UniAdmin"] = 1] = "UniAdmin";
|
|
8
|
+
})(Scope = exports.Scope || (exports.Scope = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cors"), exports);
|
|
18
|
+
__exportStar(require("./allowed-domain-reg-ex-list"), exports);
|
|
19
|
+
__exportStar(require("./enums"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ExpressMiddleware = void 0;
|
|
13
|
+
const domain_1 = require("../domain");
|
|
14
|
+
const enums_1 = require("../domain/enums");
|
|
15
|
+
class ExpressMiddleware {
|
|
16
|
+
static getMiddleWare(scope, environment = enums_1.Environment.Production) {
|
|
17
|
+
const cors = new domain_1.CORS(scope, environment);
|
|
18
|
+
return (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const origin = req.get('origin') || '';
|
|
20
|
+
if (yield cors.isValidDomain(origin)) {
|
|
21
|
+
res.header('Access-Control-Allow-Origin', origin);
|
|
22
|
+
}
|
|
23
|
+
next();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ExpressMiddleware = ExpressMiddleware;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./options"), exports);
|
|
18
|
+
__exportStar(require("./express-middleware"), exports);
|
|
19
|
+
__exportStar(require("./s3-rules"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Environment, Scope } from '../domain/enums';
|
|
2
|
+
export declare class OptionsLambda {
|
|
3
|
+
private cors;
|
|
4
|
+
constructor(scope: Scope, environment?: Environment);
|
|
5
|
+
getLowercasedHeaders(event: any): any;
|
|
6
|
+
getOrigin(event: any): string;
|
|
7
|
+
getHandler(): (event: any) => Promise<any>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OptionsLambda = void 0;
|
|
13
|
+
const domain_1 = require("../domain");
|
|
14
|
+
const enums_1 = require("../domain/enums");
|
|
15
|
+
class OptionsLambda {
|
|
16
|
+
constructor(scope, environment = enums_1.Environment.Production) {
|
|
17
|
+
this.cors = new domain_1.CORS(scope, environment);
|
|
18
|
+
}
|
|
19
|
+
getLowercasedHeaders(event) {
|
|
20
|
+
const headers = {};
|
|
21
|
+
Object.keys(event.headers).forEach((key) => {
|
|
22
|
+
headers[key.toLowerCase()] = event.headers[key];
|
|
23
|
+
});
|
|
24
|
+
return headers;
|
|
25
|
+
}
|
|
26
|
+
getOrigin(event) {
|
|
27
|
+
const headers = this.getLowercasedHeaders(event);
|
|
28
|
+
return headers['origin'];
|
|
29
|
+
}
|
|
30
|
+
getHandler() {
|
|
31
|
+
return (event) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const origin = this.getOrigin(event);
|
|
33
|
+
const headers = {
|
|
34
|
+
'Cache-Control': 'max-age=600, s-maxage=600, proxy-revalidate',
|
|
35
|
+
};
|
|
36
|
+
if (yield this.cors.isValidDomain(origin)) {
|
|
37
|
+
headers['Access-Control-Allow-Origin'] = origin;
|
|
38
|
+
headers['Access-Control-Allow-Headers'] = 'authorization, x-api-key, content-type';
|
|
39
|
+
headers['Access-Control-Allow-Methods'] = 'GET, POST, DELETE, PATCH, HEAD, PUT, OPTIONS';
|
|
40
|
+
headers['Access-Control-Max-Age'] = '600';
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
statusCode: 200,
|
|
44
|
+
headers,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.OptionsLambda = OptionsLambda;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.S3Rules = void 0;
|
|
4
|
+
const domain_1 = require("../domain");
|
|
5
|
+
const enums_1 = require("../domain/enums");
|
|
6
|
+
class S3Rules {
|
|
7
|
+
static generate(scope, environment = enums_1.Environment.Production) {
|
|
8
|
+
const cors = new domain_1.CORS(scope, environment);
|
|
9
|
+
return cors.getS3Rules();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.S3Rules = S3Rules;
|