refactor downstream for 036 changes (#2577)

refactor codebase for 036 changes
This commit is contained in:
Matt Hill
2024-03-24 12:12:55 -06:00
committed by GitHub
parent 22cd2e3337
commit 3b669193f6
152 changed files with 1360 additions and 1352 deletions

View File

@@ -644,23 +644,23 @@ export module Mock {
name: 'My Backup Job',
target: BackupTargets.saved[0],
cron: '0 3 * * *',
'package-ids': ['bitcoind', 'lnd'],
packageIds: ['bitcoind', 'lnd'],
},
{
id: 'hahahahaha-mwmwmwmwmwmw',
name: 'Another Backup Job',
target: BackupTargets.saved[1],
cron: '0 * * * *',
'package-ids': ['lnd'],
packageIds: ['lnd'],
},
]
export const BackupRuns: RR.GetBackupRunsRes = [
{
id: 'kladhbfweubdsk',
'started-at': new Date().toISOString(),
'completed-at': new Date(new Date().valueOf() + 10000).toISOString(),
'package-ids': ['bitcoind', 'lnd'],
startedAt: new Date().toISOString(),
completedAt: new Date(new Date().valueOf() + 10000).toISOString(),
packageIds: ['bitcoind', 'lnd'],
job: BackupJobs[0],
report: {
server: {
@@ -675,9 +675,9 @@ export module Mock {
},
{
id: 'kladhbfwhrfeubdsk',
'started-at': new Date().toISOString(),
'completed-at': new Date(new Date().valueOf() + 10000).toISOString(),
'package-ids': ['bitcoind', 'lnd'],
startedAt: new Date().toISOString(),
completedAt: new Date(new Date().valueOf() + 10000).toISOString(),
packageIds: ['bitcoind', 'lnd'],
job: BackupJobs[0],
report: {
server: {
@@ -1267,6 +1267,7 @@ export module Mock {
manifest: MockManifestBitcoind,
},
icon: '/assets/img/service-icons/bitcoind.svg',
installedAt: new Date().toISOString(),
lastBackup: null,
status: {
configured: true,
@@ -1507,6 +1508,7 @@ export module Mock {
manifest: MockManifestBitcoinProxy,
},
icon: '/assets/img/service-icons/btc-rpc-proxy.png',
installedAt: new Date().toISOString(),
lastBackup: null,
status: {
configured: false,
@@ -1647,6 +1649,7 @@ export module Mock {
manifest: MockManifestLnd,
},
icon: '/assets/img/service-icons/lnd.png',
installedAt: new Date().toISOString(),
lastBackup: null,
status: {
configured: true,

View File

@@ -4,8 +4,6 @@ import {
DataModel,
DomainInfo,
NetworkStrategy,
OsOutboundProxy,
ServiceOutboundProxy,
HealthCheckResult,
} from 'src/app/services/patch-db/data-model'
import {
@@ -90,7 +88,7 @@ export module RR {
export type ResetTorRes = null
export type SetOsOutboundProxyReq = {
proxy: OsOutboundProxy
proxy: string | null
} // server.proxy.set-outbound
export type SetOsOutboundProxyRes = null
@@ -140,9 +138,7 @@ export module RR {
export type AddProxyRes = null
export type UpdateProxyReq = {
name?: string
primaryInbound?: true
primaryOutbound?: true
name: string
} // net.proxy.update
export type UpdateProxyRes = null
@@ -305,8 +301,8 @@ export module RR {
// package
export type GetPackageCredentialsReq = { id: string } // package.credentials
export type GetPackageCredentialsRes = Record<string, string>
export type GetPackagePropertiesReq = { id: string } // package.properties
export type GetPackagePropertiesRes = Record<string, string>
export type GetPackageLogsReq = FetchLogsReq & { id: string } // package.logs
export type GetPackageLogsRes = FetchLogsRes
@@ -335,7 +331,6 @@ export module RR {
// package.backup.restore
ids: string[]
targetId: string
oldPassword: string | null
password: string
}
export type RestorePackagesRes = null
@@ -384,7 +379,7 @@ export module RR {
export type SetServiceOutboundProxyReq = {
packageId: string
proxy: ServiceOutboundProxy
proxy: string | null
} // package.proxy.set-outbound
export type SetServiceOutboundProxyRes = null
@@ -533,9 +528,9 @@ export interface CloudBackupTarget extends BaseBackupTarget {
export interface BackupRun {
id: string
'started-at': string
'completed-at': string
'package-ids': string[]
startedAt: string
completedAt: string
packageIds: string[]
job: BackupJob
report: BackupReport
}
@@ -598,8 +593,8 @@ export enum NotificationLevel {
export type NotificationData<T> = T extends 0
? null
: T extends 1
? BackupReport
: any
? BackupReport
: any
export interface BackupReport {
server: {

View File

@@ -256,9 +256,9 @@ export abstract class ApiService {
// package
abstract getPackageCredentials(
params: RR.GetPackageCredentialsReq,
): Promise<RR.GetPackageCredentialsRes>
abstract getPackageProperties(
params: RR.GetPackagePropertiesReq,
): Promise<RR.GetPackagePropertiesRes>
abstract getPackageLogs(
params: RR.GetPackageLogsReq,

View File

@@ -450,10 +450,10 @@ export class LiveApiService extends ApiService {
// package
async getPackageCredentials(
params: RR.GetPackageCredentialsReq,
): Promise<RR.GetPackageCredentialsRes> {
return this.rpcRequest({ method: 'package.credentials', params })
async getPackageProperties(
params: RR.GetPackagePropertiesReq,
): Promise<RR.GetPackagePropertiesRes> {
return this.rpcRequest({ method: 'package.properties', params })
}
async getPackageLogs(

View File

@@ -538,11 +538,6 @@ export class MockApiService extends ApiService {
domains: [],
services: [],
},
primaryInbound: type === 'inbound-outbound' ? true : false,
primaryOutbound:
type === 'inbound-outbound' || type === 'outbound' ? true : false,
// primaryInbound: false,
// primaryOutbound: false,
},
],
},
@@ -555,13 +550,11 @@ export class MockApiService extends ApiService {
async updateProxy(params: RR.UpdateProxyReq): Promise<RR.UpdateProxyRes> {
await pauseFor(2000)
const value = params.name || params.primaryInbound || params.primaryOutbound
const patch = [
{
op: PatchOp.REPLACE,
path: `/server-info/network/proxies/0/${Object.keys(params)[0]}`,
value,
path: `/server-info/network/proxies/0/name`,
value: params.name,
},
]
this.mockRevision(patch)
@@ -926,9 +919,9 @@ export class MockApiService extends ApiService {
// package
async getPackageCredentials(
params: RR.GetPackageCredentialsReq,
): Promise<RR.GetPackageCredentialsRes> {
async getPackageProperties(
params: RR.GetPackagePropertiesReq,
): Promise<RR.GetPackagePropertiesRes> {
await pauseFor(2000)
return {
password: 'specialPassword$',

View File

@@ -110,10 +110,6 @@ export const mockPatchData: DataModel = {
],
},
proxies: [],
primaryProxies: {
inbound: null,
outbound: null,
},
outboundProxy: null,
},
lastBackup: new Date(new Date().valueOf() - 604800001).toISOString(),
@@ -153,6 +149,7 @@ export const mockPatchData: DataModel = {
},
},
icon: '/assets/img/service-icons/bitcoind.svg',
installedAt: new Date().toISOString(),
lastBackup: null,
status: {
configured: true,
@@ -419,6 +416,7 @@ export const mockPatchData: DataModel = {
},
},
icon: '/assets/img/service-icons/lnd.png',
installedAt: new Date().toISOString(),
lastBackup: null,
status: {
configured: true,