mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
Fix/id params (#1414)
* watch config.json for changes when just building frontend * fix version for data consistency * clone param ids so not recursively stringified; add global type for stringified instances * ensure only most recent data source grabbed to fix issue with service auto update on marketplace switch * use take instead of shallow cloning data
This commit is contained in:
2
Makefile
2
Makefile
@@ -71,4 +71,4 @@ patch-db/client/dist: $(PATCH_DB_CLIENT_SRC) patch-db/client/node_modules
|
||||
npm --prefix patch-db/client run build
|
||||
|
||||
# this is a convenience step to build all frontends - it is not referenced elsewhere in this file
|
||||
frontend: frontend/node_modules $(EMBASSY_UIS)
|
||||
frontend: frontend/node_modules frontend/config.json $(EMBASSY_UIS)
|
||||
|
||||
@@ -610,7 +610,7 @@ export module Mock {
|
||||
}
|
||||
} = {
|
||||
bitcoind: {
|
||||
'0.19.2': {
|
||||
'0.19.0': {
|
||||
icon: BTC_ICON,
|
||||
license: 'licenseUrl',
|
||||
instructions: 'instructionsUrl',
|
||||
|
||||
@@ -472,3 +472,18 @@ export interface AvailableWifi {
|
||||
strength: number
|
||||
security: string[]
|
||||
}
|
||||
|
||||
declare global {
|
||||
type Stringified<T> = string & {
|
||||
[P in keyof T]: T[P]
|
||||
}
|
||||
|
||||
interface JSON {
|
||||
stringify<T>(
|
||||
value: T,
|
||||
replacer?: (key: string, value: any) => any,
|
||||
space?: string | number,
|
||||
): string & Stringified<T>
|
||||
parse<T>(text: Stringified<T>, reviver?: (key: any, value: any) => any): T
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
shareReplay,
|
||||
startWith,
|
||||
switchMap,
|
||||
take,
|
||||
tap,
|
||||
} from 'rxjs/operators'
|
||||
|
||||
@@ -45,6 +46,7 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
||||
)
|
||||
|
||||
private readonly pkg$: Observable<MarketplacePkg[]> = this.init$.pipe(
|
||||
take(1),
|
||||
switchMap(({ url, name }) =>
|
||||
from(this.getMarketplacePkgs({ page: 1, 'per-page': 100 }, url)).pipe(
|
||||
tap(() => this.onPackages(name)),
|
||||
@@ -80,6 +82,7 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
||||
getPackage(id: string, version: string): Observable<MarketplacePkg> {
|
||||
const params = { ids: [{ id, version }] }
|
||||
const fallback$ = this.init$.pipe(
|
||||
take(1),
|
||||
switchMap(({ url }) => from(this.getMarketplacePkgs(params, url))),
|
||||
map(pkgs => this.findPackage(pkgs, id, version)),
|
||||
startWith(null),
|
||||
@@ -135,6 +138,7 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
||||
req: Omit<RR.InstallPackageReq, 'marketplace-url'>,
|
||||
): Observable<unknown> {
|
||||
return this.getMarketplace().pipe(
|
||||
take(1),
|
||||
switchMap(({ url }) =>
|
||||
from(
|
||||
this.api.installPackage({
|
||||
@@ -172,7 +176,7 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
||||
url: string,
|
||||
): Promise<RR.GetMarketplacePackagesRes> {
|
||||
if (params.query) delete params.category
|
||||
if (params.ids) params.ids = JSON.stringify(params.ids) as any
|
||||
if (params.ids) params.ids = JSON.stringify(params.ids)
|
||||
|
||||
const qp: RR.GetMarketplacePackagesReq = {
|
||||
...params,
|
||||
|
||||
Reference in New Issue
Block a user