| 50 | } |
| 51 | |
| 52 | const matchPattern = (pattern: string, value: string): string | undefined => { |
| 53 | const star = pattern.indexOf("*") |
| 54 | if (star === -1) { |
| 55 | return pattern === value ? "" : undefined |
| 56 | } |
| 57 | const prefix = pattern.slice(0, star) |
| 58 | const suffix = pattern.slice(star + 1) |
| 59 | return value.startsWith(prefix) && value.endsWith(suffix) |
| 60 | ? value.slice(prefix.length, value.length - suffix.length) |
| 61 | : undefined |
| 62 | } |
| 63 | |
| 64 | export class Discovery extends Context.Service<Discovery, { |
| 65 | readonly discoverEntrypoints: ( |