mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
add types
This commit is contained in:
@@ -42,7 +42,7 @@ export class MarketplaceService implements AbstractMarketplaceService {
|
|||||||
private readonly knownHosts$: Observable<StoreIdentity[]> = this.patch
|
private readonly knownHosts$: Observable<StoreIdentity[]> = this.patch
|
||||||
.watch$('ui', 'marketplace', 'knownHosts')
|
.watch$('ui', 'marketplace', 'knownHosts')
|
||||||
.pipe(
|
.pipe(
|
||||||
map(hosts => {
|
map((hosts: { [url: string]: UIStore }) => {
|
||||||
const { start9, community } = this.config.marketplace
|
const { start9, community } = this.config.marketplace
|
||||||
let arr = [
|
let arr = [
|
||||||
toStoreIdentity(start9, hosts[start9]),
|
toStoreIdentity(start9, hosts[start9]),
|
||||||
@@ -81,31 +81,35 @@ export class MarketplaceService implements AbstractMarketplaceService {
|
|||||||
shareReplay({ bufferSize: 1, refCount: true }),
|
shareReplay({ bufferSize: 1, refCount: true }),
|
||||||
)
|
)
|
||||||
|
|
||||||
private readonly marketplace$ = this.knownHosts$.pipe(
|
private readonly marketplace$: Observable<Marketplace> =
|
||||||
startWith<StoreIdentity[]>([]),
|
this.knownHosts$.pipe(
|
||||||
pairwise(),
|
startWith<StoreIdentity[]>([]),
|
||||||
mergeMap(([prev, curr]) =>
|
pairwise(),
|
||||||
curr.filter(c => !prev.find(p => sameUrl(c.url, p.url))),
|
mergeMap(([prev, curr]) =>
|
||||||
),
|
curr.filter(c => !prev.find(p => sameUrl(c.url, p.url))),
|
||||||
mergeMap(({ url, name }) =>
|
|
||||||
this.fetchStore$(url).pipe(
|
|
||||||
tap(data => {
|
|
||||||
if (data?.info.name) this.updateStoreName(url, name, data.info.name)
|
|
||||||
}),
|
|
||||||
map<StoreData | null, [string, StoreData | null]>(data => [url, data]),
|
|
||||||
startWith<[string, StoreData | null]>([url, null]),
|
|
||||||
),
|
),
|
||||||
),
|
mergeMap(({ url, name }) =>
|
||||||
scan<[string, StoreData | null], Record<string, StoreData | null>>(
|
this.fetchStore$(url).pipe(
|
||||||
(requests, [url, store]) => {
|
tap(data => {
|
||||||
requests[url] = store
|
if (data?.info.name) this.updateStoreName(url, name, data.info.name)
|
||||||
|
}),
|
||||||
|
map<StoreData | null, [string, StoreData | null]>(data => [
|
||||||
|
url,
|
||||||
|
data,
|
||||||
|
]),
|
||||||
|
startWith<[string, StoreData | null]>([url, null]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
scan<[string, StoreData | null], Record<string, StoreData | null>>(
|
||||||
|
(requests, [url, store]) => {
|
||||||
|
requests[url] = store
|
||||||
|
|
||||||
return requests
|
return requests
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
),
|
),
|
||||||
shareReplay({ bufferSize: 1, refCount: true }),
|
shareReplay({ bufferSize: 1, refCount: true }),
|
||||||
)
|
)
|
||||||
|
|
||||||
private readonly filteredMarketplace$ = combineLatest([
|
private readonly filteredMarketplace$ = combineLatest([
|
||||||
this.clientStorageService.showDevTools$,
|
this.clientStorageService.showDevTools$,
|
||||||
|
|||||||
Reference in New Issue
Block a user