serverless-event-orchestrator 1.2.6 → 1.2.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-matcher.d.ts","sourceRoot":"","sources":["../../src/utils/path-matcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"path-matcher.d.ts","sourceRoot":"","sources":["../../src/utils/path-matcher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAsBvF;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CActF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYlD"}
|
|
@@ -15,8 +15,11 @@ exports.normalizePath = normalizePath;
|
|
|
15
15
|
*/
|
|
16
16
|
function patternToRegex(pattern) {
|
|
17
17
|
const paramNames = [];
|
|
18
|
+
// First, handle :paramName format (Express style) BEFORE escaping
|
|
19
|
+
// This converts :id to {id} for uniform processing
|
|
20
|
+
let normalizedPattern = pattern.replace(/:(\w+)/g, '{$1}');
|
|
18
21
|
// Escape special regex characters except for our parameter syntax
|
|
19
|
-
let regexPattern =
|
|
22
|
+
let regexPattern = normalizedPattern
|
|
20
23
|
.replace(/[.+?^${}()|[\]\\]/g, '\\$&')
|
|
21
24
|
.replace(/\\\{(\w+)\\\}/g, (_, paramName) => {
|
|
22
25
|
paramNames.push(paramName);
|
|
@@ -53,7 +56,8 @@ function matchPath(pattern, path) {
|
|
|
53
56
|
* @returns True if pattern has parameters
|
|
54
57
|
*/
|
|
55
58
|
function hasPathParameters(pattern) {
|
|
56
|
-
|
|
59
|
+
// Support both {id} and :id formats
|
|
60
|
+
return /\{[\w]+\}/.test(pattern) || /:[\w]+/.test(pattern);
|
|
57
61
|
}
|
|
58
62
|
/**
|
|
59
63
|
* Normalizes a path by removing trailing slashes and ensuring leading slash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-matcher.js","sourceRoot":"","sources":["../../src/utils/path-matcher.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAOH,
|
|
1
|
+
{"version":3,"file":"path-matcher.js","sourceRoot":"","sources":["../../src/utils/path-matcher.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAOH,wCAsBC;AAQD,8BAcC;AAOD,8CAGC;AAOD,sCAYC;AA9ED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAe;IAC5C,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,kEAAkE;IAClE,mDAAmD;IACnD,IAAI,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAE3D,kEAAkE;IAClE,IAAI,YAAY,GAAG,iBAAiB;SACjC,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC;SACrC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE;QAC1C,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;IAEL,qBAAqB;IACrB,YAAY,GAAG,IAAI,YAAY,GAAG,CAAC;IAEnC,OAAO;QAC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ACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serverless-event-orchestrator",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "A lightweight, type-safe event dispatcher and middleware orchestrator for AWS Lambda. Designed for hexagonal architectures with support for segmented routing (public, private, backoffice), Cognito User Pool validation, and built-in infrastructure middlewares.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,18 +10,22 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export function patternToRegex(pattern: string): { regex: RegExp; paramNames: string[] } {
|
|
12
12
|
const paramNames: string[] = [];
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
// First, handle :paramName format (Express style) BEFORE escaping
|
|
15
|
+
// This converts :id to {id} for uniform processing
|
|
16
|
+
let normalizedPattern = pattern.replace(/:(\w+)/g, '{$1}');
|
|
17
|
+
|
|
14
18
|
// Escape special regex characters except for our parameter syntax
|
|
15
|
-
let regexPattern =
|
|
19
|
+
let regexPattern = normalizedPattern
|
|
16
20
|
.replace(/[.+?^${}()|[\]\\]/g, '\\$&')
|
|
17
21
|
.replace(/\\\{(\w+)\\\}/g, (_, paramName) => {
|
|
18
22
|
paramNames.push(paramName);
|
|
19
23
|
return '([^/]+)';
|
|
20
24
|
});
|
|
21
|
-
|
|
25
|
+
|
|
22
26
|
// Ensure exact match
|
|
23
27
|
regexPattern = `^${regexPattern}$`;
|
|
24
|
-
|
|
28
|
+
|
|
25
29
|
return {
|
|
26
30
|
regex: new RegExp(regexPattern),
|
|
27
31
|
paramNames,
|
|
@@ -56,7 +60,8 @@ export function matchPath(pattern: string, path: string): Record<string, string>
|
|
|
56
60
|
* @returns True if pattern has parameters
|
|
57
61
|
*/
|
|
58
62
|
export function hasPathParameters(pattern: string): boolean {
|
|
59
|
-
|
|
63
|
+
// Support both {id} and :id formats
|
|
64
|
+
return /\{[\w]+\}/.test(pattern) || /:[\w]+/.test(pattern);
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
/**
|