@nevermined-io/core-kit 0.0.51 → 0.0.52

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":"AgentUtils.d.ts","sourceRoot":"","sources":["../../../src/nevermined/utils/AgentUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,iBAAiB,EAAE,MAAM,EACzB,cAAc,EAAE,WAAW,EAAE,EAC7B,kBAAkB,GAAE,MAAM,EAAO,GAChC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,GAAG,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAqChE;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAOvE"}
1
+ {"version":3,"file":"AgentUtils.d.ts","sourceRoot":"","sources":["../../../src/nevermined/utils/AgentUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,iBAAiB,EAAE,MAAM,EACzB,cAAc,EAAE,WAAW,EAAE,EAC7B,kBAAkB,GAAE,MAAM,EAAO,GAChC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,GAAG,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAkDhE;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAOvE"}
@@ -7,25 +7,38 @@ export function isEndpointRequestedIncluded(requestEndpoint, requestedHTTPVerb,
7
7
  const requestedUrl = new URL(requestEndpoint);
8
8
  // Is the endpoint an open endpoint?
9
9
  for (const openEndpoint of agentOpenEndpoints) {
10
- const agentUrl = new URL(openEndpoint);
11
- if (areUrlsEqualIgnoringQuery(agentUrl, requestedUrl)) {
12
- urlMatching = new URL(openEndpoint);
13
- matches = true;
14
- break;
10
+ try {
11
+ const agentUrl = new URL(openEndpoint);
12
+ if (areUrlsEqualIgnoringQuery(agentUrl, requestedUrl)) {
13
+ urlMatching = new URL(openEndpoint);
14
+ matches = true;
15
+ break;
16
+ }
17
+ }
18
+ catch (error) {
19
+ // Skip invalid URLs and continue with next endpoint
20
+ continue;
15
21
  }
16
22
  }
17
23
  if (matches)
18
24
  return { matches: true, urlMatching };
19
25
  // check if the endpoint/verb is part of the list
20
26
  for (const ep of agentEndpoints) {
21
- const [verb, url] = Object.entries(ep)[0];
22
- const _url = new URL(url);
23
- const fn = match(_url.pathname, { decode: decodeURIComponent });
24
- if (fn(requestedUrl.pathname) && (verb.toLowerCase() === requestedHTTPVerb || verb === '*')) {
25
- matches = true;
26
- urlMatching = _url;
27
- verbMatching = verb;
28
- break;
27
+ try {
28
+ const [verb, url] = Object.entries(ep)[0];
29
+ const _url = new URL(url);
30
+ const fn = match(_url.pathname, { decode: decodeURIComponent });
31
+ if (fn(requestedUrl.pathname) &&
32
+ (verb.toLowerCase() === requestedHTTPVerb || verb === '*')) {
33
+ matches = true;
34
+ urlMatching = _url;
35
+ verbMatching = verb;
36
+ break;
37
+ }
38
+ }
39
+ catch (error) {
40
+ // Skip invalid patterns and continue with next endpoint
41
+ continue;
29
42
  }
30
43
  }
31
44
  return { matches, urlMatching, verbMatching };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nevermined-io/core-kit",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",