no seeding marketplace"

dep icons

matt comments addressed

fix circular dependencies

Update marketplace.service.ts
This commit is contained in:
Drew Ansbacher
2022-02-02 15:13:08 -07:00
committed by Aiden McClelland
parent 0c0cd9d0a0
commit 01d766fce9
20 changed files with 250 additions and 209 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -96,23 +96,16 @@ export abstract class ApiService implements Source<DataModel>, Http<DataModel> {
// marketplace URLs
abstract marketplaceProxy<T>(
path: string,
params: {},
url: string,
): Promise<T>
abstract getEos(
params: RR.GetMarketplaceEOSReq,
): Promise<RR.GetMarketplaceEOSRes>
abstract getMarketplaceData(
params: RR.GetMarketplaceDataReq,
url?: string,
): Promise<RR.GetMarketplaceDataRes>
abstract getMarketplacePkgs(
params: RR.GetMarketplacePackagesReq,
): Promise<RR.GetMarketplacePackagesRes>
abstract getReleaseNotes(
params: RR.GetReleaseNotesReq,
): Promise<RR.GetReleaseNotesRes>
// password
// abstract updatePassword (params: RR.UpdatePasswordReq): Promise<RR.UpdatePasswordRes>

View File

@@ -3,7 +3,6 @@ import { HttpService, Method } from '../http.service'
import { ApiService } from './embassy-api.service'
import { RR } from './api.types'
import { parsePropertiesPermissive } from 'src/app/util/properties.util'
import { PatchDbService } from '../patch-db/patch-db.service'
import { ConfigService } from '../config.service'
@Injectable()
@@ -12,14 +11,10 @@ export class LiveApiService extends ApiService {
constructor(
private readonly http: HttpService,
private readonly patch: PatchDbService,
private readonly config: ConfigService,
) {
super()
;(window as any).rpcClient = this
this.patch.watch$('ui', 'marketplace', 'selected-id').subscribe(id => {
this.marketplaceUrl = id
})
}
async getStatic(url: string): Promise<string> {
@@ -108,12 +103,7 @@ export class LiveApiService extends ApiService {
// marketplace URLs
private async marketplaceProxy<T>(
path: string,
params: {},
url?: string,
): Promise<T> {
url = url || this.marketplaceUrl
async marketplaceProxy<T>(path: string, params: {}, url: string): Promise<T> {
const fullURL = `${url}${path}?${new URLSearchParams(params).toString()}`
return this.http.rpcRequest({
method: 'marketplace.get',
@@ -127,33 +117,10 @@ export class LiveApiService extends ApiService {
return this.marketplaceProxy(
'/eos/latest',
params,
this.config.eosMarketplaceUrl,
this.config.marketplace.url,
)
}
async getMarketplaceData(
params: RR.GetMarketplaceDataReq,
url?: string,
): Promise<RR.GetMarketplaceDataRes> {
return this.marketplaceProxy('/package/data', params, url)
}
async getMarketplacePkgs(
params: RR.GetMarketplacePackagesReq,
): Promise<RR.GetMarketplacePackagesRes> {
if (params.query) params.category = undefined
return this.marketplaceProxy('/package/index', {
...params,
ids: JSON.stringify(params.ids),
})
}
async getReleaseNotes(
params: RR.GetReleaseNotesReq,
): Promise<RR.GetReleaseNotesRes> {
return this.marketplaceProxy('/package/release-notes', params)
}
// password
// async updatePassword (params: RR.UpdatePasswordReq): Promise<RR.UpdatePasswordRes> {
// return this.http.rpcRequest({ method: 'password.set', params })

View File

@@ -188,6 +188,29 @@ export class MockApiService extends ApiService {
// marketplace URLs
async marketplaceProxy (path: string, params: {}, url: string): Promise<any> {
await pauseFor(2000)
if (path === '/package/data') {
return {
name: 'Dark9',
categories: [
'featured',
'bitcoin',
'lightning',
'data',
'messaging',
'social',
'alt coin',
],
}
} else if (path === '/package/index') {
return Mock.MarketplacePkgsList
} else if (path === '/package/release-notes') {
return Mock.ReleaseNotes
}
}
async getEos (
params: RR.GetMarketplaceEOSReq,
): Promise<RR.GetMarketplaceEOSRes> {
@@ -195,39 +218,6 @@ export class MockApiService extends ApiService {
return Mock.MarketplaceEos
}
async getMarketplaceData (
params: RR.GetMarketplaceDataReq,
url?: string,
): Promise<RR.GetMarketplaceDataRes> {
await pauseFor(2000)
return {
name: 'Dark9',
categories: [
'featured',
'bitcoin',
'lightning',
'data',
'messaging',
'social',
'alt coin',
],
}
}
async getMarketplacePkgs (
params: RR.GetMarketplacePackagesReq,
): Promise<RR.GetMarketplacePackagesRes> {
await pauseFor(2000)
return Mock.MarketplacePkgsList
}
async getReleaseNotes (
params: RR.GetReleaseNotesReq,
): Promise<RR.GetReleaseNotesRes> {
await pauseFor(2000)
return Mock.ReleaseNotes
}
// password
// async updatePassword (params: RR.UpdatePasswordReq): Promise<RR.UpdatePasswordRes> {
// await pauseFor(2000)

View File

@@ -9,7 +9,7 @@ import { WorkspaceConfig } from '@shared'
const {
useMocks,
ui: { gitHash, patchDb, api, mocks, eosMarketplaceURL },
ui: { gitHash, patchDb, api, mocks, marketplace },
} = require('../../../../../config.json') as WorkspaceConfig
@Injectable({
@@ -25,7 +25,7 @@ export class ConfigService {
gitHash = gitHash
patchDb = patchDb
api = api
eosMarketplaceUrl = eosMarketplaceURL
marketplace = marketplace
skipStartupAlerts = useMocks && mocks.skipStartupAlerts
isConsulate = window['platform'] === 'ios'