()
| 358 | } |
| 359 | |
| 360 | makeKindLists () { |
| 361 | const getters = Object.fromEntries( Object.entries( this.lists ).map( ([ listName ]) => { |
| 362 | |
| 363 | const listEndpointPrefix = this.getListOptions( listName ).endpointPrefix |
| 364 | |
| 365 | return [ |
| 366 | // Key |
| 367 | listEndpointPrefix, |
| 368 | () => this.getListArrayMemoized( listName ) |
| 369 | ] |
| 370 | } ) ) |
| 371 | |
| 372 | // Add getters for categories |
| 373 | // Homebrew category overrides Homebrew app type from above |
| 374 | for ( const categorySlug in categories ) { |
| 375 | // Throw if category already defined |
| 376 | if ( getters[categorySlug] ) throw Error(`Category ${categorySlug} already defined`) |
| 377 | |
| 378 | getters[categorySlug] = () => this.getAppCategoryList( categorySlug ) |
| 379 | } |
| 380 | |
| 381 | const kindLists = {} |
| 382 | |
| 383 | for ( const kindSlug in getters ) { |
| 384 | // Throw if kindSlug already defined |
| 385 | if ( kindLists[kindSlug] ) throw Error(`Kind ${kindSlug} already defined`) |
| 386 | |
| 387 | kindLists[ kindSlug ] = new KindList({ |
| 388 | // Get list method |
| 389 | list: getters[ kindSlug ], |
| 390 | kindSlug |
| 391 | }) |
| 392 | } |
| 393 | |
| 394 | return kindLists |
| 395 | } |
| 396 | |
| 397 | get kindRoutes () { |
| 398 | return Object.entries( this.makeKindLists() ).map( ([ kindSlug, kindList ]) => { |
no test coverage detected