@aliou/pi-guardrails 0.14.0 → 0.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliou/pi-guardrails",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -5,7 +5,12 @@ export function shouldRun(config: GuardrailsConfig): boolean {
5
5
  const raw = config as Record<string, unknown>;
6
6
  const pathAccess = raw.pathAccess as Record<string, unknown> | undefined;
7
7
  if (!Array.isArray(pathAccess?.allowedPaths)) return false;
8
- return pathAccess.allowedPaths.some((item) => typeof item !== "string");
8
+ return pathAccess.allowedPaths.some(
9
+ (item) =>
10
+ typeof item === "object" &&
11
+ item !== null &&
12
+ typeof (item as Record<string, unknown>).pattern === "string",
13
+ );
9
14
  }
10
15
 
11
16
  export function run(config: GuardrailsConfig): GuardrailsConfig {
@@ -27,8 +32,11 @@ function normalizeAllowedPaths(items: unknown): string[] {
27
32
  if (typeof item === "string") {
28
33
  path = item;
29
34
  } else if (typeof item === "object" && item !== null) {
30
- const pattern = (item as Record<string, unknown>).pattern;
35
+ const obj = item as Record<string, unknown>;
36
+ const pattern = obj.pattern;
37
+ const objectPath = obj.path;
31
38
  if (typeof pattern === "string") path = pattern;
39
+ else if (typeof objectPath === "string") path = objectPath;
32
40
  }
33
41
 
34
42
  const normalized = path?.trim();