mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +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
|
npm --prefix patch-db/client run build
|
||||||
|
|
||||||
# this is a convenience step to build all frontends - it is not referenced elsewhere in this file
|
# 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: {
|
bitcoind: {
|
||||||
'0.19.2': {
|
'0.19.0': {
|
||||||
icon: BTC_ICON,
|
icon: BTC_ICON,
|
||||||
license: 'licenseUrl',
|
license: 'licenseUrl',
|
||||||
instructions: 'instructionsUrl',
|
instructions: 'instructionsUrl',
|
||||||
|
|||||||
@@ -472,3 +472,18 @@ export interface AvailableWifi {
|
|||||||
strength: number
|
strength: number
|
||||||
security: string[]
|
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,
|
shareReplay,
|
||||||
startWith,
|
startWith,
|
||||||
switchMap,
|
switchMap,
|
||||||
|
take,
|
||||||
tap,
|
tap,
|
||||||
} from 'rxjs/operators'
|
} from 'rxjs/operators'
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
|||||||
)
|
)
|
||||||
|
|
||||||
private readonly pkg$: Observable<MarketplacePkg[]> = this.init$.pipe(
|
private readonly pkg$: Observable<MarketplacePkg[]> = this.init$.pipe(
|
||||||
|
take(1),
|
||||||
switchMap(({ url, name }) =>
|
switchMap(({ url, name }) =>
|
||||||
from(this.getMarketplacePkgs({ page: 1, 'per-page': 100 }, url)).pipe(
|
from(this.getMarketplacePkgs({ page: 1, 'per-page': 100 }, url)).pipe(
|
||||||
tap(() => this.onPackages(name)),
|
tap(() => this.onPackages(name)),
|
||||||
@@ -80,6 +82,7 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
|||||||
getPackage(id: string, version: string): Observable<MarketplacePkg> {
|
getPackage(id: string, version: string): Observable<MarketplacePkg> {
|
||||||
const params = { ids: [{ id, version }] }
|
const params = { ids: [{ id, version }] }
|
||||||
const fallback$ = this.init$.pipe(
|
const fallback$ = this.init$.pipe(
|
||||||
|
take(1),
|
||||||
switchMap(({ url }) => from(this.getMarketplacePkgs(params, url))),
|
switchMap(({ url }) => from(this.getMarketplacePkgs(params, url))),
|
||||||
map(pkgs => this.findPackage(pkgs, id, version)),
|
map(pkgs => this.findPackage(pkgs, id, version)),
|
||||||
startWith(null),
|
startWith(null),
|
||||||
@@ -135,6 +138,7 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
|||||||
req: Omit<RR.InstallPackageReq, 'marketplace-url'>,
|
req: Omit<RR.InstallPackageReq, 'marketplace-url'>,
|
||||||
): Observable<unknown> {
|
): Observable<unknown> {
|
||||||
return this.getMarketplace().pipe(
|
return this.getMarketplace().pipe(
|
||||||
|
take(1),
|
||||||
switchMap(({ url }) =>
|
switchMap(({ url }) =>
|
||||||
from(
|
from(
|
||||||
this.api.installPackage({
|
this.api.installPackage({
|
||||||
@@ -172,7 +176,7 @@ export class MarketplaceService extends AbstractMarketplaceService {
|
|||||||
url: string,
|
url: string,
|
||||||
): Promise<RR.GetMarketplacePackagesRes> {
|
): Promise<RR.GetMarketplacePackagesRes> {
|
||||||
if (params.query) delete params.category
|
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 = {
|
const qp: RR.GetMarketplacePackagesReq = {
|
||||||
...params,
|
...params,
|
||||||
|
|||||||
Reference in New Issue
Block a user