ui5-lib-guard-router 1.6.2 → 1.7.0

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.
Files changed (67) hide show
  1. package/{dist/.ui5 → .ui5}/build-manifest.json +56 -8
  2. package/CHANGELOG.md +190 -0
  3. package/README.md +695 -327
  4. package/dist/index.d.ts +9 -5
  5. package/dist/resources/ui5/guard/router/.library +1 -1
  6. package/dist/resources/ui5/guard/router/GuardConfig-dbg.js +222 -0
  7. package/dist/resources/ui5/guard/router/GuardConfig-dbg.js.map +1 -0
  8. package/dist/resources/ui5/guard/router/GuardConfig.d.ts +89 -0
  9. package/dist/resources/ui5/guard/router/GuardConfig.d.ts.map +1 -0
  10. package/dist/resources/ui5/guard/router/GuardConfig.js +2 -0
  11. package/dist/resources/ui5/guard/router/GuardConfig.js.map +1 -0
  12. package/dist/resources/ui5/guard/router/GuardModules-dbg.js +253 -0
  13. package/dist/resources/ui5/guard/router/GuardModules-dbg.js.map +1 -0
  14. package/dist/resources/ui5/guard/router/GuardModules.d.ts +72 -0
  15. package/dist/resources/ui5/guard/router/GuardModules.d.ts.map +1 -0
  16. package/dist/resources/ui5/guard/router/GuardModules.js +2 -0
  17. package/dist/resources/ui5/guard/router/GuardModules.js.map +1 -0
  18. package/dist/resources/ui5/guard/router/GuardPipeline-dbg.js +122 -121
  19. package/dist/resources/ui5/guard/router/GuardPipeline-dbg.js.map +1 -1
  20. package/dist/resources/ui5/guard/router/GuardPipeline.d.ts +45 -26
  21. package/dist/resources/ui5/guard/router/GuardPipeline.d.ts.map +1 -1
  22. package/dist/resources/ui5/guard/router/GuardPipeline.js +1 -1
  23. package/dist/resources/ui5/guard/router/GuardPipeline.js.map +1 -1
  24. package/dist/resources/ui5/guard/router/NavigationOutcome-dbg.js +3 -3
  25. package/dist/resources/ui5/guard/router/NavigationOutcome-dbg.js.map +1 -1
  26. package/dist/resources/ui5/guard/router/NavigationOutcome.d.ts +3 -3
  27. package/dist/resources/ui5/guard/router/NavigationOutcome.d.ts.map +1 -1
  28. package/dist/resources/ui5/guard/router/NavigationOutcome.js.map +1 -1
  29. package/dist/resources/ui5/guard/router/PatternTree-dbg.js +156 -0
  30. package/dist/resources/ui5/guard/router/PatternTree-dbg.js.map +1 -0
  31. package/dist/resources/ui5/guard/router/PatternTree.d.ts +71 -0
  32. package/dist/resources/ui5/guard/router/PatternTree.d.ts.map +1 -0
  33. package/dist/resources/ui5/guard/router/PatternTree.js +2 -0
  34. package/dist/resources/ui5/guard/router/PatternTree.js.map +1 -0
  35. package/dist/resources/ui5/guard/router/RouteMeta-dbg.js +84 -0
  36. package/dist/resources/ui5/guard/router/RouteMeta-dbg.js.map +1 -0
  37. package/dist/resources/ui5/guard/router/RouteMeta.d.ts +33 -0
  38. package/dist/resources/ui5/guard/router/RouteMeta.d.ts.map +1 -0
  39. package/dist/resources/ui5/guard/router/RouteMeta.js +2 -0
  40. package/dist/resources/ui5/guard/router/RouteMeta.js.map +1 -0
  41. package/dist/resources/ui5/guard/router/Router-dbg.js +882 -1020
  42. package/dist/resources/ui5/guard/router/Router-dbg.js.map +1 -1
  43. package/dist/resources/ui5/guard/router/Router.d.ts +360 -211
  44. package/dist/resources/ui5/guard/router/Router.d.ts.map +1 -1
  45. package/dist/resources/ui5/guard/router/Router.js +1 -1
  46. package/dist/resources/ui5/guard/router/Router.js.map +1 -1
  47. package/dist/resources/ui5/guard/router/library-dbg.js +1 -1
  48. package/dist/resources/ui5/guard/router/library-dbg.js.map +1 -1
  49. package/dist/resources/ui5/guard/router/library-preload.js +8 -4
  50. package/dist/resources/ui5/guard/router/library-preload.js.map +1 -1
  51. package/dist/resources/ui5/guard/router/library.js +1 -1
  52. package/dist/resources/ui5/guard/router/library.js.map +1 -1
  53. package/dist/resources/ui5/guard/router/manifest.json +5 -2
  54. package/dist/resources/ui5/guard/router/types-dbg.js.map +1 -1
  55. package/dist/resources/ui5/guard/router/types.d.ts +94 -39
  56. package/dist/resources/ui5/guard/router/types.d.ts.map +1 -1
  57. package/package.json +10 -6
  58. package/src/GuardConfig.ts +272 -0
  59. package/src/GuardModules.ts +249 -0
  60. package/src/GuardPipeline.ts +155 -128
  61. package/src/NavigationOutcome.ts +3 -3
  62. package/src/PatternTree.ts +145 -0
  63. package/src/RouteMeta.ts +82 -0
  64. package/src/Router.ts +1089 -1130
  65. package/src/manifest.json +5 -2
  66. package/src/types.ts +79 -22
  67. package/tsconfig.json +0 -11
