dromanis.finora.functions.common 3.6.1 → 3.10.1
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/corsHandler.d.ts.map +1 -1
- package/dist/corsHandler.js +1 -17
- package/dist/corsHandler.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corsHandler.d.ts","sourceRoot":"","sources":["../src/corsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEzE,qBAAa,WAAW;IACpB,OAAO,CAAC,cAAc,CAAW;;IAMjC,OAAO,CAAC,eAAe;
|
|
1
|
+
{"version":3,"file":"corsHandler.d.ts","sourceRoot":"","sources":["../src/corsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEzE,qBAAa,WAAW;IACpB,OAAO,CAAC,cAAc,CAAW;;IAMjC,OAAO,CAAC,eAAe;IAKhB,cAAc,CACjB,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,oBAAoB,GAC5B,qBAAqB;IAkBjB,mBAAmB,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB;CAQjF"}
|
package/dist/corsHandler.js
CHANGED
|
@@ -7,28 +7,12 @@ class corsHandler {
|
|
|
7
7
|
}
|
|
8
8
|
getOriginHeader(event) {
|
|
9
9
|
const origin = event.headers['origin'] || event.headers['Origin'];
|
|
10
|
-
// Comprehensive logging
|
|
11
|
-
console.log('=== CORS Handler Debug ===');
|
|
12
|
-
console.log('Origin header value:', origin || 'MISSING/UNDEFINED');
|
|
13
|
-
console.log('All headers:', JSON.stringify(event.headers, null, 2));
|
|
14
|
-
console.log('HTTP Method:', event.httpMethod);
|
|
15
|
-
console.log('Request Path:', event.path);
|
|
16
|
-
console.log('Resource:', event.resource);
|
|
17
|
-
console.log('Allowed origins:', this.allowedOrigins);
|
|
18
10
|
return origin;
|
|
19
11
|
}
|
|
20
12
|
handleWithCors(response, event) {
|
|
21
13
|
const origin = this.getOriginHeader(event);
|
|
22
14
|
const isAllowed = !!(origin && this.allowedOrigins.includes(origin));
|
|
23
|
-
|
|
24
|
-
// Always return a valid string, never undefined
|
|
25
|
-
const allowedOrigin = (isAllowed && origin) ? origin : (this.allowedOrigins[0] || 'https://finnora.io');
|
|
26
|
-
console.log('Origin check result:');
|
|
27
|
-
console.log(' - Received origin:', origin || 'NONE');
|
|
28
|
-
console.log(' - Is allowed?:', isAllowed);
|
|
29
|
-
console.log(' - Will return origin:', allowedOrigin);
|
|
30
|
-
console.log(' - Response status:', response.statusCode);
|
|
31
|
-
console.log('========================');
|
|
15
|
+
const allowedOrigin = (isAllowed && origin) ? origin : this.allowedOrigins[0];
|
|
32
16
|
return {
|
|
33
17
|
...response,
|
|
34
18
|
headers: {
|
package/dist/corsHandler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corsHandler.js","sourceRoot":"","sources":["../src/corsHandler.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IAGpB;QACI,IAAI,CAAC,cAAc,GAAG,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,CAAC;IAC1E,CAAC;IAEO,eAAe,CAAC,KAA2B;QAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"corsHandler.js","sourceRoot":"","sources":["../src/corsHandler.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IAGpB;QACI,IAAI,CAAC,cAAc,GAAG,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,CAAC;IAC1E,CAAC;IAEO,eAAe,CAAC,KAA2B;QAC/C,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAClE,OAAO,MAAM,CAAC;IAClB,CAAC;IAEM,cAAc,CACjB,QAA+B,EAC/B,KAA2B;QAE3B,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAErE,MAAM,aAAa,GAAW,CAAC,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAW,CAAC;QAEhG,OAAO;YACH,GAAG,QAAQ;YACX,OAAO,EAAE;gBACL,GAAG,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC;gBAC3B,6BAA6B,EAAE,aAAa;gBAC5C,8BAA8B,EAAE,6BAA6B;gBAC7D,8BAA8B,EAAE,6BAA6B;gBAC7D,kCAAkC,EAAE,MAAM;aAC7C;SACJ,CAAC;IACN,CAAC;IAEM,mBAAmB,CAAC,KAA2B;QACpD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,cAAc,CAAC;YACvB,UAAU,EAAE,GAAG;YACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAG,qBAAqB;SACnD,EAAE,KAAK,CAAC,CAAC;IACd,CAAC;CAEF;AAzCD,kCAyCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dromanis.finora.functions.common",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"clean": "rm -rf dist",
|
|
13
13
|
"test": "jest --config jest.config.js",
|
|
14
|
-
"prepare": "husky install"
|
|
14
|
+
"prepare": "husky install",
|
|
15
|
+
"prepublishOnly": "npm run test && npm run clean && npm run build"
|
|
15
16
|
},
|
|
16
17
|
"keywords": [],
|
|
17
18
|
"author": "",
|