unnbound-events 1.0.19 → 1.0.21
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/LICENSE +21 -0
- package/README.md +50 -11
- package/dist/events/src/index.d.ts +9 -1
- package/dist/events/src/index.js +23 -8
- package/dist/events/src/lib/adapters/express.d.ts +12 -10
- package/dist/events/src/lib/adapters/express.js +27 -31
- package/dist/events/src/lib/adapters/sqs.d.ts +27 -27
- package/dist/events/src/lib/adapters/sqs.js +39 -39
- package/dist/events/src/lib/client.js +241 -298
- package/dist/events/src/lib/types.d.ts +45 -58
- package/dist/events/src/lib/types.js +2 -2
- package/dist/lib/client.js +71 -67
- package/dist/lib/types.d.ts +1 -0
- package/dist/logger/src/axios.d.ts +5 -4
- package/dist/logger/src/axios.js +70 -64
- package/dist/logger/src/index.js +50 -14
- package/dist/logger/src/logger.d.ts +18 -12
- package/dist/logger/src/logger.js +41 -39
- package/dist/logger/src/middleware.d.ts +5 -9
- package/dist/logger/src/middleware.js +76 -64
- package/dist/logger/src/span.d.ts +14 -8
- package/dist/logger/src/span.js +35 -28
- package/dist/logger/src/storage.d.ts +2 -2
- package/dist/logger/src/storage.js +3 -3
- package/dist/logger/src/trace.d.ts +8 -2
- package/dist/logger/src/trace.js +12 -5
- package/dist/logger/src/types.d.ts +57 -39
- package/dist/logger/src/types.js +2 -2
- package/dist/logger/src/utils.js +24 -26
- package/package.json +22 -22
package/dist/logger/src/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
3
|
exports.shouldIgnorePath = void 0;
|
|
4
4
|
exports.safeJsonParse = safeJsonParse;
|
|
5
5
|
exports.normalizeIp = normalizeIp;
|
|
@@ -10,15 +10,15 @@ exports.normalizeIp = normalizeIp;
|
|
|
10
10
|
* @returns boolean indicating if the path should be ignored
|
|
11
11
|
*/
|
|
12
12
|
const shouldIgnorePath = (path, patterns) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
return patterns.some((pattern) => {
|
|
14
|
+
// Convert glob pattern to regex
|
|
15
|
+
const regexPattern = pattern
|
|
16
|
+
.replace(/\./g, '\\.') // Escape dots
|
|
17
|
+
.replace(/\*/g, '.*') // Convert * to .*
|
|
18
|
+
.replace(/\?/g, '.'); // Convert ? to .
|
|
19
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
20
|
+
return regex.test(path);
|
|
21
|
+
});
|
|
22
22
|
};
|
|
23
23
|
exports.shouldIgnorePath = shouldIgnorePath;
|
|
24
24
|
/**
|
|
@@ -27,15 +27,14 @@ exports.shouldIgnorePath = shouldIgnorePath;
|
|
|
27
27
|
* @returns Parsed JSON object or the original data.
|
|
28
28
|
*/
|
|
29
29
|
function safeJsonParse(data) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
30
|
+
if (typeof data === 'string') {
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(data);
|
|
33
|
+
} catch {
|
|
34
|
+
return data;
|
|
37
35
|
}
|
|
38
|
-
|
|
36
|
+
}
|
|
37
|
+
return data;
|
|
39
38
|
}
|
|
40
39
|
/**
|
|
41
40
|
* Normalizes IP addresses by removing IPv6 mapping prefix for IPv4 addresses.
|
|
@@ -43,11 +42,10 @@ function safeJsonParse(data) {
|
|
|
43
42
|
* @returns Normalized IP address string.
|
|
44
43
|
*/
|
|
45
44
|
function normalizeIp(ip) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return ip;
|
|
45
|
+
if (!ip) return ip;
|
|
46
|
+
// Remove IPv4-mapped IPv6 prefix (::ffff:) to get clean IPv4 address
|
|
47
|
+
if (ip.startsWith('::ffff:')) {
|
|
48
|
+
return ip.substring(7);
|
|
49
|
+
}
|
|
50
|
+
return ip;
|
|
53
51
|
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unnbound-events",
|
|
3
3
|
"description": "Unified events SDK to handle HTTP routes and SQS messages with a single routing API.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.21",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"test": "jest",
|
|
10
|
-
"test:coverage": "jest --coverage",
|
|
11
|
-
"test:watch": "jest --watch",
|
|
12
|
-
"typecheck": "tsc -noEmit",
|
|
13
|
-
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
|
|
14
|
-
"lint:fix": "pnpm lint --fix",
|
|
15
|
-
"format": "prettier --write .",
|
|
16
|
-
"format:check": "prettier --check .",
|
|
17
|
-
"prepublishOnly": "pnpm build",
|
|
18
|
-
"start:example:express": "npx --yes tsx --watch examples/express.ts",
|
|
19
|
-
"start:example:sqs": "npx --yes tsx --watch examples/sqs.ts",
|
|
20
|
-
"start:example:http-and-sqs": "npx --yes tsx --watch examples/http-and-sqs.ts",
|
|
21
|
-
"version:bump": "npm version patch"
|
|
22
|
-
},
|
|
23
7
|
"author": "Unnbound Team",
|
|
24
8
|
"license": "MIT",
|
|
25
9
|
"repository": {
|
|
@@ -31,10 +15,11 @@
|
|
|
31
15
|
"url": "https://github.com/unnbounddev/unnbound-sdks/issues"
|
|
32
16
|
},
|
|
33
17
|
"dependencies": {
|
|
34
|
-
"express": "^4.0.0 || ^5.0.0",
|
|
35
|
-
"@aws-sdk/client-sqs": "^3.0.0",
|
|
36
18
|
"@aws-sdk/client-s3": "^3.0.0",
|
|
37
|
-
"
|
|
19
|
+
"@aws-sdk/client-sqs": "^3.0.0",
|
|
20
|
+
"axios": "^1.12.2",
|
|
21
|
+
"express": "^4.0.0 || ^5.0.0",
|
|
22
|
+
"unnbound-logger-sdk": "3.0.23"
|
|
38
23
|
},
|
|
39
24
|
"peerDependencies": {
|
|
40
25
|
"express": "^4.0.0 || ^5.0.0"
|
|
@@ -57,5 +42,20 @@
|
|
|
57
42
|
"engines": {
|
|
58
43
|
"node": ">=22"
|
|
59
44
|
},
|
|
60
|
-
"sideEffects": false
|
|
61
|
-
|
|
45
|
+
"sideEffects": false,
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc",
|
|
48
|
+
"test": "jest",
|
|
49
|
+
"test:coverage": "jest --coverage",
|
|
50
|
+
"test:watch": "jest --watch",
|
|
51
|
+
"typecheck": "tsc -noEmit",
|
|
52
|
+
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
|
|
53
|
+
"lint:fix": "pnpm lint --fix",
|
|
54
|
+
"format": "prettier --write .",
|
|
55
|
+
"format:check": "prettier --check .",
|
|
56
|
+
"start:example:express": "npx --yes tsx --watch examples/express.ts",
|
|
57
|
+
"start:example:sqs": "npx --yes tsx --watch examples/sqs.ts",
|
|
58
|
+
"start:example:http-and-sqs": "npx --yes tsx --watch examples/http-and-sqs.ts",
|
|
59
|
+
"version:bump": "npm version patch"
|
|
60
|
+
}
|
|
61
|
+
}
|