@@ -1 +1 @@
1
- {"version":3,"file":"GuardPipeline.d.ts","sourceRoot":"../../../../..","sources":["src/GuardPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,gCAAgC,CAAC;IAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAe,aAAa,EAAE,MAAM,wBAAwB,CAAC;IAEhG,MAAM,aAAa,4BAA4B,CAAC;IAEhD,SAAS,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAO/D;IAED;;;;;OAKG;IACH,SAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAMxE;IAED;;OAEG;IACH,KAAY,aAAa,GACtB;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GACnB;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GACnB;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAA;KAAE,GACtD;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAEvC;;;;;;;;;OASG;IACH,MAAM,CAAC,OAAO,OAAO,aAAa;QACjC,OAAO,CAAC,aAAa,CAAiB;QACtC,OAAO,CAAC,YAAY,CAAgC;QACpD,OAAO,CAAC,YAAY,CAAgC;QAEpD,uDAAuD;QACvD,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;QAIpC,gEAAgE;QACh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="object"||r===null){return false}const{route:e}=r;return typeof e==="string"&&e.length>0}function a(r){if(typeof r!=="object"&&typeof r!=="function"||r===null){return false}return typeof r.then==="function"}class n{_globalGuards=[];_enterGuards=new Map;_leaveGuards=new Map;addGlobalGuard(r){this._globalGuards.push(r)}removeGlobalGuard(r){const e=this._globalGuards.indexOf(r);if(e!==-1){this._globalGuards.splice(e,1)}}addEnterGuard(r,e){this._addToGuardMap(this._enterGuards,r,e)}removeEnterGuard(r,e){this._removeFromGuardMap(this._enterGuards,r,e)}addLeaveGuard(r,e){this._addToGuardMap(this._leaveGuards,r,e)}removeLeaveGuard(r,e){this._removeFromGuardMap(this._leaveGuards,r,e)}clear(){this._globalGuards=[];this._enterGuards.clear();this._leaveGuards.clear()}evaluate(r,e){const t=!e?.skipLeaveGuards&&r.fromRoute!==""&&this._leaveGuards.has(r.fromRoute);const n=this._globalGuards.length>0||r.toRoute!==""&&this._enterGuards.has(r.toRoute);if(!t&&!n){return{action:"allow"}}const u=r=>{if(a(r)){return r.then(r=>{if(r===true)return{action:"allow"};if(r===false)return{action:"block"};return{action:"redirect",target:r}}).catch(r=>({action:"error",error:r}))}if(r===true)return{action:"allow"};if(r===false)return{action:"block"};return{action:"redirect",target:r}};const o=()=>{const e=this._runEnterGuards(r.toRoute,r);return u(e)};try{if(t){const e=this._runLeaveGuards(r);if(a(e)){return e.then(e=>{if(e!==true)return{action:"block"};if(r.signal.aborted)return{action:"block"};return o()}).catch(r=>({action:"error",error:r}))}if(e!==true)return{action:"block"}}return o()}catch(r){return{action:"error",error:r}}}_addToGuardMap(r,e,t){let a=r.get(e);if(!a){a=[];r.set(e,a)}a.push(t)}_removeFromGuardMap(r,e,t){const a=r.get(e);if(!a)return;const n=a.indexOf(t);if(n!==-1)a.splice(n,1);if(a.length===0)r.delete(e)}_runLeaveGuards(t){const n=this._leaveGuards.get(t.fromRoute);if(!n||n.length===0)return true;const u=n.slice();for(let n=0;n<u.length;n++){try{const r=u[n](t);if(a(r)){return this._continueGuardsAsync(r,u,n,t,r=>this._validateLeaveGuardResult(r),"Leave guard",true)}if(r!==true)return this._validateLeaveGuardResult(r)}catch(a){r.error(`Leave guard [${n}] on route "${t.fromRoute}" threw, navigation failed`,a instanceof Error?a:String(a),e);if(t.signal.aborted)return false;throw a}}return true}_runEnterGuards(r,e){const t=this._runGuards(this._globalGuards,e);if(a(t)){return t.then(t=>{if(t!==true)return t;if(e.signal.aborted)return false;return this._runRouteGuards(r,e)})}if(t!==true)return t;return this._runRouteGuards(r,e)}_runRouteGuards(r,e){if(!r||!this._enterGuards.has(r))return true;return this._runGuards(this._enterGuards.get(r),e)}_runGuards(t,n){t=t.slice();for(let u=0;u<t.length;u++){try{const r=t[u](n);if(a(r)){return this._continueGuardsAsync(r,t,u,n,r=>this._validateGuardResult(r),"Enter guard",false)}if(r!==true)return this._validateGuardResult(r)}catch(t){r.error(`Enter guard [${u}] on route "${n.toRoute}" threw, navigation failed`,t instanceof Error?t:String(t),e);if(n.signal.aborted)return false;throw t}}return true}async _continueGuardsAsync(t,a,n,u,o,i,s){let l=n;try{const r=await t;if(r!==true)return o(r);for(let r=n+1;r<a.length;r++){if(u.signal.aborted)return false;l=r;const e=await a[r](u);if(e!==true)return o(e)}return true}catch(t){if(!u.signal.aborted){const a=s?u.fromRoute:u.toRoute;r.error(`${i} [${l}] on route "${a}" threw, navigation failed`,t instanceof Error?t:String(t),e);throw t}return false}}_validateGuardResult(a){if(typeof a==="boolean")return a;if(typeof a==="string"&&a.length>0)return a;if(t(a))return a;r.warning("Guard returned invalid value, treating as block",String(a),e);return false}_validateLeaveGuardResult(t){if(typeof t==="boolean")return t;r.warning("Leave guard returned non-boolean value, treating as block",String(t),e);return false}}n.isPromiseLike=a;return n});
1
+ sap.ui.define(["sap/base/Log"],function(r){"use strict";const e="ui5.guard.router.Router";function t(r){if(typeof r!=="object"||r===null){return false}return"route"in r&&typeof r.route==="string"&&r.route.length>0}function n(r){if(typeof r!=="object"&&typeof r!=="function"||r===null){return false}return"then"in r&&typeof r.then==="function"}let a;void new Promise(r=>{a=Function.prototype.toString.call(r)});function u(r){return typeof r==="function"&&r.name===""&&r.length===1&&Function.prototype.toString.call(r)===a}const i=new WeakMap;function o(r,e){i.set(r,e)}function s(r,e,t){const n=i.get(t);return n===undefined?`${r} [${e}]`:`${r} [${e}] "${n}"`}function l(r){if(r===true)return{action:"allow"};if(r===false)return{action:"block"};return{action:"redirect",target:r}}function d(r){return{action:"error",error:r}}class c{_globalGuards=[];_enterGuards=new Map;_leaveGuards=new Map;addGlobalGuard(r){this._globalGuards.push(r)}removeGlobalGuard(r){const e=this._globalGuards.indexOf(r);if(e!==-1){this._globalGuards.splice(e,1)}}addEnterGuard(r,e,t){this._addToGuardMap(this._enterGuards,r,e,t)}removeEnterGuard(r,e){this._removeFromGuardMap(this._enterGuards,r,e)}addLeaveGuard(r,e,t){this._addToGuardMap(this._leaveGuards,r,e,t)}removeLeaveGuard(r,e){this._removeFromGuardMap(this._leaveGuards,r,e)}clear(){this._globalGuards=[];this._enterGuards.clear();this._leaveGuards.clear()}evaluate(r,e){const t=e?.skipLeaveGuards||r.fromRoute===""?[]:[r.fromRoute,...e?.alsoLeaving??[]];const a=[r.toRoute,...e?.alsoEntering??[]];const u=()=>{const e=this._runEnterGuards(a,r);return n(e)?e.then(l).catch(d):l(e)};try{const e=this._runForEach(t,r,e=>this._runGuards(this._leaveGuards.get(e)??[],r,e,r=>this._validateLeaveGuardResult(r),"Leave guard"));if(n(e)){return e.then(e=>{if(e!==true)return{action:"block"};if(r.signal.aborted)return{action:"block"};return u()}).catch(d)}if(e!==true)return{action:"block"};return u()}catch(r){return d(r)}}_addToGuardMap(r,e,t,n){let a=r.get(e);if(!a){a=[];r.set(e,a)}const u=n===undefined?-1:a.indexOf(n);if(u===-1)a.push(t);else a.splice(u,0,t)}_removeFromGuardMap(r,e,t){const n=r.get(e);if(!n)return;const a=n.indexOf(t);if(a!==-1)n.splice(a,1);if(n.length===0)r.delete(e)}_runForEach(r,e,t,a=0){for(let u=a;u<r.length;u++){const a=t(r[u]);if(n(a)){return a.then(n=>{if(n!==true)return n;if(e.signal.aborted)return false;return this._runForEach(r,e,t,u+1)})}if(a!==true)return a}return true}_runEnterGuards(r,e){const t=()=>this._runForEach(r,e,r=>this._runRouteGuards(r,e));const a=this._runGuards(this._globalGuards,e,e.toRoute,r=>this._validateGuardResult(r),"Enter guard");if(n(a)){return a.then(r=>{if(r!==true)return r;if(e.signal.aborted)return false;return t()})}if(a!==true)return a;return t()}_runRouteGuards(r,e){const t=r?this._enterGuards.get(r):undefined;if(!t)return true;return this._runGuards(t,e,r,r=>this._validateGuardResult(r),"Enter guard")}_runGuards(t,a,u,i,o){t=t.slice();for(let l=0;l<t.length;l++){try{const r=t[l](a);if(n(r)){return this._continueGuardsAsync(r,t,l,a,i,o,u)}if(r!==true)return i(r)}catch(n){if(a.signal.aborted)return false;r.error(`${s(o,l,t[l])} on route "${u}" threw, navigation failed`,n instanceof Error?n:String(n),e);throw n}}return true}async _continueGuardsAsync(t,n,a,u,i,o,l){let d=a;try{const r=await t;if(r!==true)return i(r);for(let r=a+1;r<n.length;r++){if(u.signal.aborted)return false;d=r;const e=await n[r](u);if(e!==true)return i(e)}return true}catch(t){if(!u.signal.aborted){r.error(`${s(o,d,n[d])} on route "${l}" threw, navigation failed`,t instanceof Error?t:String(t),e);throw t}return false}}_validateGuardResult(n){if(typeof n==="boolean")return n;if(typeof n==="string"&&n.length>0)return n;if(t(n))return n;r.warning("Guard returned invalid value, treating as block",String(n),e);return false}_validateLeaveGuardResult(t){if(typeof t==="boolean")return t;r.warning("Leave guard returned non-boolean value, treating as block",String(t),e);return false}}c.LOG_COMPONENT=e;c.isPromiseLike=n;c.isPromiseResolver=u;c.nameGuard=o;return c});
2
2
  //# sourceMappingURL=GuardPipeline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GuardPipeline.js","names":["LOG_COMPONENT","isGuardRedirect","value","route","length","isPromiseLike","then","GuardPipeline","_globalGuards","_enterGuards","Map","_leaveGuards","addGlobalGuard","guard","this","push","removeGlobalGuard","index","indexOf","splice","addEnterGuard","_addToGuardMap","removeEnterGuard","_removeFromGuardMap","addLeaveGuard","removeLeaveGuard","clear","evaluate","context","options","hasLeaveGuards","skipLeaveGuards","fromRoute","has","hasEnterGuards","toRoute","action","processEnterResult","enterResult","r","target","catch","error","runEnterPhase","_runEnterGuards","leaveResult","_runLeaveGuards","allowed","signal","aborted","map","key","guards","get","set","delete","registered","slice","i","result","_continueGuardsAsync","candidate","_validateLeaveGuardResult","Log","Error","String","globalResult","_runGuards","_runRouteGuards","_validateGuardResult","pendingResult","currentIndex","onBlock","label","isLeaveGuard","guardIndex","nextResult","warning"],"sources":["GuardPipeline.ts"],"sourcesContent":["import Log from \"sap/base/Log\";\nimport type { GuardFn, GuardContext, GuardResult, GuardRedirect } from \"./types\";\n\nconst LOG_COMPONENT = \"ui5.guard.router.Router\";\n\nfunction isGuardRedirect(value: unknown): value is GuardRedirect {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\n\tconst { route } = value as GuardRedirect;\n\treturn typeof route === \"string\" && route.length > 0;\n}\n\n/**\n * Promises/A+ thenable detection via duck typing.\n *\n * We intentionally do not use `instanceof Promise` because that misses\n * cross-realm Promises and PromiseLike/thenable objects.\n */\nexport function isPromiseLike<T>(value: unknown): value is PromiseLike<T> {\n\tif ((typeof value !== \"object\" && typeof value !== \"function\") || value === null) {\n\t\treturn false;\n\t}\n\n\treturn typeof (value as PromiseLike<T>).then === \"function\";\n}\n\n/**\n * Normalized result of the guard decision pipeline.\n */\nexport type GuardDecision =\n\t| { action: \"allow\" }\n\t| { action: \"block\" }\n\t| { action: \"redirect\"; target: string | GuardRedirect }\n\t| { action: \"error\"; error: unknown };\n\n/**\n * Standalone guard evaluation pipeline.\n *\n * Owns guard storage (global, enter, leave) and runs the full\n * leave -> global-enter -> route-enter pipeline. Pure logic with\n * no dependency on Router state beyond the current route name\n * passed into evaluate().\n *\n * @namespace ui5.guard.router\n */\nexport default class GuardPipeline {\n\tprivate _globalGuards: GuardFn[] = [];\n\tprivate _enterGuards = new Map<string, GuardFn[]>();\n\tprivate _leaveGuards = new Map<string, GuardFn[]>();\n\n\t/** Register a guard that runs for every navigation. */\n\taddGlobalGuard(guard: GuardFn): void {\n\t\tthis._globalGuards.push(guard);\n\t}\n\n\t/** Remove a previously registered global guard by reference. */\n\tremoveGlobalGuard(guard: GuardFn): void {\n\t\tconst index = this._globalGuards.indexOf(guard);\n\t\tif (index !== -1) {\n\t\t\tthis._globalGuards.splice(index, 1);\n\t\t}\n\t}\n\n\t/**\n\t * Register an enter guard for a specific route.\n\t *\n\t * @param route - Route name as defined in `manifest.json`.\n\t * @param guard - Guard function to register.\n\t */\n\taddEnterGuard(route: string, guard: GuardFn): void {\n\t\tthis._addToGuardMap(this._enterGuards, route, guard);\n\t}\n\n\t/**\n\t * Remove a previously registered enter guard by reference.\n\t *\n\t * @param route - Route name.\n\t * @param guard - Guard function to remove.\n\t */\n\tremoveEnterGuard(route: string, guard: GuardFn): void {\n\t\tthis._removeFromGuardMap(this._enterGuards, route, guard);\n\t}\n\n\t/**\n\t * Register a leave guard for a specific route.\n\t *\n\t * Accepts `GuardFn` to support manifest-declared guards loaded from\n\t * untyped modules. Non-boolean return values are caught at runtime\n\t * by {@link _validateLeaveGuardResult}.\n\t *\n\t * @param route - Route name as defined in `manifest.json`.\n\t * @param guard - Guard function to register as a leave guard.\n\t */\n\taddLeaveGuard(route: string, guard: GuardFn): void {\n\t\tthis._addToGuardMap(this._leaveGuards, route, guard);\n\t}\n\n\t/**\n\t * Remove a previously registered leave guard by reference.\n\t *\n\t * @param route - Route name.\n\t * @param guard - Guard function to remove.\n\t */\n\tremoveLeaveGuard(route: string, guard: GuardFn): void {\n\t\tthis._removeFromGuardMap(this._leaveGuards, route, guard);\n\t}\n\n\t/**\n\t * Remove all registered guards.\n\t */\n\tclear(): void {\n\t\tthis._globalGuards = [];\n\t\tthis._enterGuards.clear();\n\t\tthis._leaveGuards.clear();\n\t}\n\n\t/**\n\t * Run the full guard pipeline (leave -> global enter -> route enter) and\n\t * return a normalized decision. Stays synchronous when all guards return\n\t * plain values; returns a Promise only when an async guard is encountered.\n\t *\n\t * @param context - Complete guard context including AbortSignal.\n\t * `context.fromRoute` controls leave-guard lookup: empty string skips leave guards.\n\t * @param options - Optional evaluation options.\n\t * @param options.skipLeaveGuards - When true, leave guards are skipped even if\n\t * `context.fromRoute` is set. Used by redirect chain hops to avoid re-running\n\t * leave guards while still preserving `fromRoute` in the context.\n\t * @returns A synchronous {@link GuardDecision} when all guards return plain values,\n\t * or a `Promise<GuardDecision>` when at least one guard returns a thenable.\n\t */\n\tevaluate(context: GuardContext, options?: { skipLeaveGuards?: boolean }): GuardDecision | Promise<GuardDecision> {\n\t\tconst hasLeaveGuards =\n\t\t\t!options?.skipLeaveGuards && context.fromRoute !== \"\" && this._leaveGuards.has(context.fromRoute);\n\t\tconst hasEnterGuards =\n\t\t\tthis._globalGuards.length > 0 || (context.toRoute !== \"\" && this._enterGuards.has(context.toRoute));\n\n\t\tif (!hasLeaveGuards && !hasEnterGuards) {\n\t\t\treturn { action: \"allow\" };\n\t\t}\n\n\t\tconst processEnterResult = (\n\t\t\tenterResult: GuardResult | Promise<GuardResult>,\n\t\t): GuardDecision | Promise<GuardDecision> => {\n\t\t\tif (isPromiseLike(enterResult)) {\n\t\t\t\treturn enterResult\n\t\t\t\t\t.then((r: GuardResult): GuardDecision => {\n\t\t\t\t\t\tif (r === true) return { action: \"allow\" };\n\t\t\t\t\t\tif (r === false) return { action: \"block\" };\n\t\t\t\t\t\treturn { action: \"redirect\", target: r };\n\t\t\t\t\t})\n\t\t\t\t\t.catch((error: unknown): GuardDecision => {\n\t\t\t\t\t\treturn { action: \"error\", error };\n\t\t\t\t\t});\n\t\t\t}\n\t\t\tif (enterResult === true) return { action: \"allow\" };\n\t\t\tif (enterResult === false) return { action: \"block\" };\n\t\t\treturn { action: \"redirect\", target: enterResult };\n\t\t};\n\n\t\tconst runEnterPhase = (): GuardDecision | Promise<GuardDecision> => {\n\t\t\tconst enterResult = this._runEnterGuards(context.toRoute, context);\n\t\t\treturn processEnterResult(enterResult);\n\t\t};\n\n\t\ttry {\n\t\t\tif (hasLeaveGuards) {\n\t\t\t\tconst leaveResult = this._runLeaveGuards(context);\n\n\t\t\t\tif (isPromiseLike(leaveResult)) {\n\t\t\t\t\treturn leaveResult\n\t\t\t\t\t\t.then((allowed: boolean): GuardDecision | Promise<GuardDecision> => {\n\t\t\t\t\t\t\tif (allowed !== true) return { action: \"block\" };\n\t\t\t\t\t\t\tif (context.signal.aborted) return { action: \"block\" };\n\t\t\t\t\t\t\treturn runEnterPhase();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((error: unknown): GuardDecision => {\n\t\t\t\t\t\t\treturn { action: \"error\", error };\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (leaveResult !== true) return { action: \"block\" };\n\t\t\t}\n\n\t\t\treturn runEnterPhase();\n\t\t} catch (error) {\n\t\t\treturn { action: \"error\", error };\n\t\t}\n\t}\n\n\tprivate _addToGuardMap<T>(map: Map<string, T[]>, key: string, guard: T): void {\n\t\tlet guards = map.get(key);\n\t\tif (!guards) {\n\t\t\tguards = [];\n\t\t\tmap.set(key, guards);\n\t\t}\n\t\tguards.push(guard);\n\t}\n\n\tprivate _removeFromGuardMap<T>(map: Map<string, T[]>, key: string, guard: T): void {\n\t\tconst guards = map.get(key);\n\t\tif (!guards) return;\n\t\tconst index = guards.indexOf(guard);\n\t\tif (index !== -1) guards.splice(index, 1);\n\t\tif (guards.length === 0) map.delete(key);\n\t}\n\n\t/**\n\t * Run leave guards for the current route. Returns boolean (no redirects).\n\t *\n\t * The guard array is snapshot-copied before iteration so that guards\n\t * may safely add/remove themselves (e.g. one-shot guards) without\n\t * affecting the current pipeline run.\n\t */\n\tprivate _runLeaveGuards(context: GuardContext): boolean | Promise<boolean> {\n\t\tconst registered = this._leaveGuards.get(context.fromRoute);\n\t\tif (!registered || registered.length === 0) return true;\n\n\t\tconst guards = registered.slice();\n\t\tfor (let i = 0; i < guards.length; i++) {\n\t\t\ttry {\n\t\t\t\tconst result = guards[i](context);\n\t\t\t\tif (isPromiseLike(result)) {\n\t\t\t\t\treturn this._continueGuardsAsync(\n\t\t\t\t\t\tresult,\n\t\t\t\t\t\tguards,\n\t\t\t\t\t\ti,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t(candidate) => this._validateLeaveGuardResult(candidate),\n\t\t\t\t\t\t\"Leave guard\",\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t) as Promise<boolean>;\n\t\t\t\t}\n\t\t\t\tif (result !== true) return this._validateLeaveGuardResult(result);\n\t\t\t} catch (error) {\n\t\t\t\tLog.error(\n\t\t\t\t\t`Leave guard [${i}] on route \"${context.fromRoute}\" threw, navigation failed`,\n\t\t\t\t\terror instanceof Error ? error : String(error),\n\t\t\t\t\tLOG_COMPONENT,\n\t\t\t\t);\n\t\t\t\tif (context.signal.aborted) return false;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/** Run global guards, then route-specific guards. Stays sync when possible. */\n\tprivate _runEnterGuards(toRoute: string, context: GuardContext): GuardResult | Promise<GuardResult> {\n\t\tconst globalResult = this._runGuards(this._globalGuards, context);\n\n\t\tif (isPromiseLike(globalResult)) {\n\t\t\treturn globalResult.then((result: GuardResult) => {\n\t\t\t\tif (result !== true) return result;\n\t\t\t\tif (context.signal.aborted) return false;\n\t\t\t\treturn this._runRouteGuards(toRoute, context);\n\t\t\t});\n\t\t}\n\t\tif (globalResult !== true) return globalResult;\n\t\treturn this._runRouteGuards(toRoute, context);\n\t}\n\n\t/** Run route-specific guards if any are registered. */\n\tprivate _runRouteGuards(toRoute: string, context: GuardContext): GuardResult | Promise<GuardResult> {\n\t\tif (!toRoute || !this._enterGuards.has(toRoute)) return true;\n\t\treturn this._runGuards(this._enterGuards.get(toRoute)!, context);\n\t}\n\n\t/**\n\t * Run guards sync; switch to async path if a Promise is returned.\n\t *\n\t * The guard array is snapshot-copied before iteration so that guards\n\t * may safely add/remove themselves (e.g. one-shot guards) without\n\t * affecting the current pipeline run.\n\t */\n\tprivate _runGuards(guards: GuardFn[], context: GuardContext): GuardResult | Promise<GuardResult> {\n\t\tguards = guards.slice();\n\t\tfor (let i = 0; i < guards.length; i++) {\n\t\t\ttry {\n\t\t\t\tconst result = guards[i](context);\n\t\t\t\tif (isPromiseLike(result)) {\n\t\t\t\t\treturn this._continueGuardsAsync(\n\t\t\t\t\t\tresult,\n\t\t\t\t\t\tguards,\n\t\t\t\t\t\ti,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t(candidate) => this._validateGuardResult(candidate),\n\t\t\t\t\t\t\"Enter guard\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (result !== true) return this._validateGuardResult(result);\n\t\t\t} catch (error) {\n\t\t\t\tLog.error(\n\t\t\t\t\t`Enter guard [${i}] on route \"${context.toRoute}\" threw, navigation failed`,\n\t\t\t\t\terror instanceof Error ? error : String(error),\n\t\t\t\t\tLOG_COMPONENT,\n\t\t\t\t);\n\t\t\t\tif (context.signal.aborted) return false;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Continue guard array async from the first Promise onward.\n\t *\n\t * Shared by both enter and leave guard pipelines. The `onBlock` callback\n\t * determines what to return for non-true results: leave guards always\n\t * return `false`, enter guards validate and may return redirects.\n\t *\n\t * @param isLeaveGuard - When true, error logs reference `fromRoute`; otherwise `toRoute`.\n\t */\n\tprivate async _continueGuardsAsync(\n\t\tpendingResult: PromiseLike<GuardResult>,\n\t\tguards: GuardFn[],\n\t\tcurrentIndex: number,\n\t\tcontext: GuardContext,\n\t\tonBlock: (result: unknown) => GuardResult,\n\t\tlabel: string,\n\t\tisLeaveGuard: boolean,\n\t): Promise<GuardResult> {\n\t\tlet guardIndex = currentIndex;\n\t\ttry {\n\t\t\tconst result = await pendingResult;\n\t\t\tif (result !== true) return onBlock(result);\n\n\t\t\tfor (let i = currentIndex + 1; i < guards.length; i++) {\n\t\t\t\tif (context.signal.aborted) return false;\n\t\t\t\tguardIndex = i;\n\t\t\t\tconst nextResult = await guards[i](context);\n\t\t\t\tif (nextResult !== true) return onBlock(nextResult);\n\t\t\t}\n\t\t\treturn true;\n\t\t} catch (error) {\n\t\t\tif (!context.signal.aborted) {\n\t\t\t\tconst route = isLeaveGuard ? context.fromRoute : context.toRoute;\n\t\t\t\tLog.error(\n\t\t\t\t\t`${label} [${guardIndex}] on route \"${route}\" threw, navigation failed`,\n\t\t\t\t\terror instanceof Error ? error : String(error),\n\t\t\t\t\tLOG_COMPONENT,\n\t\t\t\t);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/** Validate a non-true guard result; invalid values become false. */\n\tprivate _validateGuardResult(result: unknown): GuardResult {\n\t\tif (typeof result === \"boolean\") return result;\n\t\tif (typeof result === \"string\" && result.length > 0) return result;\n\t\tif (isGuardRedirect(result)) return result;\n\t\tLog.warning(\"Guard returned invalid value, treating as block\", String(result), LOG_COMPONENT);\n\t\treturn false;\n\t}\n\n\t/** Validate a leave guard result; non-boolean values log a warning and block. */\n\tprivate _validateLeaveGuardResult(result: unknown): boolean {\n\t\tif (typeof result === \"boolean\") return result;\n\t\tLog.warning(\"Leave guard returned non-boolean value, treating as block\", String(result), LOG_COMPONENT);\n\t\treturn false;\n\t}\n}\n"],"mappings":"wDAGA,MAAMA,EAAgB,0BAEtB,SAASC,EAAgBC,GACxB,UAAWA,IAAU,UAAYA,IAAU,KAAM,CAChD,OAAO,KACR,CAEA,MAAMC,MAAEA,GAAUD,EAClB,cAAcC,IAAU,UAAYA,EAAMC,OAAS,CACpD,CAQO,SAASC,EAAiBH,GAChC,UAAYA,IAAU,iBAAmBA,IAAU,YAAeA,I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,"file":"GuardPipeline.js","names":["LOG_COMPONENT","isGuardRedirect","value","route","length","isPromiseLike","then","resolverSource","Promise","resolve","Function","prototype","toString","call","isPromiseResolver","name","guardNames","WeakMap","nameGuard","guard","set","describeGuard","label","index","get","undefined","toDecision","result","action","target","toErrorDecision","error","GuardPipeline","_globalGuards","_enterGuards","Map","_leaveGuards","addGlobalGuard","this","push","removeGlobalGuard","indexOf","splice","addEnterGuard","before","_addToGuardMap","removeEnterGuard","_removeFromGuardMap","addLeaveGuard","removeLeaveGuard","clear","evaluate","context","options","leaving","skipLeaveGuards","fromRoute","alsoLeaving","entering","toRoute","alsoEntering","runEnterPhase","enterResult","_runEnterGuards","catch","leaveResult","_runForEach","_runGuards","_validateLeaveGuardResult","allowed","signal","aborted","map","key","guards","delete","routes","run","start","i","settled","runRouteGuards","_runRouteGuards","globalResult","_validateGuardResult","onBlock","slice","_continueGuardsAsync","Log","Error","String","pendingResult","currentIndex","guardIndex","nextResult","warning"],"sources":["./GuardPipeline.ts"],"sourcesContent":["import Log from \"sap/base/Log\";\nimport type { GuardFn, GuardContext, GuardResult, GuardRedirect } from \"./types\";\n\n/** The component under which the library logs. */\nexport const LOG_COMPONENT = \"ui5.guard.router.Router\";\n\nfunction isGuardRedirect(value: unknown): value is GuardRedirect {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\n\treturn \"route\" in value && typeof value.route === \"string\" && value.route.length > 0;\n}\n\n/**\n * Promises/A+ thenable detection via duck typing.\n *\n * We intentionally do not use `instanceof Promise` because that misses\n * cross-realm Promises and PromiseLike/thenable objects.\n */\nexport function isPromiseLike<T>(value: unknown): value is PromiseLike<T> {\n\tif ((typeof value !== \"object\" && typeof value !== \"function\") || value === null) {\n\t\treturn false;\n\t}\n\n\treturn \"then\" in value && typeof value.then === \"function\";\n}\n\n/** How this engine prints the resolve function of a Promise: `function () { [native code] }` in V8. */\nlet resolverSource!: string;\nvoid new Promise((resolve) => {\n\tresolverSource = Function.prototype.toString.call(resolve);\n});\n\n/**\n * Whether `value` looks exactly like the resolve function of a native Promise: a function with\n * the name `\"\"`, the length `1` and the source text that this engine prints for such a function.\n * `Router#attachRouteMatched` needs this to recognize a UI5 component target that waits for the\n * router. A function written in JavaScript never matches; other anonymous built-ins with one\n * parameter do, above all the reject function of a Promise.\n */\nexport function isPromiseResolver(value: unknown): value is () => void {\n\treturn (\n\t\ttypeof value === \"function\" &&\n\t\tvalue.name === \"\" &&\n\t\tvalue.length === 1 &&\n\t\tFunction.prototype.toString.call(value) === resolverSource\n\t);\n}\n\n/** Names of manifest guards, derived from their module, for log output. */\nconst guardNames = new WeakMap<GuardFn, string>();\n\n/** Give a guard a name that its log messages show. */\nexport function nameGuard(guard: GuardFn, name: string): void {\n\tguardNames.set(guard, name);\n}\n\n/** Describe a guard for log output: `Enter guard [0]`, or `Enter guard [0] \"checks#0\"` when it has a name. */\nfunction describeGuard(label: string, index: number, guard: GuardFn): string {\n\tconst name = guardNames.get(guard);\n\treturn name === undefined ? `${label} [${index}]` : `${label} [${index}] \"${name}\"`;\n}\n\n/**\n * Normalized result of the guard decision pipeline.\n */\nexport type GuardDecision =\n\t| { action: \"allow\" }\n\t| { action: \"block\" }\n\t| { action: \"redirect\"; target: string | GuardRedirect }\n\t| { action: \"error\"; error: unknown };\n\nfunction toDecision(result: GuardResult): GuardDecision {\n\tif (result === true) return { action: \"allow\" };\n\tif (result === false) return { action: \"block\" };\n\treturn { action: \"redirect\", target: result };\n}\n\nfunction toErrorDecision(error: unknown): GuardDecision {\n\treturn { action: \"error\", error };\n}\n\n/**\n * Standalone guard evaluation pipeline.\n *\n * Owns guard storage (global, enter, leave) and runs the full\n * leave -> global-enter -> route-enter pipeline. It reads no Router\n * state: evaluate() receives the context and the greedy routes left\n * and entered with it.\n */\nexport default class GuardPipeline {\n\tprivate _globalGuards: GuardFn[] = [];\n\tprivate _enterGuards = new Map<string, GuardFn[]>();\n\tprivate _leaveGuards = new Map<string, GuardFn[]>();\n\n\t/** Register a guard that runs for every navigation. */\n\taddGlobalGuard(guard: GuardFn): void {\n\t\tthis._globalGuards.push(guard);\n\t}\n\n\t/** Remove a previously registered global guard by reference. */\n\tremoveGlobalGuard(guard: GuardFn): void {\n\t\tconst index = this._globalGuards.indexOf(guard);\n\t\tif (index !== -1) {\n\t\t\tthis._globalGuards.splice(index, 1);\n\t\t}\n\t}\n\n\t/**\n\t * Register an enter guard for a specific route.\n\t *\n\t * @param route - Route name as defined in `manifest.json`.\n\t * @param guard - Guard function to register.\n\t * @param before - A guard of the route to register `guard` in front of; at the end without it.\n\t */\n\taddEnterGuard(route: string, guard: GuardFn, before?: GuardFn): void {\n\t\tthis._addToGuardMap(this._enterGuards, route, guard, before);\n\t}\n\n\t/**\n\t * Remove a previously registered enter guard by reference.\n\t */\n\tremoveEnterGuard(route: string, guard: GuardFn): void {\n\t\tthis._removeFromGuardMap(this._enterGuards, route, guard);\n\t}\n\n\t/**\n\t * Register a leave guard for a specific route.\n\t *\n\t * Accepts `GuardFn` to support manifest-declared guards loaded from\n\t * untyped modules. Non-boolean return values are caught at runtime\n\t * by {@link _validateLeaveGuardResult}.\n\t *\n\t * @param route - Route name as defined in `manifest.json`.\n\t * @param guard - Guard function to register as a leave guard.\n\t * @param before - A leave guard of the route to register `guard` in front of; at the end without it.\n\t */\n\taddLeaveGuard(route: string, guard: GuardFn, before?: GuardFn): void {\n\t\tthis._addToGuardMap(this._leaveGuards, route, guard, before);\n\t}\n\n\t/**\n\t * Remove a previously registered leave guard by reference.\n\t */\n\tremoveLeaveGuard(route: string, guard: GuardFn): void {\n\t\tthis._removeFromGuardMap(this._leaveGuards, route, guard);\n\t}\n\n\t/**\n\t * Remove all registered guards.\n\t */\n\tclear(): void {\n\t\tthis._globalGuards = [];\n\t\tthis._enterGuards.clear();\n\t\tthis._leaveGuards.clear();\n\t}\n\n\t/**\n\t * Run the full guard pipeline (leave -> global enter -> route enter) and\n\t * return a normalized decision. Stays synchronous when all guards return\n\t * plain values; returns a Promise only when an async guard is encountered.\n\t *\n\t * @param context - Complete guard context including AbortSignal.\n\t * `context.fromRoute` controls leave-guard lookup: empty string skips leave guards.\n\t * @param options - Optional evaluation options.\n\t * @param options.skipLeaveGuards - When true, leave guards are skipped even if\n\t * `context.fromRoute` is set. Used by redirect chain hops to avoid re-running\n\t * leave guards while still preserving `fromRoute` in the context.\n\t * @param options.alsoLeaving - Greedy routes that are left as well: their leave guards run\n\t * after those of `context.fromRoute`, with the same context.\n\t * @param options.alsoEntering - Greedy routes that match as well: their enter guards run\n\t * after those of `context.toRoute`, with the same context.\n\t * @returns A synchronous {@link GuardDecision} when all guards return plain values,\n\t * or a `Promise<GuardDecision>` when at least one guard returns a thenable.\n\t */\n\tevaluate(\n\t\tcontext: GuardContext,\n\t\toptions?: { skipLeaveGuards?: boolean; alsoLeaving?: string[]; alsoEntering?: string[] },\n\t): GuardDecision | Promise<GuardDecision> {\n\t\t// No route is left on the first navigation, or after a hash that matched none.\n\t\tconst leaving =\n\t\t\toptions?.skipLeaveGuards || context.fromRoute === \"\"\n\t\t\t\t? []\n\t\t\t\t: [context.fromRoute, ...(options?.alsoLeaving ?? [])];\n\t\tconst entering = [context.toRoute, ...(options?.alsoEntering ?? [])];\n\n\t\tconst runEnterPhase = (): GuardDecision | Promise<GuardDecision> => {\n\t\t\tconst enterResult = this._runEnterGuards(entering, context);\n\t\t\treturn isPromiseLike(enterResult)\n\t\t\t\t? enterResult.then(toDecision).catch(toErrorDecision)\n\t\t\t\t: toDecision(enterResult);\n\t\t};\n\n\t\ttry {\n\t\t\tconst leaveResult = this._runForEach(leaving, context, (route) =>\n\t\t\t\tthis._runGuards(\n\t\t\t\t\tthis._leaveGuards.get(route) ?? [],\n\t\t\t\t\tcontext,\n\t\t\t\t\troute,\n\t\t\t\t\t(result) => this._validateLeaveGuardResult(result),\n\t\t\t\t\t\"Leave guard\",\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tif (isPromiseLike(leaveResult)) {\n\t\t\t\treturn leaveResult\n\t\t\t\t\t.then((allowed: GuardResult): GuardDecision | Promise<GuardDecision> => {\n\t\t\t\t\t\tif (allowed !== true) return { action: \"block\" };\n\t\t\t\t\t\tif (context.signal.aborted) return { action: \"block\" };\n\t\t\t\t\t\treturn runEnterPhase();\n\t\t\t\t\t})\n\t\t\t\t\t.catch(toErrorDecision);\n\t\t\t}\n\t\t\tif (leaveResult !== true) return { action: \"block\" };\n\n\t\t\treturn runEnterPhase();\n\t\t} catch (error) {\n\t\t\treturn toErrorDecision(error);\n\t\t}\n\t}\n\n\tprivate _addToGuardMap<T>(map: Map<string, T[]>, key: string, guard: T, before?: T): void {\n\t\tlet guards = map.get(key);\n\t\tif (!guards) {\n\t\t\tguards = [];\n\t\t\tmap.set(key, guards);\n\t\t}\n\t\tconst index = before === undefined ? -1 : guards.indexOf(before);\n\t\tif (index === -1) guards.push(guard);\n\t\telse guards.splice(index, 0, guard);\n\t}\n\n\tprivate _removeFromGuardMap<T>(map: Map<string, T[]>, key: string, guard: T): void {\n\t\tconst guards = map.get(key);\n\t\tif (!guards) return;\n\t\tconst index = guards.indexOf(guard);\n\t\tif (index !== -1) guards.splice(index, 1);\n\t\tif (guards.length === 0) map.delete(key);\n\t}\n\n\t/**\n\t * Run `run` for each route in order until one does not return `true`. Stays sync as long\n\t * as the runs do; after an async run the next one starts unless the navigation was aborted.\n\t */\n\tprivate _runForEach(\n\t\troutes: string[],\n\t\tcontext: GuardContext,\n\t\trun: (route: string) => GuardResult | Promise<GuardResult>,\n\t\tstart = 0,\n\t): GuardResult | Promise<GuardResult> {\n\t\tfor (let i = start; i < routes.length; i++) {\n\t\t\tconst result = run(routes[i]);\n\t\t\tif (isPromiseLike(result)) {\n\t\t\t\treturn result.then((settled: GuardResult) => {\n\t\t\t\t\tif (settled !== true) return settled;\n\t\t\t\t\tif (context.signal.aborted) return false;\n\t\t\t\t\treturn this._runForEach(routes, context, run, i + 1);\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (result !== true) return result;\n\t\t}\n\t\treturn true;\n\t}\n\n\t/** Run global guards, then the route-specific guards of each route in `entering`. Stays sync when possible. */\n\tprivate _runEnterGuards(entering: string[], context: GuardContext): GuardResult | Promise<GuardResult> {\n\t\tconst runRouteGuards = (): GuardResult | Promise<GuardResult> =>\n\t\t\tthis._runForEach(entering, context, (route) => this._runRouteGuards(route, context));\n\t\tconst globalResult = this._runGuards(\n\t\t\tthis._globalGuards,\n\t\t\tcontext,\n\t\t\tcontext.toRoute,\n\t\t\t(result) => this._validateGuardResult(result),\n\t\t\t\"Enter guard\",\n\t\t);\n\n\t\tif (isPromiseLike(globalResult)) {\n\t\t\treturn globalResult.then((result: GuardResult) => {\n\t\t\t\tif (result !== true) return result;\n\t\t\t\tif (context.signal.aborted) return false;\n\t\t\t\treturn runRouteGuards();\n\t\t\t});\n\t\t}\n\t\tif (globalResult !== true) return globalResult;\n\t\treturn runRouteGuards();\n\t}\n\n\t/** Run route-specific guards if any are registered. */\n\tprivate _runRouteGuards(toRoute: string, context: GuardContext): GuardResult | Promise<GuardResult> {\n\t\tconst guards = toRoute ? this._enterGuards.get(toRoute) : undefined;\n\t\tif (!guards) return true;\n\t\treturn this._runGuards(guards, context, toRoute, (result) => this._validateGuardResult(result), \"Enter guard\");\n\t}\n\n\t/**\n\t * Run guards sync; switch to async path if a Promise is returned. A result that is not\n\t * `true` ends the run with what `onBlock` makes of it.\n\t *\n\t * The guard array is snapshot-copied before iteration so that guards\n\t * may safely add/remove themselves (e.g. one-shot guards) without\n\t * affecting the current pipeline run.\n\t *\n\t * @param route - The route the guards are registered for, named in error logs.\n\t */\n\tprivate _runGuards<R extends GuardResult>(\n\t\tguards: GuardFn[],\n\t\tcontext: GuardContext,\n\t\troute: string,\n\t\tonBlock: (result: unknown) => R,\n\t\tlabel: string,\n\t): R | boolean | Promise<R | boolean> {\n\t\tguards = guards.slice();\n\t\tfor (let i = 0; i < guards.length; i++) {\n\t\t\ttry {\n\t\t\t\tconst result = guards[i](context);\n\t\t\t\tif (isPromiseLike(result)) {\n\t\t\t\t\treturn this._continueGuardsAsync(result, guards, i, context, onBlock, label, route);\n\t\t\t\t}\n\t\t\t\tif (result !== true) return onBlock(result);\n\t\t\t} catch (error) {\n\t\t\t\tif (context.signal.aborted) return false;\n\t\t\t\tLog.error(\n\t\t\t\t\t`${describeGuard(label, i, guards[i])} on route \"${route}\" threw, navigation failed`,\n\t\t\t\t\terror instanceof Error ? error : String(error),\n\t\t\t\t\tLOG_COMPONENT,\n\t\t\t\t);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Continue guard array async from the first Promise onward.\n\t *\n\t * Shared by both enter and leave guard pipelines. The `onBlock` callback\n\t * determines what to return for non-true results: leave guards always\n\t * return `false`, enter guards validate and may return redirects.\n\t *\n\t * @param route - The route the guards are registered for, named in error logs.\n\t */\n\tprivate async _continueGuardsAsync<R extends GuardResult>(\n\t\tpendingResult: PromiseLike<GuardResult>,\n\t\tguards: GuardFn[],\n\t\tcurrentIndex: number,\n\t\tcontext: GuardContext,\n\t\tonBlock: (result: unknown) => R,\n\t\tlabel: string,\n\t\troute: string,\n\t): Promise<R | boolean> {\n\t\tlet guardIndex = currentIndex;\n\t\ttry {\n\t\t\tconst result = await pendingResult;\n\t\t\tif (result !== true) return onBlock(result);\n\n\t\t\tfor (let i = currentIndex + 1; i < guards.length; i++) {\n\t\t\t\tif (context.signal.aborted) return false;\n\t\t\t\tguardIndex = i;\n\t\t\t\tconst nextResult = await guards[i](context);\n\t\t\t\tif (nextResult !== true) return onBlock(nextResult);\n\t\t\t}\n\t\t\treturn true;\n\t\t} catch (error) {\n\t\t\tif (!context.signal.aborted) {\n\t\t\t\tLog.error(\n\t\t\t\t\t`${describeGuard(label, guardIndex, guards[guardIndex])} on route \"${route}\" threw, navigation failed`,\n\t\t\t\t\terror instanceof Error ? error : String(error),\n\t\t\t\t\tLOG_COMPONENT,\n\t\t\t\t);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/** Validate a non-true guard result; invalid values become false. */\n\tprivate _validateGuardResult(result: unknown): GuardResult {\n\t\tif (typeof result === \"boolean\") return result;\n\t\tif (typeof result === \"string\" && result.length > 0) return result;\n\t\tif (isGuardRedirect(result)) return result;\n\t\tLog.warning(\"Guard returned invalid value, treating as block\", String(result), LOG_COMPONENT);\n\t\treturn false;\n\t}\n\n\t/** Validate a leave guard result; non-boolean values log a warning and block. */\n\tprivate _validateLeaveGuardResult(result: unknown): boolean {\n\t\tif (typeof result === \"boolean\") return result;\n\t\tLog.warning(\"Leave guard returned non-boolean value, treating as block\", String(result), LOG_COMPONENT);\n\t\treturn false;\n\t}\n}\n"],"mappings":"wDAIO,MAAMA,EAAgB,0BAE7B,SAASC,EAAgBC,GACxB,UAAWA,IAAU,UAAYA,IAAU,KAAM,CAChD,OAAO,KACR,CAEA,MAAO,UAAWA,UAAgBA,EAAMC,QAAU,UAAYD,EAAMC,MAAMC,OAAS,CACpF,CAQO,SAASC,EAAiBH,GAChC,UAAYA,IAAU,iBAAmBA,IAAU,YAAeA,IAAU,KAAM,CACjF,OAAO,KACR,CAEA,MAAO,SAAUA,UAAgBA,EAAMI,OAAS,UACjD,CAGA,IAAIC,OACC,IAAIC,QAASC,IACjBF,EAAiBG,SAASC,UAAUC,SAASC,KAAKJ,KAU5C,SAASK,EAAkBZ,GACjC,cACQA,IAAU,YACjBA,EAAMa,OAAS,IACfb,EAAME,SAAW,GACjBM,SAASC,UAAUC,SAASC,KAAKX,KAAWK,CAE9C,CAGA,MAAMS,EAAa,IAAIC,QAGhB,SAASC,EAAUC,EAAgBJ,GACzCC,EAAWI,IAAID,EAAOJ,EACvB,CAGA,SAASM,EAAcC,EAAeC,EAAeJ,GACpD,MAAMJ,EAAOC,EAAWQ,IAAIL,GAC5B,OAAOJ,IAASU,UAAY,GAAGH,MAAUC,KAAW,GAAGD,MAAUC,OAAWR,IAC7E,CAWA,SAASW,EAAWC,GAC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,EAAGL,EAAOK,iBAAiB5E,8BACnD4B,aAAiB0D,MAAQ1D,EAAQ2D,OAAO3D,GACxC/B,GAED,MAAM+B,CACP,CACD,CACA,OAAO,IACR,CAWA,0BAAcwD,CACbI,EACAjB,EACAkB,EACAxC,EACAiC,EACA/D,EACAnB,GAEA,IAAI0F,EAAaD,EACjB,IACC,MAAMjE,QAAegE,EACrB,GAAIhE,IAAW,KAAM,OAAO0D,EAAQ1D,GAEpC,IAAK,IAAIoD,EAAIa,EAAe,EAAGb,EAAIL,EAAOtE,OAAQ2E,IAAK,CACtD,GAAI3B,EAAQkB,OAAOC,QAAS,OAAO,MACnCsB,EAAad,EACb,MAAMe,QAAmBpB,EAAOK,GAAG3B,GACnC,GAAI0C,IAAe,KAAM,OAAOT,EAAQS,EACzC,CACA,OAAO,IACR,CAAE,MAAO/D,GACR,IAAKqB,EAAQkB,OAAOC,QAAS,CAC5BiB,EAAIzD,MACH,GAAGV,EAAcC,EAAOuE,EAAYnB,EAAOmB,iBAA0B1F,8BACrE4B,aAAiB0D,MAAQ1D,EAAQ2D,OAAO3D,GACxC/B,GAED,MAAM+B,CACP,CACA,OAAO,KACR,CACD,CAGQqD,qBAAqBzD,GAC5B,UAAWA,IAAW,UAAW,OAAOA,EACxC,UAAWA,IAAW,UAAYA,EAAOvB,OAAS,EAAG,OAAOuB,EAC5D,GAAI1B,EAAgB0B,GAAS,OAAOA,EACpC6D,EAAIO,QAAQ,kDAAmDL,OAAO/D,GAAS3B,GAC/E,OAAO,KACR,CAGQoE,0BAA0BzC,GACjC,UAAWA,IAAW,UAAW,OAAOA,EACxC6D,EAAIO,QAAQ,4DAA6DL,OAAO/D,GAAS3B,GACzF,OAAO,KACR,EACAgC,EAAAhC,gBAAAgC,EAAA3B,gBAAA2B,EAAAlB,oBAAAkB,EAAAd,YAAA,OAAAc,CAAA","ignoreList":[]}
@@ -17,13 +17,13 @@ sap.ui.define([], function () {
17
17
  Committed: "committed",
18
18
  /** Navigation was allowed, but no route matched; UI5 continued with bypassed handling. @since 1.3.0 */
19
19
  Bypassed: "bypassed",
20
- /** A guard blocked navigation; the previous route remains active. @since 1.2.0 */
20
+ /** A guard blocked navigation, or the hash changer refused the hash change; the previous route remains active. @since 1.2.0 */
21
21
  Blocked: "blocked",
22
- /** A guard redirected navigation to a different route. @since 1.2.0 */
22
+ /** A guard redirected navigation to a different route, or to the route that is displayed, which then does not match again. @since 1.2.0 */
23
23
  Redirected: "redirected",
24
24
  /** Navigation was cancelled before settling (superseded, stopped, or destroyed). @since 1.2.0 */
25
25
  Cancelled: "cancelled",
26
- /** A guard threw or rejected; the previous route remains active. @since 1.4.0 */
26
+ /** A guard threw or rejected, a redirect target had no valid hash, or applying the decision failed; the previous route remains active. @since 1.4.0 */
27
27
  Error: "error"
28
28
  });
29
29
  return NavigationOutcome;
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationOutcome-dbg.js","names":["NavigationOutcome","Object","freeze","Committed","Bypassed","Blocked","Redirected","Cancelled","Error"],"sources":["NavigationOutcome.ts"],"sourcesContent":["/**\n * Outcome of a navigation after the guard pipeline settles.\n *\n * Registered as a UI5 enum via `library.ts` so that it is discoverable\n * through `sap.ui.base.DataType.getType()`. Application code can import\n * the value object directly.\n *\n * @enum {string}\n * @namespace ui5.guard.router\n * @since 1.2.0\n */\nconst NavigationOutcome = Object.freeze({\n\t/** Navigation was allowed and the target route activated. @since 1.2.0 */\n\tCommitted: \"committed\",\n\t/** Navigation was allowed, but no route matched; UI5 continued with bypassed handling. @since 1.3.0 */\n\tBypassed: \"bypassed\",\n\t/** A guard blocked navigation; the previous route remains active. @since 1.2.0 */\n\tBlocked: \"blocked\",\n\t/** A guard redirected navigation to a different route. @since 1.2.0 */\n\tRedirected: \"redirected\",\n\t/** Navigation was cancelled before settling (superseded, stopped, or destroyed). @since 1.2.0 */\n\tCancelled: \"cancelled\",\n\t/** A guard threw or rejected; the previous route remains active. @since 1.4.0 */\n\tError: \"error\",\n});\n\ntype NavigationOutcome = (typeof NavigationOutcome)[keyof typeof NavigationOutcome];\n\nexport default NavigationOutcome;\n"],"mappings":";;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACA,MAAMA,iBAAiB,GAAGC,MAAM,CAACC,MAAM,CAAC;IACvC;IACAC,SAAS,EAAE,WAAW;IACtB;IACAC,QAAQ,EAAE,UAAU;IACpB;IACAC,OAAO,EAAE,SAAS;IAClB;IACAC,UAAU,EAAE,YAAY;IACxB;IACAC,SAAS,EAAE,WAAW;IACtB;IACAC,KAAK,EAAE;EACR,CAAC,CAAC;EAAC,OAIYR,iBAAiB;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"NavigationOutcome-dbg.js","names":["NavigationOutcome","Object","freeze","Committed","Bypassed","Blocked","Redirected","Cancelled","Error"],"sourceRoot":"./","sources":["NavigationOutcome.ts"],"sourcesContent":["/**\n * Outcome of a navigation after the guard pipeline settles.\n *\n * Registered as a UI5 enum via `library.ts` so that it is discoverable\n * through `sap.ui.base.DataType.getType()`. Application code can import\n * the value object directly.\n *\n * @enum {string}\n * @namespace ui5.guard.router\n * @since 1.2.0\n */\nconst NavigationOutcome = Object.freeze({\n\t/** Navigation was allowed and the target route activated. @since 1.2.0 */\n\tCommitted: \"committed\",\n\t/** Navigation was allowed, but no route matched; UI5 continued with bypassed handling. @since 1.3.0 */\n\tBypassed: \"bypassed\",\n\t/** A guard blocked navigation, or the hash changer refused the hash change; the previous route remains active. @since 1.2.0 */\n\tBlocked: \"blocked\",\n\t/** A guard redirected navigation to a different route, or to the route that is displayed, which then does not match again. @since 1.2.0 */\n\tRedirected: \"redirected\",\n\t/** Navigation was cancelled before settling (superseded, stopped, or destroyed). @since 1.2.0 */\n\tCancelled: \"cancelled\",\n\t/** A guard threw or rejected, a redirect target had no valid hash, or applying the decision failed; the previous route remains active. @since 1.4.0 */\n\tError: \"error\",\n});\n\ntype NavigationOutcome = (typeof NavigationOutcome)[keyof typeof NavigationOutcome];\n\nexport default NavigationOutcome;\n"],"mappings":";;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACA,MAAMA,iBAAiB,GAAGC,MAAM,CAACC,MAAM,CAAC;IACvC;IACAC,SAAS,EAAE,WAAW;IACtB;IACAC,QAAQ,EAAE,UAAU;IACpB;IACAC,OAAO,EAAE,SAAS;IAClB;IACAC,UAAU,EAAE,YAAY;IACxB;IACAC,SAAS,EAAE,WAAW;IACtB;IACAC,KAAK,EAAE;EACR,CAAC,CAAC;EAAC,OAIYR,iBAAiB;AAAA","ignoreList":[]}
@@ -15,13 +15,13 @@ declare module "ui5/guard/router/NavigationOutcome" {
15
15
  Committed: "committed";
16
16
  /** Navigation was allowed, but no route matched; UI5 continued with bypassed handling. @since 1.3.0 */
17
17
  Bypassed: "bypassed";
18
- /** A guard blocked navigation; the previous route remains active. @since 1.2.0 */
18
+ /** A guard blocked navigation, or the hash changer refused the hash change; the previous route remains active. @since 1.2.0 */
19
19
  Blocked: "blocked";
20
- /** A guard redirected navigation to a different route. @since 1.2.0 */
20
+ /** A guard redirected navigation to a different route, or to the route that is displayed, which then does not match again. @since 1.2.0 */
21
21
  Redirected: "redirected";
22
22
  /** Navigation was cancelled before settling (superseded, stopped, or destroyed). @since 1.2.0 */
23
23
  Cancelled: "cancelled";
24
- /** A guard threw or rejected; the previous route remains active. @since 1.4.0 */
24
+ /** A guard threw or rejected, a redirect target had no valid hash, or applying the decision failed; the previous route remains active. @since 1.4.0 */
25
25
  Error: "error";
26
26
  }>;
27
27
  type NavigationOutcome = (typeof NavigationOutcome)[keyof typeof NavigationOutcome];
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationOutcome.d.ts","sourceRoot":"../../../../..","sources":["src/NavigationOutcome.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,oCAAoC,CAAC;IACpD;;;;;;;;;;OAUG;IACH,MAAM,iBAAiB;QACtB,0EAA0E;;QAE1E,uGAAuG;;QAEvG,kFAAkF;;QAElF,uEAAuE;;QAEvE,iGAAiG;;QAEjG,iFAAiF;;MAEhF,CAAC;IAEH,KAAK,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;IAEpF,eAAe,iBAAiB,CAAC;CAEhC"}
1
+ {"version":3,"file":"NavigationOutcome.d.ts","sourceRoot":"../../../../..","sources":["src/NavigationOutcome.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,oCAAoC,CAAC;IACpD;;;;;;;;;;OAUG;IACH,MAAM,iBAAiB;QACtB,0EAA0E;;QAE1E,uGAAuG;;QAEvG,+HAA+H;;QAE/H,2IAA2I;;QAE3I,iGAAiG;;QAEjG,uJAAuJ;;MAEtJ,CAAC;IAEH,KAAK,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;IAEpF,eAAe,iBAAiB,CAAC;CAEhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationOutcome.js","names":["NavigationOutcome","Object","freeze","Committed","Bypassed","Blocked","Redirected","Cancelled","Error"],"sources":["NavigationOutcome.ts"],"sourcesContent":["/**\n * Outcome of a navigation after the guard pipeline settles.\n *\n * Registered as a UI5 enum via `library.ts` so that it is discoverable\n * through `sap.ui.base.DataType.getType()`. Application code can import\n * the value object directly.\n *\n * @enum {string}\n * @namespace ui5.guard.router\n * @since 1.2.0\n */\nconst NavigationOutcome = Object.freeze({\n\t/** Navigation was allowed and the target route activated. @since 1.2.0 */\n\tCommitted: \"committed\",\n\t/** Navigation was allowed, but no route matched; UI5 continued with bypassed handling. @since 1.3.0 */\n\tBypassed: \"bypassed\",\n\t/** A guard blocked navigation; the previous route remains active. @since 1.2.0 */\n\tBlocked: \"blocked\",\n\t/** A guard redirected navigation to a different route. @since 1.2.0 */\n\tRedirected: \"redirected\",\n\t/** Navigation was cancelled before settling (superseded, stopped, or destroyed). @since 1.2.0 */\n\tCancelled: \"cancelled\",\n\t/** A guard threw or rejected; the previous route remains active. @since 1.4.0 */\n\tError: \"error\",\n});\n\ntype NavigationOutcome = (typeof NavigationOutcome)[keyof typeof NavigationOutcome];\n\nexport default NavigationOutcome;\n"],"mappings":"yCAWA,MAAMA,EAAoBC,OAAOC,OAAO,CAEvCC,UAAW,YAEXC,SAAU,WAEVC,QAAS,UAETC,WAAY,aAEZC,UAAW,YAEXC,MAAO,UACL,OAIYR,CAAiB","ignoreList":[]}
1
+ {"version":3,"file":"NavigationOutcome.js","names":["NavigationOutcome","Object","freeze","Committed","Bypassed","Blocked","Redirected","Cancelled","Error"],"sources":["./NavigationOutcome.ts"],"sourcesContent":["/**\n * Outcome of a navigation after the guard pipeline settles.\n *\n * Registered as a UI5 enum via `library.ts` so that it is discoverable\n * through `sap.ui.base.DataType.getType()`. Application code can import\n * the value object directly.\n *\n * @enum {string}\n * @namespace ui5.guard.router\n * @since 1.2.0\n */\nconst NavigationOutcome = Object.freeze({\n\t/** Navigation was allowed and the target route activated. @since 1.2.0 */\n\tCommitted: \"committed\",\n\t/** Navigation was allowed, but no route matched; UI5 continued with bypassed handling. @since 1.3.0 */\n\tBypassed: \"bypassed\",\n\t/** A guard blocked navigation, or the hash changer refused the hash change; the previous route remains active. @since 1.2.0 */\n\tBlocked: \"blocked\",\n\t/** A guard redirected navigation to a different route, or to the route that is displayed, which then does not match again. @since 1.2.0 */\n\tRedirected: \"redirected\",\n\t/** Navigation was cancelled before settling (superseded, stopped, or destroyed). @since 1.2.0 */\n\tCancelled: \"cancelled\",\n\t/** A guard threw or rejected, a redirect target had no valid hash, or applying the decision failed; the previous route remains active. @since 1.4.0 */\n\tError: \"error\",\n});\n\ntype NavigationOutcome = (typeof NavigationOutcome)[keyof typeof NavigationOutcome];\n\nexport default NavigationOutcome;\n"],"mappings":"yCAWA,MAAMA,EAAoBC,OAAOC,OAAO,CAEvCC,UAAW,YAEXC,SAAU,WAEVC,QAAS,UAETC,WAAY,aAEZC,UAAW,YAEXC,MAAO,UACL,OAIYR,CAAiB","ignoreList":[]}
@@ -0,0 +1,156 @@
1
+ sap.ui.define([], function () {
2
+ "use strict";
3
+
4
+ /**
5
+ * Pattern-tree helpers: compare UI5 route patterns by their mandatory path segments.
6
+ */
7
+
8
+ /** Matches a standalone optional (`:param:`) or rest (`:param*:`) segment. */
9
+ const OPTIONAL_OR_REST_SEGMENT = /^:[^:]*:$/;
10
+
11
+ /**
12
+ * Strips inline query and optional-query suffixes from a segment.
13
+ *
14
+ * UI5 (crossroads.js) allows query parameters to attach directly to a
15
+ * path segment without a `/` separator:
16
+ * - `product{?query}` → mandatory query on `product`
17
+ * - `product:?query:` → optional query on `product`
18
+ * - `{id}{?query}` → mandatory param + mandatory query
19
+ *
20
+ * For pattern-tree ancestry we only care about the path portion,
21
+ * so these suffixes are stripped.
22
+ */
23
+ function stripInlineQuery(seg) {
24
+ const mqIdx = seg.indexOf("{?");
25
+ if (mqIdx !== -1) return seg.slice(0, mqIdx);
26
+ const oqIdx = seg.indexOf(":?");
27
+ if (oqIdx !== -1) return seg.slice(0, oqIdx);
28
+ return seg;
29
+ }
30
+
31
+ /**
32
+ * Extract mandatory path segments from a UI5 route pattern.
33
+ *
34
+ * Splits on `/`, strips inline query suffixes, then drops empty segments,
35
+ * standalone optional (`:param:`), and rest (`:param*:`) segments.
36
+ */
37
+ function patternSegments(pattern) {
38
+ return pattern.split("/").map(stripInlineQuery).filter(seg => seg !== "" && !OPTIONAL_OR_REST_SEGMENT.test(seg));
39
+ }
40
+
41
+ /**
42
+ * Check if `ancestorPattern` is a URL-tree ancestor of `candidatePattern`.
43
+ *
44
+ * Both patterns are reduced to their mandatory path segments and compared
45
+ * positionally. Mandatory parameter segments (`{paramA}`, `{paramB}`) are
46
+ * treated as equivalent regardless of name, so `employees/{empId}` is
47
+ * recognized as an ancestor of `employees/{id}/resume`.
48
+ */
49
+ function isPatternAncestor(ancestorPattern, candidatePattern) {
50
+ if (ancestorPattern === "") return true;
51
+ const ancestorSegments = patternSegments(ancestorPattern);
52
+ if (ancestorSegments.length === 0) return false;
53
+ const candidateSegments = patternSegments(candidatePattern);
54
+ if (candidateSegments.length <= ancestorSegments.length) return false;
55
+ return ancestorSegments.every((seg, i) => {
56
+ const candidateSeg = candidateSegments[i];
57
+ if (seg === candidateSeg) return true;
58
+ return seg.startsWith("{") && candidateSeg.startsWith("{");
59
+ });
60
+ }
61
+
62
+ /** A route name with its pattern. */
63
+
64
+ /** Number of mandatory segments in the pattern of `route` (0 when unknown). */
65
+ function depthOf(route, patternByName) {
66
+ return patternSegments(patternByName.get(route) ?? "").length;
67
+ }
68
+
69
+ /**
70
+ * Entries ordered by the pattern depth of their own route, declaration order within one depth.
71
+ * Expanding them in this order puts an ancestor's entries before a descendant's on every route.
72
+ */
73
+ function byRouteDepth(entries, patternByName) {
74
+ return entries.toSorted((a, b) => depthOf(a.route, patternByName) - depthOf(b.route, patternByName));
75
+ }
76
+
77
+ /**
78
+ * Copy each route-specific entry to every descendant route (`inheritance: "pattern-tree"`).
79
+ * Global (`"*"`) entries and entries for routes without a known pattern are kept as-is.
80
+ * Ordered by the pattern depth of the route an entry was declared for, so on every route
81
+ * ancestor guards run before descendant guards, whatever the declaration order. Where global
82
+ * entries end up does not matter: the pipeline runs global guards separately.
83
+ * A route named `"*"` does not pass its entries on, because a `"*"` entry is a global one.
84
+ */
85
+ function expandToDescendants(entries, routes) {
86
+ if (routes.length === 0) return entries;
87
+ const patternByName = new Map(routes.map(r => [r.name, r.pattern]));
88
+ const expanded = [];
89
+ for (const entry of byRouteDepth(entries, patternByName)) {
90
+ expanded.push(entry);
91
+ if (entry.route === "*") continue;
92
+ const ancestorPattern = patternByName.get(entry.route);
93
+ if (ancestorPattern === undefined) continue;
94
+ for (const {
95
+ name,
96
+ pattern
97
+ } of routes) {
98
+ if (name !== entry.route && isPatternAncestor(ancestorPattern, pattern)) {
99
+ expanded.push({
100
+ ...entry,
101
+ route: name
102
+ });
103
+ }
104
+ }
105
+ }
106
+ return expanded;
107
+ }
108
+
109
+ /**
110
+ * Entries a newly added route inherits (`inheritance: "pattern-tree"`): copies of its
111
+ * ancestors' entries for the new route, and copies of its own entries for its existing
112
+ * descendants. `routes` must include the new route. Ordered like {@link expandToDescendants};
113
+ * where the entries go among those a route has already is up to the caller.
114
+ */
115
+ function expandForNewRoute(entries, newName, routes) {
116
+ const patternByName = new Map(routes.map(r => [r.name, r.pattern]));
117
+ const newPattern = patternByName.get(newName);
118
+ if (newPattern === undefined) return [];
119
+ const result = [];
120
+ for (const entry of byRouteDepth(entries, patternByName)) {
121
+ if (entry.route === "*") continue;
122
+ if (entry.route === newName) {
123
+ for (const {
124
+ name,
125
+ pattern
126
+ } of routes) {
127
+ if (name !== newName && isPatternAncestor(newPattern, pattern)) {
128
+ result.push({
129
+ ...entry,
130
+ route: name
131
+ });
132
+ }
133
+ }
134
+ } else {
135
+ const ancestorPattern = patternByName.get(entry.route);
136
+ if (ancestorPattern !== undefined && isPatternAncestor(ancestorPattern, newPattern)) {
137
+ result.push({
138
+ ...entry,
139
+ route: newName
140
+ });
141
+ }
142
+ }
143
+ }
144
+ return result;
145
+ }
146
+ var __exports = {
147
+ __esModule: true
148
+ };
149
+ __exports.patternSegments = patternSegments;
150
+ __exports.isPatternAncestor = isPatternAncestor;
151
+ __exports.byRouteDepth = byRouteDepth;
152
+ __exports.expandToDescendants = expandToDescendants;
153
+ __exports.expandForNewRoute = expandForNewRoute;
154
+ return __exports;
155
+ });
156
+ //# sourceMappingURL=PatternTree-dbg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PatternTree-dbg.js","names":["OPTIONAL_OR_REST_SEGMENT","stripInlineQuery","seg","mqIdx","indexOf","slice","oqIdx","patternSegments","pattern","split","map","filter","test","isPatternAncestor","ancestorPattern","candidatePattern","ancestorSegments","length","candidateSegments","every","i","candidateSeg","startsWith","depthOf","route","patternByName","get","byRouteDepth","entries","toSorted","a","b","expandToDescendants","routes","Map","r","name","expanded","entry","push","undefined","expandForNewRoute","newName","newPattern","result","__exports","__esModule"],"sourceRoot":"./","sources":["PatternTree.ts"],"sourcesContent":["/**\n * Pattern-tree helpers: compare UI5 route patterns by their mandatory path segments.\n */\n\n/** Matches a standalone optional (`:param:`) or rest (`:param*:`) segment. */\nconst OPTIONAL_OR_REST_SEGMENT = /^:[^:]*:$/;\n\n/**\n * Strips inline query and optional-query suffixes from a segment.\n *\n * UI5 (crossroads.js) allows query parameters to attach directly to a\n * path segment without a `/` separator:\n * - `product{?query}` → mandatory query on `product`\n * - `product:?query:` → optional query on `product`\n * - `{id}{?query}` → mandatory param + mandatory query\n *\n * For pattern-tree ancestry we only care about the path portion,\n * so these suffixes are stripped.\n */\nfunction stripInlineQuery(seg: string): string {\n\tconst mqIdx = seg.indexOf(\"{?\");\n\tif (mqIdx !== -1) return seg.slice(0, mqIdx);\n\tconst oqIdx = seg.indexOf(\":?\");\n\tif (oqIdx !== -1) return seg.slice(0, oqIdx);\n\treturn seg;\n}\n\n/**\n * Extract mandatory path segments from a UI5 route pattern.\n *\n * Splits on `/`, strips inline query suffixes, then drops empty segments,\n * standalone optional (`:param:`), and rest (`:param*:`) segments.\n */\nexport function patternSegments(pattern: string): string[] {\n\treturn pattern\n\t\t.split(\"/\")\n\t\t.map(stripInlineQuery)\n\t\t.filter((seg) => seg !== \"\" && !OPTIONAL_OR_REST_SEGMENT.test(seg));\n}\n\n/**\n * Check if `ancestorPattern` is a URL-tree ancestor of `candidatePattern`.\n *\n * Both patterns are reduced to their mandatory path segments and compared\n * positionally. Mandatory parameter segments (`{paramA}`, `{paramB}`) are\n * treated as equivalent regardless of name, so `employees/{empId}` is\n * recognized as an ancestor of `employees/{id}/resume`.\n */\nexport function isPatternAncestor(ancestorPattern: string, candidatePattern: string): boolean {\n\tif (ancestorPattern === \"\") return true;\n\tconst ancestorSegments = patternSegments(ancestorPattern);\n\tif (ancestorSegments.length === 0) return false;\n\tconst candidateSegments = patternSegments(candidatePattern);\n\tif (candidateSegments.length <= ancestorSegments.length) return false;\n\treturn ancestorSegments.every((seg, i) => {\n\t\tconst candidateSeg = candidateSegments[i];\n\t\tif (seg === candidateSeg) return true;\n\t\treturn seg.startsWith(\"{\") && candidateSeg.startsWith(\"{\");\n\t});\n}\n\n/** A route name with its pattern. */\nexport interface RoutePattern {\n\treadonly name: string;\n\treadonly pattern: string;\n}\n\n/** Number of mandatory segments in the pattern of `route` (0 when unknown). */\nfunction depthOf(route: string, patternByName: ReadonlyMap<string, string>): number {\n\treturn patternSegments(patternByName.get(route) ?? \"\").length;\n}\n\n/**\n * Entries ordered by the pattern depth of their own route, declaration order within one depth.\n * Expanding them in this order puts an ancestor's entries before a descendant's on every route.\n */\nexport function byRouteDepth<T extends { readonly route: string }>(\n\tentries: T[],\n\tpatternByName: ReadonlyMap<string, string>,\n): T[] {\n\treturn entries.toSorted((a, b) => depthOf(a.route, patternByName) - depthOf(b.route, patternByName));\n}\n\n/**\n * Copy each route-specific entry to every descendant route (`inheritance: \"pattern-tree\"`).\n * Global (`\"*\"`) entries and entries for routes without a known pattern are kept as-is.\n * Ordered by the pattern depth of the route an entry was declared for, so on every route\n * ancestor guards run before descendant guards, whatever the declaration order. Where global\n * entries end up does not matter: the pipeline runs global guards separately.\n * A route named `\"*\"` does not pass its entries on, because a `\"*\"` entry is a global one.\n */\nexport function expandToDescendants<T extends { readonly route: string }>(entries: T[], routes: RoutePattern[]): T[] {\n\tif (routes.length === 0) return entries;\n\tconst patternByName = new Map(routes.map((r) => [r.name, r.pattern]));\n\n\tconst expanded: T[] = [];\n\tfor (const entry of byRouteDepth(entries, patternByName)) {\n\t\texpanded.push(entry);\n\t\tif (entry.route === \"*\") continue;\n\t\tconst ancestorPattern = patternByName.get(entry.route);\n\t\tif (ancestorPattern === undefined) continue;\n\t\tfor (const { name, pattern } of routes) {\n\t\t\tif (name !== entry.route && isPatternAncestor(ancestorPattern, pattern)) {\n\t\t\t\texpanded.push({ ...entry, route: name });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn expanded;\n}\n\n/**\n * Entries a newly added route inherits (`inheritance: \"pattern-tree\"`): copies of its\n * ancestors' entries for the new route, and copies of its own entries for its existing\n * descendants. `routes` must include the new route. Ordered like {@link expandToDescendants};\n * where the entries go among those a route has already is up to the caller.\n */\nexport function expandForNewRoute<T extends { readonly route: string }>(\n\tentries: T[],\n\tnewName: string,\n\troutes: RoutePattern[],\n): T[] {\n\tconst patternByName = new Map(routes.map((r) => [r.name, r.pattern]));\n\tconst newPattern = patternByName.get(newName);\n\tif (newPattern === undefined) return [];\n\n\tconst result: T[] = [];\n\tfor (const entry of byRouteDepth(entries, patternByName)) {\n\t\tif (entry.route === \"*\") continue;\n\t\tif (entry.route === newName) {\n\t\t\tfor (const { name, pattern } of routes) {\n\t\t\t\tif (name !== newName && isPatternAncestor(newPattern, pattern)) {\n\t\t\t\t\tresult.push({ ...entry, route: name });\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst ancestorPattern = patternByName.get(entry.route);\n\t\t\tif (ancestorPattern !== undefined && isPatternAncestor(ancestorPattern, newPattern)) {\n\t\t\t\tresult.push({ ...entry, route: newName });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;EAAA;AACA;AACA;;EAEA;EACA,MAAMA,wBAAwB,GAAG,WAAW;;EAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACA,SAASC,gBAAgBA,CAACC,GAAW,EAAU;IAC9C,MAAMC,KAAK,GAAGD,GAAG,CAACE,OAAO,CAAC,IAAI,CAAC;IAC/B,IAAID,KAAK,KAAK,CAAC,CAAC,EAAE,OAAOD,GAAG,CAACG,KAAK,CAAC,CAAC,EAAEF,KAAK,CAAC;IAC5C,MAAMG,KAAK,GAAGJ,GAAG,CAACE,OAAO,CAAC,IAAI,CAAC;IAC/B,IAAIE,KAAK,KAAK,CAAC,CAAC,EAAE,OAAOJ,GAAG,CAACG,KAAK,CAAC,CAAC,EAAEC,KAAK,CAAC;IAC5C,O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A,mBAAA;EAAAa,SAAA,CAAAJ,iBAAA,GAAAA,iBAAA;EAAA,OAAAI,SAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,71 @@
1
+ declare module "ui5/guard/router/PatternTree" {
2
+ /**
3
+ * Pattern-tree helpers: compare UI5 route patterns by their mandatory path segments.
4
+ */
5
+ /** Matches a standalone optional (`:param:`) or rest (`:param*:`) segment. */
6
+ const OPTIONAL_OR_REST_SEGMENT: RegExp;
7
+ /**
8
+ * Strips inline query and optional-query suffixes from a segment.
9
+ *
10
+ * UI5 (crossroads.js) allows query parameters to attach directly to a
11
+ * path segment without a `/` separator:
12
+ * - `product{?query}` → mandatory query on `product`
13
+ * - `product:?query:` → optional query on `product`
14
+ * - `{id}{?query}` → mandatory param + mandatory query
15
+ *
16
+ * For pattern-tree ancestry we only care about the path portion,
17
+ * so these suffixes are stripped.
18
+ */
19
+ function stripInlineQuery(seg: string): string;
20
+ /**
21
+ * Extract mandatory path segments from a UI5 route pattern.
22
+ *
23
+ * Splits on `/`, strips inline query suffixes, then drops empty segments,
24
+ * standalone optional (`:param:`), and rest (`:param*:`) segments.
25
+ */
26
+ export function patternSegments(pattern: string): string[];
27
+ /**
28
+ * Check if `ancestorPattern` is a URL-tree ancestor of `candidatePattern`.
29
+ *
30
+ * Both patterns are reduced to their mandatory path segments and compared
31
+ * positionally. Mandatory parameter segments (`{paramA}`, `{paramB}`) are
32
+ * treated as equivalent regardless of name, so `employees/{empId}` is
33
+ * recognized as an ancestor of `employees/{id}/resume`.
34
+ */
35
+ export function isPatternAncestor(ancestorPattern: string, candidatePattern: string): boolean;
36
+ /** A route name with its pattern. */
37
+ export interface RoutePattern {
38
+ readonly name: string;
39
+ readonly pattern: string;
40
+ }
41
+ /** Number of mandatory segments in the pattern of `route` (0 when unknown). */
42
+ function depthOf(route: string, patternByName: ReadonlyMap<string, string>): number;
43
+ /**
44
+ * Entries ordered by the pattern depth of their own route, declaration order within one depth.
45
+ * Expanding them in this order puts an ancestor's entries before a descendant's on every route.
46
+ */
47
+ export function byRouteDepth<T extends {
48
+ readonly route: string;
49
+ }>(entries: T[], patternByName: ReadonlyMap<string, string>): T[];
50
+ /**
51
+ * Copy each route-specific entry to every descendant route (`inheritance: "pattern-tree"`).
52
+ * Global (`"*"`) entries and entries for routes without a known pattern are kept as-is.
53
+ * Ordered by the pattern depth of the route an entry was declared for, so on every route
54
+ * ancestor guards run before descendant guards, whatever the declaration order. Where global
55
+ * entries end up does not matter: the pipeline runs global guards separately.
56
+ * A route named `"*"` does not pass its entries on, because a `"*"` entry is a global one.
57
+ */
58
+ export function expandToDescendants<T extends {
59
+ readonly route: string;
60
+ }>(entries: T[], routes: RoutePattern[]): T[];
61
+ /**
62
+ * Entries a newly added route inherits (`inheritance: "pattern-tree"`): copies of its
63
+ * ancestors' entries for the new route, and copies of its own entries for its existing
64
+ * descendants. `routes` must include the new route. Ordered like {@link expandToDescendants};
65
+ * where the entries go among those a route has already is up to the caller.
66
+ */
67
+ export function expandForNewRoute<T extends {
68
+ readonly route: string;
69
+ }>(entries: T[], newName: string, routes: RoutePattern[]): T[];
70
+ }
71
+ //# sourceMappingURL=PatternTree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PatternTree.d.ts","sourceRoot":"../../../../..","sources":["src/PatternTree.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,8BAA8B,CAAC;IAC9C;;OAEG;IAEH,8EAA8E;IAC9E,MAAM,wBAAwB,QAAc,CAAC;IAE7C;;;;;;;;;;;OAWG;IACH,SAAS,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM7C;IAED;;;;;OAKG;IACH,SAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAKzD;IAED;;;;;;;OAOG;IACH,SAAgB,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAW5F;IAED,qCAAqC;IACrC,UAAiB,YAAY;QAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KACzB;IAED,+EAA+E;IAC/E,SAAS,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAElF;IAED;;;OAGG;IACH,SAAgB,YAAY,CAAC,CAAC,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAChE,OAAO,EAAE,CAAC,EAAE,EACZ,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,CAAC,EAAE,CAEL;IAED;;;;;;;OAOG;IACH,SAAgB,mBAAmB,CAAC,CAAC,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,CAkBnH;IAED;;;;;OAKG;IACH,SAAgB,iBAAiB,CAAC,CAAC,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EACrE,OAAO,EAAE,CAAC,EAAE,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EAAE,GACpB,CAAC,EAAE,CAuBL;CAEA"}
@@ -0,0 +1,2 @@
1
+ sap.ui.define([],function(){"use strict";const t=/^:[^:]*:$/;function e(t){const e=t.indexOf("{?");if(e!==-1)return t.slice(0,e);const n=t.indexOf(":?");if(n!==-1)return t.slice(0,n);return t}function n(n){return n.split("/").map(e).filter(e=>e!==""&&!t.test(e))}function r(t,e){if(t==="")return true;const r=n(t);if(r.length===0)return false;const o=n(e);if(o.length<=r.length)return false;return r.every((t,e)=>{const n=o[e];if(t===n)return true;return t.startsWith("{")&&n.startsWith("{")})}function o(t,e){return n(e.get(t)??"").length}function u(t,e){return t.toSorted((t,n)=>o(t.route,e)-o(n.route,e))}function i(t,e){if(e.length===0)return t;const n=new Map(e.map(t=>[t.name,t.pattern]));const o=[];for(const i of u(t,n)){o.push(i);if(i.route==="*")continue;const t=n.get(i.route);if(t===undefined)continue;for(const{name:n,pattern:u}of e){if(n!==i.route&&r(t,u)){o.push({...i,route:n})}}}return o}function s(t,e,n){const o=new Map(n.map(t=>[t.name,t.pattern]));const i=o.get(e);if(i===undefined)return[];const s=[];for(const f of u(t,o)){if(f.route==="*")continue;if(f.route===e){for(const{name:t,pattern:o}of n){if(t!==e&&r(i,o)){s.push({...f,route:t})}}}else{const t=o.get(f.route);if(t!==undefined&&r(t,i)){s.push({...f,route:e})}}}return s}var f={__esModule:true};f.patternSegments=n;f.isPatternAncestor=r;f.byRouteDepth=u;f.expandToDescendants=i;f.expandForNewRoute=s;return f});
2
+ //# sourceMappingURL=PatternTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PatternTree.js","names":["OPTIONAL_OR_REST_SEGMENT","stripInlineQuery","seg","mqIdx","indexOf","slice","oqIdx","patternSegments","pattern","split","map","filter","test","isPatternAncestor","ancestorPattern","candidatePattern","ancestorSegments","length","candidateSegments","every","i","candidateSeg","startsWith","depthOf","route","patternByName","get","byRouteDepth","entries","toSorted","a","b","expandToDescendants","routes","Map","r","name","expanded","entry","push","undefined","expandForNewRoute","newName","newPattern","result","__exports","__esModule"],"sources":["./PatternTree.ts"],"sourcesContent":["/**\n * Pattern-tree helpers: compare UI5 route patterns by their mandatory path segments.\n */\n\n/** Matches a standalone optional (`:param:`) or rest (`:param*:`) segment. */\nconst OPTIONAL_OR_REST_SEGMENT = /^:[^:]*:$/;\n\n/**\n * Strips inline query and optional-query suffixes from a segment.\n *\n * UI5 (crossroads.js) allows query parameters to attach directly to a\n * path segment without a `/` separator:\n * - `product{?query}` → mandatory query on `product`\n * - `product:?query:` → optional query on `product`\n * - `{id}{?query}` → mandatory param + mandatory query\n *\n * For pattern-tree ancestry we only care about the path portion,\n * so these suffixes are stripped.\n */\nfunction stripInlineQuery(seg: string): string {\n\tconst mqIdx = seg.indexOf(\"{?\");\n\tif (mqIdx !== -1) return seg.slice(0, mqIdx);\n\tconst oqIdx = seg.indexOf(\":?\");\n\tif (oqIdx !== -1) return seg.slice(0, oqIdx);\n\treturn seg;\n}\n\n/**\n * Extract mandatory path segments from a UI5 route pattern.\n *\n * Splits on `/`, strips inline query suffixes, then drops empty segments,\n * standalone optional (`:param:`), and rest (`:param*:`) segments.\n */\nexport function patternSegments(pattern: string): string[] {\n\treturn pattern\n\t\t.split(\"/\")\n\t\t.map(stripInlineQuery)\n\t\t.filter((seg) => seg !== \"\" && !OPTIONAL_OR_REST_SEGMENT.test(seg));\n}\n\n/**\n * Check if `ancestorPattern` is a URL-tree ancestor of `candidatePattern`.\n *\n * Both patterns are reduced to their mandatory path segments and compared\n * positionally. Mandatory parameter segments (`{paramA}`, `{paramB}`) are\n * treated as equivalent regardless of name, so `employees/{empId}` is\n * recognized as an ancestor of `employees/{id}/resume`.\n */\nexport function isPatternAncestor(ancestorPattern: string, candidatePattern: string): boolean {\n\tif (ancestorPattern === \"\") return true;\n\tconst ancestorSegments = patternSegments(ancestorPattern);\n\tif (ancestorSegments.length === 0) return false;\n\tconst candidateSegments = patternSegments(candidatePattern);\n\tif (candidateSegments.length <= ancestorSegments.length) return false;\n\treturn ancestorSegments.every((seg, i) => {\n\t\tconst candidateSeg = candidateSegments[i];\n\t\tif (seg === candidateSeg) return true;\n\t\treturn seg.startsWith(\"{\") && candidateSeg.startsWith(\"{\");\n\t});\n}\n\n/** A route name with its pattern. */\nexport interface RoutePattern {\n\treadonly name: string;\n\treadonly pattern: string;\n}\n\n/** Number of mandatory segments in the pattern of `route` (0 when unknown). */\nfunction depthOf(route: string, patternByName: ReadonlyMap<string, string>): number {\n\treturn patternSegments(patternByName.get(route) ?? \"\").length;\n}\n\n/**\n * Entries ordered by the pattern depth of their own route, declaration order within one depth.\n * Expanding them in this order puts an ancestor's entries before a descendant's on every route.\n */\nexport function byRouteDepth<T extends { readonly route: string }>(\n\tentries: T[],\n\tpatternByName: ReadonlyMap<string, string>,\n): T[] {\n\treturn entries.toSorted((a, b) => depthOf(a.route, patternByName) - depthOf(b.route, patternByName));\n}\n\n/**\n * Copy each route-specific entry to every descendant route (`inheritance: \"pattern-tree\"`).\n * Global (`\"*\"`) entries and entries for routes without a known pattern are kept as-is.\n * Ordered by the pattern depth of the route an entry was declared for, so on every route\n * ancestor guards run before descendant guards, whatever the declaration order. Where global\n * entries end up does not matter: the pipeline runs global guards separately.\n * A route named `\"*\"` does not pass its entries on, because a `\"*\"` entry is a global one.\n */\nexport function expandToDescendants<T extends { readonly route: string }>(entries: T[], routes: RoutePattern[]): T[] {\n\tif (routes.length === 0) return entries;\n\tconst patternByName = new Map(routes.map((r) => [r.name, r.pattern]));\n\n\tconst expanded: T[] = [];\n\tfor (const entry of byRouteDepth(entries, patternByName)) {\n\t\texpanded.push(entry);\n\t\tif (entry.route === \"*\") continue;\n\t\tconst ancestorPattern = patternByName.get(entry.route);\n\t\tif (ancestorPattern === undefined) continue;\n\t\tfor (const { name, pattern } of routes) {\n\t\t\tif (name !== entry.route && isPatternAncestor(ancestorPattern, pattern)) {\n\t\t\t\texpanded.push({ ...entry, route: name });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn expanded;\n}\n\n/**\n * Entries a newly added route inherits (`inheritance: \"pattern-tree\"`): copies of its\n * ancestors' entries for the new route, and copies of its own entries for its existing\n * descendants. `routes` must include the new route. Ordered like {@link expandToDescendants};\n * where the entries go among those a route has already is up to the caller.\n */\nexport function expandForNewRoute<T extends { readonly route: string }>(\n\tentries: T[],\n\tnewName: string,\n\troutes: RoutePattern[],\n): T[] {\n\tconst patternByName = new Map(routes.map((r) => [r.name, r.pattern]));\n\tconst newPattern = patternByName.get(newName);\n\tif (newPattern === undefined) return [];\n\n\tconst result: T[] = [];\n\tfor (const entry of byRouteDepth(entries, patternByName)) {\n\t\tif (entry.route === \"*\") continue;\n\t\tif (entry.route === newName) {\n\t\t\tfor (const { name, pattern } of routes) {\n\t\t\t\tif (name !== newName && isPatternAncestor(newPattern, pattern)) {\n\t\t\t\t\tresult.push({ ...entry, route: name });\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst ancestorPattern = patternByName.get(entry.route);\n\t\t\tif (ancestorPattern !== undefined && isPatternAncestor(ancestorPattern, newPattern)) {\n\t\t\t\tresult.push({ ...entry, route: newName });\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n"],"mappings":"yCAKA,MAAMA,EAA2B,YAcjC,SAASC,EAAiBC,GACzB,MAAMC,EAAQD,EAAIE,QAAQ,MAC1B,GAAID,KAAW,EAAG,OAAOD,EAAIG,MAAM,EAAGF,GACtC,MAAMG,EAAQJ,EAAIE,QAAQ,MAC1B,GAAIE,KAAW,EAAG,OAAOJ,EAAIG,MAAM,EAAGC,GACtC,OAAOJ,CACR,CAQO,SAASK,EAAgBC,GAC/B,OAAOA,EACLC,MAAM,KACNC,IAAIT,GACJU,OAAQT,GAAQA,IAAQ,KAAOF,EAAyBY,KAAKV,GAChE,CAUO,SAASW,EAAkBC,EAAyBC,GAC1D,GAAID,IAAoB,GAAI,OAAO,KACnC,MAAME,EAAmBT,EAAgBO,GACzC,GAAIE,EAAiBC,SAAW,EAAG,OAAO,MAC1C,MAAMC,EAAoBX,EAAgBQ,GAC1C,GAAIG,EAAkBD,QAAUD,EAAiBC,OAAQ,OAAO,MAChE,OAAOD,EAAiBG,MAAM,CAACjB,EAAKkB,KACnC,MAAMC,EAAeH,EAAkBE,GACvC,GAAIlB,IAAQmB,EAAc,OAAO,KACjC,OAAOnB,EAAIoB,WAAW,MAAQD,EAAaC,WAAW,MAExD,CASA,SAASC,EAAQC,EAAeC,GAC/B,OAAOlB,EAAgBkB,EAAcC,IAAIF,IAAU,IAAIP,MACxD,CAMO,SAASU,EACfC,EACAH,GAEA,OAAOG,EAAQC,SAAS,CAACC,EAAGC,IAAMR,EAAQO,EAAEN,MAAOC,GAAiBF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CACR,CAAC,IAAAC,EAAA,CAAAC,WAAA,MAAAD,EAAAtC,kBAAAsC,EAAAhC,oBAAAgC,EAAAlB,eAAAkB,EAAAb,sBAAAa,EAAAJ,oBAAA,OAAAI,CAAA","ignoreList":[]}
@@ -0,0 +1,84 @@
1
+ sap.ui.define(["./PatternTree"], function (___PatternTree) {
2
+ "use strict";
3
+
4
+ /**
5
+ * Route metadata: manifest and runtime values per route, resolved with
6
+ * optional pattern-tree inheritance and cached until something changes.
7
+ */
8
+ const isPatternAncestor = ___PatternTree["isPatternAncestor"];
9
+ const patternSegments = ___PatternTree["patternSegments"];
10
+ const EMPTY_META = Object.freeze({});
11
+ class RouteMetaStore {
12
+ _runtime = new Map();
13
+ _resolved = new Map();
14
+ /**
15
+ * @param manifest - Frozen metadata per route from the manifest `routeMeta` block.
16
+ * @param routes - Route patterns for pattern-tree inheritance, or `null` for none.
17
+ */
18
+ constructor(manifest, routes) {
19
+ this._manifest = manifest;
20
+ this._routes = routes;
21
+ }
22
+
23
+ /** Resolved metadata for a route: frozen, and the same object until something changes. */
24
+ get(routeName) {
25
+ let result = this._resolved.get(routeName);
26
+ if (result === undefined) {
27
+ result = this._routes ? this._resolveInherited(routeName, this._routes()) : this._resolveOwn(routeName);
28
+ if (Object.keys(result).length === 0) result = EMPTY_META;
29
+ this._resolved.set(routeName, result);
30
+ }
31
+ return result;
32
+ }
33
+
34
+ /** Set runtime metadata for a route, merged over its manifest metadata. */
35
+ set(routeName, meta) {
36
+ this._runtime.set(routeName, Object.freeze({
37
+ ...meta
38
+ }));
39
+ this._resolved.clear();
40
+ }
41
+
42
+ /** Drop resolved values, e.g. after a route was added that changes inheritance. */
43
+ invalidate() {
44
+ this._resolved.clear();
45
+ }
46
+
47
+ /** Drop all metadata, manifest and runtime. */
48
+ clear() {
49
+ this._manifest.clear();
50
+ this._runtime.clear();
51
+ this._resolved.clear();
52
+ }
53
+
54
+ /** Manifest metadata with runtime metadata on top, without inheritance. */
55
+ _resolveOwn(routeName) {
56
+ const manifest = this._manifest.get(routeName);
57
+ const runtime = this._runtime.get(routeName);
58
+ if (!runtime) return manifest ?? EMPTY_META;
59
+ if (!manifest) return runtime;
60
+ return Object.freeze({
61
+ ...manifest,
62
+ ...runtime
63
+ });
64
+ }
65
+
66
+ /** Ancestors' metadata shallowest-first, then the route's own; each level manifest then runtime. */
67
+ _resolveInherited(routeName, routes) {
68
+ const own = routes.find(r => r.name === routeName);
69
+ if (!own) return this._resolveOwn(routeName);
70
+ const levels = routes
71
+ // Only the empty pattern counts as its own ancestor; merging a level twice changes nothing.
72
+ .filter(r => isPatternAncestor(r.pattern, own.pattern)).toSorted((a, b) => patternSegments(a.pattern).length - patternSegments(b.pattern).length).map(r => r.name);
73
+ levels.push(routeName);
74
+ const merged = {};
75
+ for (const name of levels) {
76
+ Object.assign(merged, this._manifest.get(name), this._runtime.get(name));
77
+ }
78
+ return Object.freeze(merged);
79
+ }
80
+ }
81
+ RouteMetaStore.EMPTY_META = EMPTY_META;
82
+ return RouteMetaStore;
83
+ });
84
+ //# sourceMappingURL=RouteMeta-dbg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteMeta-dbg.js","names":["isPatternAncestor","___PatternTree","patternSegments","EMPTY_META","Object","freeze","RouteMetaStore","_runtime","Map","_resolved","constructor","manifest","routes","_manifest","_routes","get","routeName","result","undefined","_resolveInherited","_resolveOwn","keys","length","set","meta","clear","invalidate","runtime","own","find","r","name","levels","filter","pattern","toSorted","a","b","map","push","merged","assign"],"sourceRoot":"./","sources":["RouteMeta.ts"],"sourcesContent":["/**\n * Route metadata: manifest and runtime values per route, resolved with\n * optional pattern-tree inheritance and cached until something changes.\n */\nimport { isPatternAncestor, patternSegments, type RoutePattern } from \"./PatternTree\";\n\ntype Meta = Readonly<Record<string, unknown>>;\n\nexport const EMPTY_META: Meta = Object.freeze({});\n\nexport default class RouteMetaStore {\n\tprivate readonly _manifest: Map<string, Meta>;\n\tprivate readonly _runtime = new Map<string, Meta>();\n\tprivate readonly _resolved = new Map<string, Meta>();\n\tprivate readonly _routes: (() => RoutePattern[]) | null;\n\n\t/**\n\t * @param manifest - Frozen metadata per route from the manifest `routeMeta` block.\n\t * @param routes - Route patterns for pattern-tree inheritance, or `null` for none.\n\t */\n\tconstructor(manifest: Map<string, Meta>, routes: (() => RoutePattern[]) | null) {\n\t\tthis._manifest = manifest;\n\t\tthis._routes = routes;\n\t}\n\n\t/** Resolved metadata for a route: frozen, and the same object until something changes. */\n\tget(routeName: string): Meta {\n\t\tlet result = this._resolved.get(routeName);\n\t\tif (result === undefined) {\n\t\t\tresult = this._routes ? this._resolveInherited(routeName, this._routes()) : this._resolveOwn(routeName);\n\t\t\tif (Object.keys(result).length === 0) result = EMPTY_META;\n\t\t\tthis._resolved.set(routeName, result);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Set runtime metadata for a route, merged over its manifest metadata. */\n\tset(routeName: string, meta: Record<string, unknown>): void {\n\t\tthis._runtime.set(routeName, Object.freeze({ ...meta }));\n\t\tthis._resolved.clear();\n\t}\n\n\t/** Drop resolved values, e.g. after a route was added that changes inheritance. */\n\tinvalidate(): void {\n\t\tthis._resolved.clear();\n\t}\n\n\t/** Drop all metadata, manifest and runtime. */\n\tclear(): void {\n\t\tthis._manifest.clear();\n\t\tthis._runtime.clear();\n\t\tthis._resolved.clear();\n\t}\n\n\t/** Manifest metadata with runtime metadata on top, without inheritance. */\n\tprivate _resolveOwn(routeName: string): Meta {\n\t\tconst manifest = this._manifest.get(routeName);\n\t\tconst runtime = this._runtime.get(routeName);\n\t\tif (!runtime) return manifest ?? EMPTY_META;\n\t\tif (!manifest) return runtime;\n\t\treturn Object.freeze({ ...manifest, ...runtime });\n\t}\n\n\t/** Ancestors' metadata shallowest-first, then the route's own; each level manifest then runtime. */\n\tprivate _resolveInherited(routeName: string, routes: RoutePattern[]): Meta {\n\t\tconst own = routes.find((r) => r.name === routeName);\n\t\tif (!own) return this._resolveOwn(routeName);\n\n\t\tconst levels = routes\n\t\t\t// Only the empty pattern counts as its own ancestor; merging a level twice changes nothing.\n\t\t\t.filter((r) => isPatternAncestor(r.pattern, own.pattern))\n\t\t\t.toSorted((a, b) => patternSegments(a.pattern).length - patternSegments(b.pattern).length)\n\t\t\t.map((r) => r.name);\n\t\tlevels.push(routeName);\n\n\t\tconst merged: Record<string, unknown> = {};\n\t\tfor (const name of levels) {\n\t\t\tObject.assign(merged, this._manifest.get(name), this._runtime.get(name));\n\t\t}\n\t\treturn Object.freeze(merged);\n\t}\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAISA,iBAAiB,GAAAC,cAAA;EAAA,MAAEC,eAAe,GAAAD,cAAA;EAIpC,MAAME,UAAgB,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC;EAElC,MAAMC,cAAc,CAAC;IAElBC,QAAQ,GAAG,IAAIC,GAAG,CAAe,CAAC;IAClCC,SAAS,GAAG,IAAID,GAAG,CAAe,CAAC;IAGpD;AACD;AACA;AACA;IACCE,WAAWA,CAACC,QAA2B,EAAEC,MAAqC,EAAE;MAC/E,IAAI,CAACC,SAAS,GAAGF,QAAQ;MACzB,IAAI,CAACG,OAAO,GAAGF,MAAM;IACtB;;IAEA;IACAG,GAAGA,CAACC,SAAiB,EAAQ;MAC5B,IAAIC,MAAM,GAAG,IAAI,CAACR,SAAS,CAACM,GAAG,CAACC,SAAS,CAAC;MAC1C,IAAIC,MAAM,KAAKC,SAAS,EAAE;QACzBD,MAAM,GAAG,IAAI,CAACH,OAAO,GAAG,IAAI,CAACK,iBAAiB,CAACH,SAAS,EAAE,IAAI,CAACF,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAACM,WAAW,CAACJ,SAAS,CAAC;QACvG,IAAIZ,MAAM,CAACiB,IAAI,CAACJ,MAAM,CAAC,CAACK,MAAM,KAAK,CAAC,EAAEL,MAAM,GAAGd,UAAU;QACzD,IAAI,CAACM,SAAS,CAACc,GAAG,CAACP,SAAS,EAAEC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