mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-08 07:06:41 +00:00
chore: refactor clientService
This commit is contained in:
parent
3f942e2507
commit
f3e4af798a
@ -1,7 +1,7 @@
|
|||||||
import { logger } from '@pockethost/common'
|
import { logger } from '@pockethost/common'
|
||||||
import { clientService } from './clientService/clientService'
|
|
||||||
import { DEBUG, PH_BIN_CACHE, PUBLIC_PB_SUBDOMAIN } from './constants'
|
import { DEBUG, PH_BIN_CACHE, PUBLIC_PB_SUBDOMAIN } from './constants'
|
||||||
import { backupService } from './services/BackupService'
|
import { backupService } from './services/BackupService'
|
||||||
|
import { clientService } from './services/clientService/clientService'
|
||||||
import { ftpService } from './services/FtpService/FtpService'
|
import { ftpService } from './services/FtpService/FtpService'
|
||||||
import { instanceService } from './services/InstanceService'
|
import { instanceService } from './services/InstanceService'
|
||||||
import { pocketbase } from './services/PocketBaseService'
|
import { pocketbase } from './services/PocketBaseService'
|
||||||
|
@ -14,8 +14,8 @@ import {
|
|||||||
RpcCommands,
|
RpcCommands,
|
||||||
} from '@pockethost/common'
|
} from '@pockethost/common'
|
||||||
import Bottleneck from 'bottleneck'
|
import Bottleneck from 'bottleneck'
|
||||||
import { clientService } from '../clientService/clientService'
|
|
||||||
import { backupInstance } from '../util/backupInstance'
|
import { backupInstance } from '../util/backupInstance'
|
||||||
|
import { clientService } from './clientService/clientService'
|
||||||
import { rpcService } from './RpcService'
|
import { rpcService } from './RpcService'
|
||||||
|
|
||||||
export const backupService = mkSingleton(async () => {
|
export const backupService = mkSingleton(async () => {
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { logger, mkSingleton } from '@pockethost/common'
|
import { logger, mkSingleton } from '@pockethost/common'
|
||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
import { FtpSrv } from 'ftp-srv'
|
import { FtpSrv } from 'ftp-srv'
|
||||||
import { clientService } from '../../clientService/clientService'
|
|
||||||
import { createPbClient } from '../../clientService/PbClient'
|
|
||||||
import {
|
import {
|
||||||
PH_FTP_PASV_IP,
|
PH_FTP_PASV_IP,
|
||||||
PH_FTP_PASV_PORT_MAX,
|
PH_FTP_PASV_PORT_MAX,
|
||||||
@ -11,6 +9,8 @@ import {
|
|||||||
SSL_CERT,
|
SSL_CERT,
|
||||||
SSL_KEY,
|
SSL_KEY,
|
||||||
} from '../../constants'
|
} from '../../constants'
|
||||||
|
import { clientService } from '../clientService/clientService'
|
||||||
|
import { createPbClient } from '../clientService/PbClient'
|
||||||
import { PhFs } from './PhFs'
|
import { PhFs } from './PhFs'
|
||||||
|
|
||||||
export type FtpConfig = {}
|
export type FtpConfig = {}
|
||||||
|
@ -3,8 +3,8 @@ import { existsSync, mkdirSync } from 'fs'
|
|||||||
import { FileStat, FileSystem, FtpConnection } from 'ftp-srv'
|
import { FileStat, FileSystem, FtpConnection } from 'ftp-srv'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { Readable } from 'stream'
|
import { Readable } from 'stream'
|
||||||
import { PocketbaseClientApi } from '../../clientService/PbClient'
|
|
||||||
import { DAEMON_PB_DATA_DIR } from '../../constants'
|
import { DAEMON_PB_DATA_DIR } from '../../constants'
|
||||||
|
import { PocketbaseClientApi } from '../clientService/PbClient'
|
||||||
import {
|
import {
|
||||||
FOLDER_NAMES,
|
FOLDER_NAMES,
|
||||||
isFolder,
|
isFolder,
|
||||||
|
@ -14,7 +14,6 @@ import { forEachRight, map } from '@s-libs/micro-dash'
|
|||||||
import Bottleneck from 'bottleneck'
|
import Bottleneck from 'bottleneck'
|
||||||
import getPort from 'get-port'
|
import getPort from 'get-port'
|
||||||
import { AsyncReturnType } from 'type-fest'
|
import { AsyncReturnType } from 'type-fest'
|
||||||
import { clientService } from '../clientService/clientService'
|
|
||||||
import {
|
import {
|
||||||
DAEMON_PB_IDLE_TTL,
|
DAEMON_PB_IDLE_TTL,
|
||||||
DAEMON_PB_PORT_BASE,
|
DAEMON_PB_PORT_BASE,
|
||||||
@ -24,6 +23,7 @@ import {
|
|||||||
import { mkInternalUrl } from '../util/internal'
|
import { mkInternalUrl } from '../util/internal'
|
||||||
import { now } from '../util/now'
|
import { now } from '../util/now'
|
||||||
import { safeCatch } from '../util/promiseHelper'
|
import { safeCatch } from '../util/promiseHelper'
|
||||||
|
import { clientService } from './clientService/clientService'
|
||||||
import { pocketbase, PocketbaseProcess } from './PocketBaseService'
|
import { pocketbase, PocketbaseProcess } from './PocketBaseService'
|
||||||
import { rpcService } from './RpcService'
|
import { rpcService } from './RpcService'
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import Bottleneck from 'bottleneck'
|
|||||||
import { default as knexFactory } from 'knex'
|
import { default as knexFactory } from 'knex'
|
||||||
import pocketbaseEs from 'pocketbase'
|
import pocketbaseEs from 'pocketbase'
|
||||||
import { AsyncReturnType, JsonObject } from 'type-fest'
|
import { AsyncReturnType, JsonObject } from 'type-fest'
|
||||||
import { clientService } from '../clientService/clientService'
|
import { clientService } from './clientService/clientService'
|
||||||
|
|
||||||
export type RpcServiceApi = AsyncReturnType<typeof rpcService>
|
export type RpcServiceApi = AsyncReturnType<typeof rpcService>
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
InstanceId,
|
InstanceId,
|
||||||
logger,
|
logger,
|
||||||
} from '@pockethost/common'
|
} from '@pockethost/common'
|
||||||
import { safeCatch } from '../util/promiseHelper'
|
import { safeCatch } from '../../util/promiseHelper'
|
||||||
import { MixinContext } from './PbClient'
|
import { MixinContext } from './PbClient'
|
||||||
|
|
||||||
export type BackupApi = ReturnType<typeof createBackupMixin>
|
export type BackupApi = ReturnType<typeof createBackupMixin>
|
@ -10,7 +10,7 @@ import {
|
|||||||
import { reduce } from '@s-libs/micro-dash'
|
import { reduce } from '@s-libs/micro-dash'
|
||||||
import Bottleneck from 'bottleneck'
|
import Bottleneck from 'bottleneck'
|
||||||
import { endOfMonth, startOfMonth } from 'date-fns'
|
import { endOfMonth, startOfMonth } from 'date-fns'
|
||||||
import { safeCatch } from '../util/promiseHelper'
|
import { safeCatch } from '../../util/promiseHelper'
|
||||||
import { MixinContext } from './PbClient'
|
import { MixinContext } from './PbClient'
|
||||||
|
|
||||||
export type InstanceApi = ReturnType<typeof createInstanceMixin>
|
export type InstanceApi = ReturnType<typeof createInstanceMixin>
|
@ -4,7 +4,7 @@ import {
|
|||||||
logger,
|
logger,
|
||||||
pocketNow,
|
pocketNow,
|
||||||
} from '@pockethost/common'
|
} from '@pockethost/common'
|
||||||
import { safeCatch } from '../util/promiseHelper'
|
import { safeCatch } from '../../util/promiseHelper'
|
||||||
import { InstanceApi } from './InstanceMIxin'
|
import { InstanceApi } from './InstanceMIxin'
|
||||||
import { MixinContext } from './PbClient'
|
import { MixinContext } from './PbClient'
|
||||||
|
|
@ -5,9 +5,9 @@ import {
|
|||||||
default as PocketBase,
|
default as PocketBase,
|
||||||
default as pocketbaseEs,
|
default as pocketbaseEs,
|
||||||
} from 'pocketbase'
|
} from 'pocketbase'
|
||||||
import { DAEMON_PB_DATA_DIR, PUBLIC_PB_SUBDOMAIN } from '../constants'
|
import { DAEMON_PB_DATA_DIR, PUBLIC_PB_SUBDOMAIN } from '../../constants'
|
||||||
import { Collection_Serialized } from '../migrate/schema'
|
import { Collection_Serialized } from '../../migrate/schema'
|
||||||
import { safeCatch } from '../util/promiseHelper'
|
import { safeCatch } from '../../util/promiseHelper'
|
||||||
import { createBackupMixin } from './BackupMixin'
|
import { createBackupMixin } from './BackupMixin'
|
||||||
import { createInstanceMixin } from './InstanceMIxin'
|
import { createInstanceMixin } from './InstanceMIxin'
|
||||||
import { createInvocationMixin } from './InvocationMixin'
|
import { createInvocationMixin } from './InvocationMixin'
|
@ -1,6 +1,6 @@
|
|||||||
import { RpcFields, RpcStatus, RPC_COLLECTION } from '@pockethost/common'
|
import { RpcFields, RpcStatus, RPC_COLLECTION } from '@pockethost/common'
|
||||||
import { JsonObject } from 'type-fest'
|
import { JsonObject } from 'type-fest'
|
||||||
import { safeCatch } from '../util/promiseHelper'
|
import { safeCatch } from '../../util/promiseHelper'
|
||||||
import { MixinContext } from './PbClient'
|
import { MixinContext } from './PbClient'
|
||||||
|
|
||||||
export enum RecordSubscriptionActions {
|
export enum RecordSubscriptionActions {
|
@ -5,7 +5,7 @@ import {
|
|||||||
PUBLIC_PB_DOMAIN,
|
PUBLIC_PB_DOMAIN,
|
||||||
PUBLIC_PB_PROTOCOL,
|
PUBLIC_PB_PROTOCOL,
|
||||||
PUBLIC_PB_SUBDOMAIN,
|
PUBLIC_PB_SUBDOMAIN,
|
||||||
} from '../constants'
|
} from '../../constants'
|
||||||
import { createPbClient } from './PbClient'
|
import { createPbClient } from './PbClient'
|
||||||
|
|
||||||
export const clientService = mkSingleton(async (url: string) => {
|
export const clientService = mkSingleton(async (url: string) => {
|
Loading…
x
Reference in New Issue
Block a user