Fixed path event has checks
All checks were successful
Build / Publish Docs (push) Successful in 1m1s
Build / Build NPM Project (push) Successful in 1m16s
Build / Tag Version (push) Successful in 8s

This commit is contained in:
2025-11-29 11:27:47 -05:00
parent 326f6fe851
commit 3e9052c4a7
3 changed files with 17 additions and 10 deletions

View File

@@ -40,6 +40,7 @@ export function PE(str: TemplateStringsArray, ...args: any[]) {
* @param {TemplateStringsArray} str
* @param {string} args
* @return {string}
* @constructor
*/
export function PES(str: TemplateStringsArray, ...args: any[]) {
let combined = [];
@@ -292,11 +293,7 @@ export class PathEvent {
static filter(target: string | PathEvent | (string | PathEvent)[], ...filter: (string | PathEvent)[]): PathEvent[] {
const parsedTarget = makeArray(target).map(pe => pe instanceof PathEvent ? pe : new PathEvent(pe));
const parsedFilter = makeArray(filter).map(pe => pe instanceof PathEvent ? pe : new PathEvent(pe));
return parsedTarget.filter(t => {
const combined = PathEvent.combine(t);
return !!parsedFilter.find(r => PathEvent.matches(r, combined));
});
return parsedTarget.filter(t => !!parsedFilter.find(r => PathEvent.matches(r, t)));
}
/**
@@ -338,10 +335,8 @@ export class PathEvent {
const parsedTarget = makeArray(target).map(pe => pe instanceof PathEvent ? pe : new PathEvent(pe));
const parsedRequired = makeArray(has).map(pe => pe instanceof PathEvent ? pe : new PathEvent(pe));
// If target is a single item, check directly; if multiple, combine first
const effectiveTarget = parsedTarget.length === 1 ? parsedTarget[0] : PathEvent.combine(...parsedTarget);
return !!parsedRequired.find(r => PathEvent.matches(r, effectiveTarget));
// Check if any target permission matches any required permission
return !!parsedRequired.find(r => !!parsedTarget.find(t => PathEvent.matches(r, t)));
}
/**