chore: prettier update

This commit is contained in:
Ben Allfree 2023-09-10 16:33:38 -07:00
parent f0f7dee969
commit 4e22e62706
74 changed files with 535 additions and 489 deletions

View File

@ -1,3 +1,5 @@
.svelte-kit .svelte-kit
dist dist
mount mount
.data
attic

View File

@ -32,18 +32,19 @@
"semi": false, "semi": false,
"useTabs": false, "useTabs": false,
"singleQuote": true, "singleQuote": true,
"trailingComma": "all",
"plugins": [ "plugins": [
"./node_modules/prettier-plugin-organize-imports", "./node_modules/prettier-plugin-organize-imports/index.js",
"./node_modules/prettier-plugin-svelte" "./node_modules/prettier-plugin-svelte/plugin.js"
] ]
}, },
"devDependencies": { "devDependencies": {
"chokidar-cli": "^3.0.0", "chokidar-cli": "^3.0.0",
"concurrently": "^7.4.0", "concurrently": "^8.2.1",
"patch-package": "^6.5.0", "patch-package": "^8.0.0",
"prettier": "^2.7.1", "prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.1.1", "prettier-plugin-organize-imports": "^3.2.3",
"prettier-plugin-svelte": "^2.7.0", "prettier-plugin-svelte": "^3.0.3",
"tslib": "^2.6.2", "tslib": "^2.6.2",
"typescript": "^5.0" "typescript": "^5.0"
}, },

View File

@ -18,7 +18,7 @@ export const addDevCommand = (program: Command) => {
.description('Build the JS bundle') .description('Build the JS bundle')
.option( .option(
'--src <path>', '--src <path>',
`Path to source (default: <project>/src/index.{ts|js})` `Path to source (default: <project>/src/index.{ts|js})`,
) )
.option('--dist <path>', `Path to dist (default: <project>/dist/index.js)`) .option('--dist <path>', `Path to dist (default: <project>/dist/index.js)`)
.action(async (options) => { .action(async (options) => {

View File

@ -22,7 +22,7 @@ export const addDevCommand = (program: Command) => {
.description('Watch for source code changes in development mode') .description('Watch for source code changes in development mode')
.option( .option(
'--src <path>', '--src <path>',
`Path to source (default: <project>/src/index.{ts|js})` `Path to source (default: <project>/src/index.{ts|js})`,
) )
.option('--dist <path>', `Path to dist (default: <project>/dist/index.js)`) .option('--dist <path>', `Path to dist (default: <project>/dist/index.js)`)
.option('--host', 'PocketBase host', DEFAULT_PB_DEV_URL) .option('--host', 'PocketBase host', DEFAULT_PB_DEV_URL)

View File

@ -70,7 +70,7 @@ export const addPublishCommand = (program: Command) => {
.description('Publish JS bundle to PBScript-enabled PocketBase instance') .description('Publish JS bundle to PBScript-enabled PocketBase instance')
.option( .option(
'--dist <src>', '--dist <src>',
`Path to dist bundle (default: <project>/dist/index.js)` `Path to dist bundle (default: <project>/dist/index.js)`,
) )
.option('--host <host>', `PocketBase host (default: ${DEFAULT_PB_DEV_URL})`) .option('--host <host>', `PocketBase host (default: ${DEFAULT_PB_DEV_URL})`)
.action(async (options) => { .action(async (options) => {

View File

@ -6,7 +6,7 @@ export type FieldStruct<TRec extends Pb_Any_Record_Db> = Partial<{
}> }>
export const buildQueryFilter = <TRec extends Pb_Any_Record_Db>( export const buildQueryFilter = <TRec extends Pb_Any_Record_Db>(
fields: FieldStruct<TRec> fields: FieldStruct<TRec>,
): Pb_QueryParams => { ): Pb_QueryParams => {
const filter = map(fields, (v, k) => `${k.toString()} = "${v}"`).join(' and ') const filter = map(fields, (v, k) => `${k.toString()} = "${v}"`).join(' and ')
return { filter } return { filter }

View File

@ -5,14 +5,14 @@ import {
Pb_Any_Record_Db, Pb_Any_Record_Db,
Pb_Untrusted_Db, Pb_Untrusted_Db,
} from '../schema/base' } from '../schema/base'
import { buildQueryFilter, FieldStruct } from './buildQueryFilter' import { FieldStruct, buildQueryFilter } from './buildQueryFilter'
export const getOne = async < export const getOne = async <
TRec extends Pb_Any_Record_Db, TRec extends Pb_Any_Record_Db,
TFields extends FieldStruct<TRec> = FieldStruct<TRec> TFields extends FieldStruct<TRec> = FieldStruct<TRec>,
>( >(
collectionName: Pb_Any_Collection_Name, collectionName: Pb_Any_Collection_Name,
fields: TFields fields: TFields,
) => { ) => {
const queryParams = buildQueryFilter(fields) const queryParams = buildQueryFilter(fields)
const recs = await client.records.getList(collectionName, 1, 2, queryParams) const recs = await client.records.getList(collectionName, 1, 2, queryParams)

View File

@ -6,14 +6,14 @@ export const mergeDeep = <TObject>(dst: any, src: TObject) => {
if (dst[k] === undefined) dst[k] = {} if (dst[k] === undefined) dst[k] = {}
if (!isObject(dst[k])) { if (!isObject(dst[k])) {
throw new Error( throw new Error(
`${k.toString()} is an object in default, but not in target` `${k.toString()} is an object in default, but not in target`,
) )
} }
dst[k] = mergeDeep(dst[k], v) dst[k] = mergeDeep(dst[k], v)
} else { } else {
if (isObject(dst[k])) { if (isObject(dst[k])) {
throw new Error( throw new Error(
`${k.toString()} is an object in target, but not in default` `${k.toString()} is an object in target, but not in default`,
) )
} }
// The magic: if the target has no value for this field, use the // The magic: if the target has no value for this field, use the

View File

@ -2,7 +2,7 @@ import { UnsubFunc } from 'store/backend/types'
import { client } from '../client' import { client } from '../client'
export const onAuthStateChanged = ( export const onAuthStateChanged = (
cb: (user: typeof client.authStore.model) => void cb: (user: typeof client.authStore.model) => void,
): UnsubFunc => { ): UnsubFunc => {
setTimeout(() => cb(client.authStore.model), 0) setTimeout(() => cb(client.authStore.model), 0)
return client.authStore.onChange(() => { return client.authStore.onChange(() => {

View File

@ -8,14 +8,14 @@ import {
Pb_Untrusted_Db, Pb_Untrusted_Db,
Pb_UserFields, Pb_UserFields,
} from '../schema/base' } from '../schema/base'
import { buildQueryFilter, FieldStruct } from './buildQueryFilter' import { FieldStruct, buildQueryFilter } from './buildQueryFilter'
import { mergeDeep } from './mergeDeep' import { mergeDeep } from './mergeDeep'
export const upsert = async <TRow extends Pb_Any_Record_Db>( export const upsert = async <TRow extends Pb_Any_Record_Db>(
collectionName: Pb_Any_Collection_Name, collectionName: Pb_Any_Collection_Name,
filterFields: FieldStruct<TRow>, filterFields: FieldStruct<TRow>,
mutate: (draft: Draft<Pb_UserFields<TRow>>) => void, mutate: (draft: Draft<Pb_UserFields<TRow>>) => void,
defaultRec: Pb_UserFields<TRow> defaultRec: Pb_UserFields<TRow>,
) => { ) => {
const queryParams = buildQueryFilter(filterFields) const queryParams = buildQueryFilter(filterFields)
const recs = await client.records.getList(collectionName, 1, 2, queryParams) const recs = await client.records.getList(collectionName, 1, 2, queryParams)
@ -42,7 +42,7 @@ export const upsert = async <TRow extends Pb_Any_Record_Db>(
} }
return carry return carry
}, },
{} as Partial<Pb_UserFields<TRow>> {} as Partial<Pb_UserFields<TRow>>,
) )
client.records.update(collectionName, id, final) client.records.update(collectionName, id, final)
} }

View File

@ -50,7 +50,7 @@ export class CustomAuthStore extends BaseAuthStore {
} }
exportToCookie( exportToCookie(
options?: SerializeOptions | undefined, options?: SerializeOptions | undefined,
key?: string | undefined key?: string | undefined,
): string { ): string {
throw new Error(`Unsupported exportToCookie()`) throw new Error(`Unsupported exportToCookie()`)
} }

View File

@ -1,6 +1,6 @@
export function assertExists<TType>( export function assertExists<TType>(
v: TType, v: TType,
message = `Value does not exist` message = `Value does not exist`,
): asserts v is NonNullable<TType> { ): asserts v is NonNullable<TType> {
if (typeof v === 'undefined') { if (typeof v === 'undefined') {
throw new Error(message) throw new Error(message)

View File

@ -20,11 +20,11 @@ export type ConnectionConfig = {
export const ensureAdminClient = async ( export const ensureAdminClient = async (
slug: string, slug: string,
config: ConnectionConfig config: ConnectionConfig,
) => { ) => {
const saver = mkProjectSaver<ConnectionConfig>(slug) const saver = mkProjectSaver<ConnectionConfig>(slug)
const client = pbClient(config, (session) => const client = pbClient(config, (session) =>
saver((config) => ({ ...config, session })) saver((config) => ({ ...config, session })),
) )
const _isAdmin = await isAdmin(client) const _isAdmin = await isAdmin(client)
if (_isAdmin) { if (_isAdmin) {
@ -34,7 +34,7 @@ export const ensureAdminClient = async (
const { host } = config const { host } = config
console.log( console.log(
`You must be logged in to ${host}/_ as a PocketBase admin to continue.` `You must be logged in to ${host}/_ as a PocketBase admin to continue.`,
) )
while (true) { while (true) {
@ -55,7 +55,7 @@ export const ensureAdminClient = async (
value.length > 0 ? true : `Enter a password`, value.length > 0 ? true : `Enter a password`,
}, },
], ],
{ onCancel: () => die(`Exited.`) } { onCancel: () => die(`Exited.`) },
) )
const { username, password } = response const { username, password } = response
try { try {

View File

@ -9,13 +9,13 @@ import { ConnectionConfig } from './ensureAdminClient'
export const pbClient = ( export const pbClient = (
config: ConnectionConfig, config: ConnectionConfig,
saver: SessionStateSaver saver: SessionStateSaver,
) => { ) => {
const { host, session } = config const { host, session } = config
const client = new PocketBase( const client = new PocketBase(
host, host,
'en-US', 'en-US',
new CustomAuthStore(session, saver) new CustomAuthStore(session, saver),
) )
return client return client
} }
@ -31,7 +31,7 @@ export const isAdmin = async (client: pocketbaseEs) => {
export const adminPbClient = async ( export const adminPbClient = async (
config: ConnectionConfig, config: ConnectionConfig,
saver: SessionStateSaver saver: SessionStateSaver,
) => { ) => {
const client = pbClient(config, saver) const client = pbClient(config, saver)
if (!client.authStore.isValid) { if (!client.authStore.isValid) {

View File

@ -38,10 +38,10 @@ export const createCleanupManager = (slug?: string) => {
(c, v) => { (c, v) => {
return c.then(() => v()) return c.then(() => v())
}, },
Promise.resolve() Promise.resolve(),
).catch((e) => { ).catch((e) => {
error( error(
`Cleanup functions are failing. This should never happen, check all cleanup functions to make sure they are trapping their exceptions.` `Cleanup functions are failing. This should never happen, check all cleanup functions to make sure they are trapping their exceptions.`,
) )
throw e throw e
}) })

View File

@ -58,7 +58,7 @@ export const createLogger = (config: Partial<Config>) => {
return JSON.stringify(arg) return JSON.stringify(arg)
} }
return arg return arg
}) }),
) )
} }
@ -89,7 +89,7 @@ export const createLogger = (config: Partial<Config>) => {
;[..._buf.slice(_curIdx, MAX_BUF), ..._buf.slice(0, _curIdx)].forEach( ;[..._buf.slice(_curIdx, MAX_BUF), ..._buf.slice(0, _curIdx)].forEach(
(args) => { (args) => {
console.error(...args) console.error(...args)
} },
) )
console.error(`========== ERROR TRACEBACK END ==============`) console.error(`========== ERROR TRACEBACK END ==============`)
} }

View File

@ -1,6 +1,6 @@
export function assertExists<TType>( export function assertExists<TType>(
v: TType, v: TType,
message = `Value does not exist` message = `Value does not exist`,
): asserts v is NonNullable<TType> { ): asserts v is NonNullable<TType> {
if (typeof v === 'undefined') { if (typeof v === 'undefined') {
throw new Error(message) throw new Error(message)
@ -9,7 +9,7 @@ export function assertExists<TType>(
export function assertTruthy<TType>( export function assertTruthy<TType>(
v: unknown, v: unknown,
message = `Value should be truthy` message = `Value should be truthy`,
): asserts v is NonNullable<TType> { ): asserts v is NonNullable<TType> {
if (!v) { if (!v) {
throw new Error(message) throw new Error(message)

View File

@ -5,10 +5,10 @@ import { SetReturnType } from 'type-fest'
const limiters: { [lane: string]: Bottleneck } = {} const limiters: { [lane: string]: Bottleneck } = {}
export const serialAsyncExecutionGuard = < export const serialAsyncExecutionGuard = <
T extends (...args: any[]) => Promise<any> T extends (...args: any[]) => Promise<any>,
>( >(
cb: T, cb: T,
lane?: SetReturnType<T, string> lane?: SetReturnType<T, string>,
): T => { ): T => {
const uuid = uniqueId() const uuid = uniqueId()
const _lane = lane || (() => uuid) const _lane = lane || (() => uuid)
@ -27,10 +27,10 @@ export const serialAsyncExecutionGuard = <
const singletons: { [_: string]: Promise<any> } = {} const singletons: { [_: string]: Promise<any> } = {}
export const singletonAsyncExecutionGuard = < export const singletonAsyncExecutionGuard = <
T extends (...args: any[]) => Promise<any> T extends (...args: any[]) => Promise<any>,
>( >(
cb: T, cb: T,
key: SetReturnType<T, string> key: SetReturnType<T, string>,
): T => { ): T => {
const uuid = uniqueId() const uuid = uniqueId()
const keyFactory = key || (() => uuid) const keyFactory = key || (() => uuid)

View File

@ -3,15 +3,15 @@ import { values } from '@s-libs/micro-dash'
export type Unsubscribe = () => void export type Unsubscribe = () => void
export type EventSubscriber<TPayload> = ( export type EventSubscriber<TPayload> = (
cb: EventHandler<TPayload> cb: EventHandler<TPayload>,
) => Unsubscribe ) => Unsubscribe
export type EventEmitter<TPayload> = ( export type EventEmitter<TPayload> = (
payload: TPayload, payload: TPayload,
stopOnHandled?: boolean stopOnHandled?: boolean,
) => Promise<boolean> ) => Promise<boolean>
export type EventHandler<TPayload> = ( export type EventHandler<TPayload> = (
payload: TPayload, payload: TPayload,
isHandled: boolean isHandled: boolean,
) => boolean | void | Promise<boolean | void> ) => boolean | void | Promise<boolean | void>
/** /**
@ -20,7 +20,7 @@ export type EventHandler<TPayload> = (
* @returns void * @returns void
*/ */
export const createEvent = <TPayload>( export const createEvent = <TPayload>(
defaultHandler?: EventHandler<TPayload> defaultHandler?: EventHandler<TPayload>,
): [EventSubscriber<TPayload>, EventEmitter<TPayload>] => { ): [EventSubscriber<TPayload>, EventEmitter<TPayload>] => {
let i = 0 let i = 0
const callbacks: any = {} const callbacks: any = {}

View File

@ -1,11 +1,11 @@
export * from './CleanupManager'
export * from './Logger'
export * from './TimerManager'
export * from './assert' export * from './assert'
export * from './asyncExecutionGuard' export * from './asyncExecutionGuard'
export * from './CleanupManager'
export * from './events' export * from './events'
export * from './Logger'
export * from './mkSingleton' export * from './mkSingleton'
export * from './newId' export * from './newId'
export * from './pocketbase-client-helpers' export * from './pocketbase-client-helpers'
export * from './safeCatch' export * from './safeCatch'
export * from './schema' export * from './schema'
export * from './TimerManager'

View File

@ -10,9 +10,9 @@ export type SingletonBaseConfig = {
export const mkSingleton = < export const mkSingleton = <
TConfig, TConfig,
TApi extends SingletonApi | Promise<SingletonApi> TApi extends SingletonApi | Promise<SingletonApi>,
>( >(
factory: (config: TConfig) => TApi factory: (config: TConfig) => TApi,
) => { ) => {
let _service: TApi | undefined = undefined let _service: TApi | undefined = undefined
return (config?: TConfig) => { return (config?: TConfig) => {

View File

@ -6,11 +6,11 @@ import { logger } from '../Logger'
import { newId } from '../newId' import { newId } from '../newId'
import { safeCatch } from '../safeCatch' import { safeCatch } from '../safeCatch'
import { import {
RPC_COLLECTION,
RpcCommands, RpcCommands,
RpcFields, RpcFields,
RpcRecord_Create, RpcRecord_Create,
RpcStatus, RpcStatus,
RPC_COLLECTION,
} from '../schema' } from '../schema'
import type { WatchHelper } from './WatchHelper' import type { WatchHelper } from './WatchHelper'
@ -30,7 +30,7 @@ export const createRpcHelper = (config: RpcHelperConfig) => {
const mkRpc = <TPayload extends JsonObject, TResult extends JsonObject>( const mkRpc = <TPayload extends JsonObject, TResult extends JsonObject>(
cmd: RpcCommands, cmd: RpcCommands,
schema: JSONSchemaType<TPayload> schema: JSONSchemaType<TPayload>,
) => { ) => {
type ConcreteRpcRecord = RpcFields<TPayload, TResult> type ConcreteRpcRecord = RpcFields<TPayload, TResult>
const validator = new Ajv().compile(schema) const validator = new Ajv().compile(schema)
@ -39,7 +39,7 @@ export const createRpcHelper = (config: RpcHelperConfig) => {
logger(), logger(),
async ( async (
payload: TPayload, payload: TPayload,
cb?: (data: RecordSubscription<ConcreteRpcRecord>) => void cb?: (data: RecordSubscription<ConcreteRpcRecord>) => void,
) => { ) => {
const _rpcLogger = _logger.create(cmd) const _rpcLogger = _logger.create(cmd)
const { dbg, error } = _rpcLogger const { dbg, error } = _rpcLogger
@ -82,7 +82,7 @@ export const createRpcHelper = (config: RpcHelperConfig) => {
reject(new ClientResponseError(data.record.result)) reject(new ClientResponseError(data.record.result))
} }
}, },
{ initialFetch: false, pollIntervalMs: 100 } { initialFetch: false, pollIntervalMs: 100 },
) )
dbg(`Creating ${rpcIn.id}`) dbg(`Creating ${rpcIn.id}`)
const newRpc = await client.collection(RPC_COLLECTION).create(rpcIn) const newRpc = await client.collection(RPC_COLLECTION).create(rpcIn)
@ -92,7 +92,7 @@ export const createRpcHelper = (config: RpcHelperConfig) => {
reject(e) reject(e)
}) })
}) })
} },
) )
} }

View File

@ -1,9 +1,9 @@
import type pocketbaseEs from 'pocketbase' import type pocketbaseEs from 'pocketbase'
import type { RecordSubscription, UnsubscribeFunc } from 'pocketbase' import type { RecordSubscription, UnsubscribeFunc } from 'pocketbase'
import { logger } from '../Logger' import { logger } from '../Logger'
import { UnixTimestampMs, createTimerManager } from '../TimerManager'
import { safeCatch } from '../safeCatch' import { safeCatch } from '../safeCatch'
import { BaseFields, RecordId } from '../schema' import { BaseFields, RecordId } from '../schema'
import { createTimerManager, UnixTimestampMs } from '../TimerManager'
export type WatchHelperConfig = { export type WatchHelperConfig = {
client: pocketbaseEs client: pocketbaseEs
@ -23,7 +23,7 @@ export const createWatchHelper = (config: WatchHelperConfig) => {
collectionName: string, collectionName: string,
id: RecordId, id: RecordId,
cb: (data: RecordSubscription<TRec>, unsub: UnsubscribeFunc) => void, cb: (data: RecordSubscription<TRec>, unsub: UnsubscribeFunc) => void,
options?: Partial<WatchConfig> options?: Partial<WatchConfig>,
): Promise<UnsubscribeFunc> => { ): Promise<UnsubscribeFunc> => {
const { dbg } = logger().create(`watchById:${collectionName}:${id}`) const { dbg } = logger().create(`watchById:${collectionName}:${id}`)
const config: WatchConfig = { const config: WatchConfig = {
@ -89,7 +89,7 @@ export const createWatchHelper = (config: WatchHelperConfig) => {
idName: keyof TRec, idName: keyof TRec,
idValue: RecordId, idValue: RecordId,
cb: (data: RecordSubscription<TRec>) => void, cb: (data: RecordSubscription<TRec>) => void,
initialFetch = true initialFetch = true,
): Promise<UnsubscribeFunc> => { ): Promise<UnsubscribeFunc> => {
let hasUpdate: { [_: RecordId]: boolean } = {} let hasUpdate: { [_: RecordId]: boolean } = {}
const unsub = client const unsub = client
@ -112,7 +112,7 @@ export const createWatchHelper = (config: WatchHelperConfig) => {
}) })
} }
return unsub return unsub
} },
) )
return { watchById, watchAllById } return { watchById, watchAllById }

View File

@ -9,7 +9,7 @@ export const safeCatch = <TIn extends any[], TOut>(
name: string, name: string,
logger: Logger, logger: Logger,
cb: (...args: TIn) => Promise<TOut>, cb: (...args: TIn) => Promise<TOut>,
timeoutMs = SAFECATCH_TTL_MS timeoutMs = SAFECATCH_TTL_MS,
): ((...args: TIn) => Promise<TOut>) => { ): ((...args: TIn) => Promise<TOut>) => {
return async (...args: TIn) => { return async (...args: TIn) => {
const uuid = `${name}:${nanoid()}` const uuid = `${name}:${nanoid()}`
@ -29,17 +29,17 @@ export const safeCatch = <TIn extends any[], TOut>(
if (e instanceof ClientResponseError) { if (e instanceof ClientResponseError) {
if (e.status === 400) { if (e.status === 400) {
dbg( dbg(
`PocketBase API error: It looks like you don't have permission to make this request. Raw error: ${e}. Payload: ${payload}` `PocketBase API error: It looks like you don't have permission to make this request. Raw error: ${e}. Payload: ${payload}`,
) )
} else if (e.status === 0) { } else if (e.status === 0) {
dbg( dbg(
`Client request aborted (possible duplicate request or real error). Raw error: ${e}. Payload: ${payload}` `Client request aborted (possible duplicate request or real error). Raw error: ${e}. Payload: ${payload}`,
) )
} else if (e.status === 404) { } else if (e.status === 404) {
dbg(`Record not found. Raw error: ${e}. Payload: ${payload}`) dbg(`Record not found. Raw error: ${e}. Payload: ${payload}`)
} else { } else {
dbg( dbg(
`Unknown PocketBase API error. Raw error: ${e}. Payload: ${payload}` `Unknown PocketBase API error. Raw error: ${e}. Payload: ${payload}`,
) )
} }
} else { } else {

View File

@ -34,7 +34,7 @@ export type RpcPayloadBase = JsonObject
export type RpcFields< export type RpcFields<
TPayload extends RpcPayloadBase, TPayload extends RpcPayloadBase,
TRes extends JsonObject TRes extends JsonObject,
> = BaseFields & { > = BaseFields & {
userId: UserId userId: UserId
cmd: string cmd: string

View File

@ -3,7 +3,7 @@ export * from './Instance'
export * from './InstanceLog' export * from './InstanceLog'
export * from './Invocation' export * from './Invocation'
export * from './Rpc' export * from './Rpc'
export * from './types'
export * from './User' export * from './User'
export * from './types'
export * from './util' export * from './util'
// gen:export // gen:export

View File

@ -25,7 +25,7 @@ export const DAEMON_PB_MIGRATIONS_DIR = (() => {
const v = env('DAEMON_PB_MIGRATIONS_DIR') const v = env('DAEMON_PB_MIGRATIONS_DIR')
if (!v) { if (!v) {
throw new Error( throw new Error(
`DAEMON_PB_MIGRATIONS_DIR (${v}) environment variable must be specified` `DAEMON_PB_MIGRATIONS_DIR (${v}) environment variable must be specified`,
) )
} }
if (!existsSync(v)) { if (!existsSync(v)) {
@ -38,7 +38,7 @@ export const DAEMON_PB_DATA_DIR = (() => {
const v = env('DAEMON_PB_DATA_DIR') const v = env('DAEMON_PB_DATA_DIR')
if (!v) { if (!v) {
throw new Error( throw new Error(
`DAEMON_PB_DATA_DIR (${v}) environment variable must be specified` `DAEMON_PB_DATA_DIR (${v}) environment variable must be specified`,
) )
} }
if (!existsSync(v)) { if (!existsSync(v)) {
@ -56,12 +56,12 @@ export const DAEMON_MAX_PORTS = envi(`DAEMON_MAX_PORTS`, 500)
export const DAEMON_PB_BACKUP_SLEEP = envi(`DAEMON_PB_BACKUP_SLEEP`, 100) export const DAEMON_PB_BACKUP_SLEEP = envi(`DAEMON_PB_BACKUP_SLEEP`, 100)
export const DAEMON_PB_BACKUP_PAGE_COUNT = envi( export const DAEMON_PB_BACKUP_PAGE_COUNT = envi(
`DAEMON_PB_BACKUP_PAGE_COUNT`, `DAEMON_PB_BACKUP_PAGE_COUNT`,
5 5,
) )
export const PH_BIN_CACHE = env( export const PH_BIN_CACHE = env(
`PH_BIN_CACHE`, `PH_BIN_CACHE`,
join(__dirname, `../../../.pbincache`) join(__dirname, `../../../.pbincache`),
) )
export const PH_FTP_PORT = envi('PH_FTP_PORT', 21) export const PH_FTP_PORT = envi('PH_FTP_PORT', 21)

View File

@ -79,7 +79,7 @@ global.EventSource = require('eventsource')
error(`migrate had an unexpected stop. Check it out`) error(`migrate had an unexpected stop. Check it out`)
}, },
}, },
{ logger } { logger },
) )
).exited ).exited
info(`Migrating done`) info(`Migrating done`)
@ -96,7 +96,7 @@ global.EventSource = require('eventsource')
error(`migrate had an unexpected stop. Check it out`) error(`migrate had an unexpected stop. Check it out`)
}, },
}, },
{ logger } { logger },
) )
/** /**

View File

@ -20,15 +20,15 @@ export const centralDbService = mkSingleton(
const target = coreInternalUrl const target = coreInternalUrl
dbg( dbg(
`Forwarding proxy request for ${req.url} to central instance ${target}` `Forwarding proxy request for ${req.url} to central instance ${target}`,
) )
proxy.web(req, res, { target }) proxy.web(req, res, { target })
}, },
`CentralDbService` `CentralDbService`,
) )
return { return {
shutdown() {}, shutdown() {},
} }
} },
) )

View File

@ -7,7 +7,7 @@ import {
SSL_KEY, SSL_KEY,
} from '$constants' } from '$constants'
import { clientService, createPbClient } from '$services' import { clientService, createPbClient } from '$services'
import { mkSingleton, SingletonBaseConfig } from '@pockethost/common' import { SingletonBaseConfig, mkSingleton } from '@pockethost/common'
import { readFileSync } from 'fs' import { readFileSync } from 'fs'
import { FtpSrv } from 'ftp-srv' import { FtpSrv } from 'ftp-srv'
import { PhFs } from './PhFs' import { PhFs } from './PhFs'
@ -77,7 +77,7 @@ export const ftpService = mkSingleton((config: FtpConfig) => {
reject(new Error(`Invalid username or password`)) reject(new Error(`Invalid username or password`))
return return
} }
} },
) )
ftpServer.listen().then(() => { ftpServer.listen().then(() => {

View File

@ -3,24 +3,24 @@ import { assert } from '$util'
import { InstanceFields, Logger } from '@pockethost/common' import { InstanceFields, Logger } from '@pockethost/common'
import { compact, map } from '@s-libs/micro-dash' import { compact, map } from '@s-libs/micro-dash'
import { import {
Mode,
constants, constants,
createReadStream, createReadStream,
createWriteStream, createWriteStream,
existsSync, existsSync,
mkdirSync, mkdirSync,
Mode,
} from 'fs' } from 'fs'
import { FileStat, FileSystem, FtpConnection } from 'ftp-srv' import { FileStat, FileSystem, FtpConnection } from 'ftp-srv'
import { customAlphabet } from 'nanoid' import { customAlphabet } from 'nanoid'
import { isAbsolute, join, normalize, resolve, sep } from 'path' import { isAbsolute, join, normalize, resolve, sep } from 'path'
import { PocketbaseClientApi } from '../clientService/PbClient' import { PocketbaseClientApi } from '../clientService/PbClient'
import * as fsAsync from './fs-async'
import { import {
FolderNames, FolderNames,
INSTANCE_ROOT_FOLDER_NAMES, INSTANCE_ROOT_FOLDER_NAMES,
isInstanceRootFolder,
MAINTENANCE_ONLY_FOLDER_NAMES, MAINTENANCE_ONLY_FOLDER_NAMES,
isInstanceRootFolder,
} from './FtpService' } from './FtpService'
import * as fsAsync from './fs-async'
const nanoid = customAlphabet(`abcdefghijklmnop`) const nanoid = customAlphabet(`abcdefghijklmnop`)
@ -51,7 +51,7 @@ export class PhFs implements FileSystem {
constructor( constructor(
connection: FtpConnection, connection: FtpConnection,
client: PocketbaseClientApi, client: PocketbaseClientApi,
logger: Logger logger: Logger,
) { ) {
const cwd = `/` const cwd = `/`
const root = DAEMON_PB_DATA_DIR const root = DAEMON_PB_DATA_DIR
@ -109,12 +109,12 @@ export class PhFs implements FileSystem {
dbg({ rootFolderName, instance }) dbg({ rootFolderName, instance })
if ( if (
MAINTENANCE_ONLY_FOLDER_NAMES.includes( MAINTENANCE_ONLY_FOLDER_NAMES.includes(
rootFolderName as FolderNames rootFolderName as FolderNames,
) && ) &&
!instance.maintenance !instance.maintenance
) { ) {
throw new Error( throw new Error(
`Instance must be in maintenance mode to access ${rootFolderName}` `Instance must be in maintenance mode to access ${rootFolderName}`,
) )
} }
fsPathParts.push(rootFolderName) fsPathParts.push(rootFolderName)
@ -122,7 +122,7 @@ export class PhFs implements FileSystem {
const rootFolderFsPath = resolve( const rootFolderFsPath = resolve(
join(...fsPathParts) join(...fsPathParts)
.replace(UNIX_SEP_REGEX, sep) .replace(UNIX_SEP_REGEX, sep)
.replace(WIN_SEP_REGEX, sep) .replace(WIN_SEP_REGEX, sep),
) )
if (!existsSync(rootFolderFsPath)) { if (!existsSync(rootFolderFsPath)) {
mkdirSync(rootFolderFsPath) mkdirSync(rootFolderFsPath)
@ -137,7 +137,7 @@ export class PhFs implements FileSystem {
const fsPath = resolve( const fsPath = resolve(
join(...fsPathParts) join(...fsPathParts)
.replace(UNIX_SEP_REGEX, sep) .replace(UNIX_SEP_REGEX, sep)
.replace(WIN_SEP_REGEX, sep) .replace(WIN_SEP_REGEX, sep),
) )
// Create FTP client path using unix separator // Create FTP client path using unix separator
@ -210,7 +210,7 @@ export class PhFs implements FileSystem {
*/ */
if (!instance) { if (!instance) {
throw new Error( throw new Error(
`Something as gone wrong. An instance without a subdomain is not possible.` `Something as gone wrong. An instance without a subdomain is not possible.`,
) )
} }
@ -247,7 +247,7 @@ export class PhFs implements FileSystem {
}) })
}) })
.catch(() => null) .catch(() => null)
}) }),
) )
}) })
.then(compact) .then(compact)
@ -322,7 +322,7 @@ export class PhFs implements FileSystem {
async write( async write(
fileName: string, fileName: string,
options?: { append?: boolean | undefined; start?: any } | undefined options?: { append?: boolean | undefined; start?: any } | undefined,
) { ) {
const { dbg, error } = this.log const { dbg, error } = this.log
.create(`write`) .create(`write`)
@ -366,7 +366,7 @@ export class PhFs implements FileSystem {
async read( async read(
fileName: string, fileName: string,
options: { start?: any } | undefined options: { start?: any } | undefined,
): Promise<any> { ): Promise<any> {
const { dbg, error } = this.log const { dbg, error } = this.log
.create(`read`) .create(`read`)
@ -374,9 +374,8 @@ export class PhFs implements FileSystem {
.breadcrumb(fileName) .breadcrumb(fileName)
dbg(`read`) dbg(`read`)
const { fsPath, clientPath, pathFromRootFolder } = await this._resolvePath( const { fsPath, clientPath, pathFromRootFolder } =
fileName await this._resolvePath(fileName)
)
const { start } = options || {} const { start } = options || {}
@ -433,9 +432,8 @@ export class PhFs implements FileSystem {
.breadcrumb(path) .breadcrumb(path)
dbg(`mkdir`) dbg(`mkdir`)
const { fsPath, clientPath, pathFromRootFolder } = await this._resolvePath( const { fsPath, clientPath, pathFromRootFolder } =
path await this._resolvePath(path)
)
/* /*
Disallow making directories if not inside root folder Disallow making directories if not inside root folder
@ -485,7 +483,7 @@ export class PhFs implements FileSystem {
Promise.all([ Promise.all([
this.restartInstanceGuard(fromRootFolderName, instance), this.restartInstanceGuard(fromRootFolderName, instance),
this.restartInstanceGuard(toRootFolderName, instance), this.restartInstanceGuard(toRootFolderName, instance),
]) ]),
) )
} }
@ -497,9 +495,8 @@ export class PhFs implements FileSystem {
.breadcrumb(mode.toString()) .breadcrumb(mode.toString())
dbg(`chmod`) dbg(`chmod`)
const { fsPath, clientPath, pathFromRootFolder } = await this._resolvePath( const { fsPath, clientPath, pathFromRootFolder } =
path await this._resolvePath(path)
)
/* /*
Disallow making directories if not inside root folder Disallow making directories if not inside root folder
@ -517,7 +514,7 @@ export class PhFs implements FileSystem {
async restartInstanceGuard( async restartInstanceGuard(
rootFolderName: FolderNames | undefined, rootFolderName: FolderNames | undefined,
instance: InstanceFields instance: InstanceFields,
) { ) {
// Not needed? // Not needed?
// const { dbg, error } = this.log // const { dbg, error } = this.log

View File

@ -10,4 +10,4 @@ const mkdir = promisify(fs.mkdir)
const rename = promisify(fs.rename) const rename = promisify(fs.rename)
const chmod = promisify(fs.chmod) const chmod = promisify(fs.chmod)
export { stat, readdir, access, unlink, rmdir, mkdir, rename, chmod } export { access, chmod, mkdir, readdir, rename, rmdir, stat, unlink }

View File

@ -2,11 +2,11 @@ import { SqliteChangeEvent, sqliteService } from '$services'
import { import {
InstanceLogFields, InstanceLogFields,
InstanceLogFields_Create, InstanceLogFields_Create,
RecordId,
StreamNames,
newId, newId,
pocketNow, pocketNow,
RecordId,
safeCatch, safeCatch,
StreamNames,
} from '@pockethost/common' } from '@pockethost/common'
import knex from 'knex' import knex from 'knex'
import { AsyncReturnType } from 'type-fest' import { AsyncReturnType } from 'type-fest'
@ -15,7 +15,7 @@ import { DaemonContext } from './DaemonContext'
export type SqliteLogger = AsyncReturnType<typeof createSqliteLogger> export type SqliteLogger = AsyncReturnType<typeof createSqliteLogger>
export const createSqliteLogger = async ( export const createSqliteLogger = async (
logDbPath: string, logDbPath: string,
context: DaemonContext context: DaemonContext,
) => { ) => {
const { parentLogger } = context const { parentLogger } = context
const _dbLogger = parentLogger.create(`${logDbPath}`) const _dbLogger = parentLogger.create(`${logDbPath}`)
@ -46,7 +46,7 @@ export const createSqliteLogger = async (
const sql = conn('logs').insert(_in).toString() const sql = conn('logs').insert(_in).toString()
trace(`Writing log ${JSON.stringify(_in)} ${sql}`) trace(`Writing log ${JSON.stringify(_in)} ${sql}`)
await db.exec(sql) await db.exec(sql)
} },
) )
const subscribe = (cb: (e: SqliteChangeEvent<InstanceLogFields>) => void) => { const subscribe = (cb: (e: SqliteChangeEvent<InstanceLogFields>) => void) => {
@ -66,7 +66,7 @@ export const createSqliteLogger = async (
const fetch = async (limit: number = 100) => { const fetch = async (limit: number = 100) => {
return db.all<InstanceLogFields[]>( return db.all<InstanceLogFields[]>(
`select * from logs order by created desc limit ${limit}` `select * from logs order by created desc limit ${limit}`,
) )
} }

View File

@ -17,7 +17,7 @@ const instances: {
export const createInstanceLogger = async ( export const createInstanceLogger = async (
instanceId: InstanceId, instanceId: InstanceId,
context: DaemonContext context: DaemonContext,
) => { ) => {
const { parentLogger } = context const { parentLogger } = context
const _instanceLogger = parentLogger.create(`InstanceLogger`) const _instanceLogger = parentLogger.create(`InstanceLogger`)
@ -31,7 +31,7 @@ export const createInstanceLogger = async (
DAEMON_PB_DATA_DIR, DAEMON_PB_DATA_DIR,
instanceId, instanceId,
'pb_data', 'pb_data',
'instance_logs.db' 'instance_logs.db',
) )
dbg(`logs path`, logDbPath) dbg(`logs path`, logDbPath)
@ -69,5 +69,5 @@ export const instanceLoggerService = mkSingleton(
dbg(`Shutting down`) dbg(`Shutting down`)
}, },
} }
} },
) )

View File

@ -43,7 +43,7 @@ export const createDenoProcess = async (config: DenoProcessConfig) => {
const denoWrite = ( const denoWrite = (
message: string, message: string,
stream: StreamNames = StreamNames.Info stream: StreamNames = StreamNames.Info,
) => { ) => {
dbg(`[${instance.id}:${path}:${stream}] ${message}`) dbg(`[${instance.id}:${path}:${stream}] ${message}`)
return denoLogger.write(message, stream) return denoLogger.write(message, stream)
@ -76,12 +76,12 @@ export const createDenoProcess = async (config: DenoProcessConfig) => {
if (code) { if (code) {
await denoWrite( await denoWrite(
`Unexpected 'deno' exit code: ${code}.`, `Unexpected 'deno' exit code: ${code}.`,
StreamNames.Error StreamNames.Error,
) )
} else { } else {
await denoWrite( await denoWrite(
`Worker has exited with code ${code}`, `Worker has exited with code ${code}`,
StreamNames.System StreamNames.System,
) )
} }
resolve() resolve()

View File

@ -8,18 +8,18 @@ import {
import { clientService, proxyService } from '$services' import { clientService, proxyService } from '$services'
import { mkInternalUrl, now } from '$util' import { mkInternalUrl, now } from '$util'
import { import {
assertTruthy,
CLEANUP_PRIORITY_LAST, CLEANUP_PRIORITY_LAST,
createCleanupManager,
createTimerManager,
InstanceFields, InstanceFields,
InstanceId, InstanceId,
InstanceStatus, InstanceStatus,
SingletonBaseConfig,
StreamNames,
assertTruthy,
createCleanupManager,
createTimerManager,
mkSingleton, mkSingleton,
safeCatch, safeCatch,
serialAsyncExecutionGuard, serialAsyncExecutionGuard,
SingletonBaseConfig,
StreamNames,
} from '@pockethost/common' } from '@pockethost/common'
import { map, values } from '@s-libs/micro-dash' import { map, values } from '@s-libs/micro-dash'
import Bottleneck from 'bottleneck' import Bottleneck from 'bottleneck'
@ -30,7 +30,7 @@ import { AsyncReturnType } from 'type-fest'
import { instanceLoggerService } from '../InstanceLoggerService' import { instanceLoggerService } from '../InstanceLoggerService'
import { pocketbaseService } from '../PocketBaseService' import { pocketbaseService } from '../PocketBaseService'
import { createDenoProcess } from './Deno/DenoProcess' import { createDenoProcess } from './Deno/DenoProcess'
import { portManager, PortManagerConfig } from './PortManager' import { PortManagerConfig, portManager } from './PortManager'
enum InstanceApiStatus { enum InstanceApiStatus {
Starting = 'starting', Starting = 'starting',
@ -116,13 +116,13 @@ export const instanceService = mkSingleton(
const { id, subdomain, version } = instance const { id, subdomain, version } = instance
const systemInstanceLogger = instanceServiceLogger.create( const systemInstanceLogger = instanceServiceLogger.create(
`${subdomain}:${id}:${version}` `${subdomain}:${id}:${version}`,
) )
const { dbg, warn, error, info } = systemInstanceLogger const { dbg, warn, error, info } = systemInstanceLogger
if (instanceApis[id]) { if (instanceApis[id]) {
throw new Error( throw new Error(
`Attempted to create an instance API when one is already available for ${id}` `Attempted to create an instance API when one is already available for ${id}`,
) )
} }
@ -159,7 +159,7 @@ export const instanceService = mkSingleton(
internalUrl: () => { internalUrl: () => {
if (status !== InstanceApiStatus.Healthy) { if (status !== InstanceApiStatus.Healthy) {
throw new Error( throw new Error(
`Attempt to access instance URL when instance is not in a healthy state.` `Attempt to access instance URL when instance is not in a healthy state.`,
) )
} }
return internalUrl return internalUrl
@ -167,7 +167,7 @@ export const instanceService = mkSingleton(
startRequest: () => { startRequest: () => {
if (status !== InstanceApiStatus.Healthy) { if (status !== InstanceApiStatus.Healthy) {
throw new Error( throw new Error(
`Attempt to start an instance request when instance is not in a healthy state.` `Attempt to start an instance request when instance is not in a healthy state.`,
) )
} }
return startRequest() return startRequest()
@ -198,7 +198,7 @@ export const instanceService = mkSingleton(
const healthyGuard = () => { const healthyGuard = () => {
if (status !== InstanceApiStatus.ShuttingDown) return if (status !== InstanceApiStatus.ShuttingDown) return
throw new Error( throw new Error(
`HealthyGuard detected instance is shutting down. Aborting further initialization.` `HealthyGuard detected instance is shutting down. Aborting further initialization.`,
) )
} }
@ -207,7 +207,7 @@ export const instanceService = mkSingleton(
*/ */
const clientLimiter = new Bottleneck({ maxConcurrent: 1 }) const clientLimiter = new Bottleneck({ maxConcurrent: 1 })
const updateInstanceStatus = clientLimiter.wrap( const updateInstanceStatus = clientLimiter.wrap(
client.updateInstanceStatus client.updateInstanceStatus,
) )
const updateInstance = clientLimiter.wrap(client.updateInstance) const updateInstance = clientLimiter.wrap(client.updateInstance)
const createInvocation = clientLimiter.wrap(client.createInvocation) const createInvocation = clientLimiter.wrap(client.createInvocation)
@ -240,15 +240,15 @@ export const instanceService = mkSingleton(
instance.id, instance.id,
{ {
parentLogger: systemInstanceLogger, parentLogger: systemInstanceLogger,
} },
) )
const writeUserLog = serialAsyncExecutionGuard( const writeUserLog = serialAsyncExecutionGuard(
userInstanceLogger.write, userInstanceLogger.write,
() => `${instance.id}:userLog` () => `${instance.id}:userLog`,
) )
shutdownManager.add(() => shutdownManager.add(() =>
writeUserLog(`Shutting down instance`).catch(error) writeUserLog(`Shutting down instance`).catch(error),
) )
/* /*
@ -277,7 +277,7 @@ export const instanceService = mkSingleton(
version, version,
onUnexpectedStop: (code, stdout, stderr) => { onUnexpectedStop: (code, stdout, stderr) => {
warn( warn(
`PocketBase processes exited unexpectedly with ${code}. Putting in maintenance mode.` `PocketBase processes exited unexpectedly with ${code}. Putting in maintenance mode.`,
) )
warn(stdout) warn(stdout)
warn(stderr) warn(stderr)
@ -287,24 +287,24 @@ export const instanceService = mkSingleton(
}) })
await writeUserLog( await writeUserLog(
`Putting instance in maintenance mode because it shut down with return code ${code}. `, `Putting instance in maintenance mode because it shut down with return code ${code}. `,
StreamNames.Error StreamNames.Error,
) )
await Promise.all( await Promise.all(
stdout.map((data) => stdout.map((data) =>
writeUserLog(data, StreamNames.Error).catch(error) writeUserLog(data, StreamNames.Error).catch(error),
) ),
) )
await Promise.all( await Promise.all(
stderr.map((data) => stderr.map((data) =>
writeUserLog(data, StreamNames.Error).catch(error) writeUserLog(data, StreamNames.Error).catch(error),
) ),
) )
}) })
setImmediate(() => { setImmediate(() => {
_safeShutdown( _safeShutdown(
new Error( new Error(
`PocketBase processes exited unexpectedly with ${code}. Putting in maintenance mode.` `PocketBase processes exited unexpectedly with ${code}. Putting in maintenance mode.`,
) ),
).catch(error) ).catch(error)
}) })
}, },
@ -313,7 +313,7 @@ export const instanceService = mkSingleton(
} catch (e) { } catch (e) {
warn(`Error spawning: ${e}`) warn(`Error spawning: ${e}`)
throw new Error( throw new Error(
`Could not launch PocketBase ${instance.version}. It may be time to upgrade.` `Could not launch PocketBase ${instance.version}. It may be time to upgrade.`,
) )
} }
})() })()
@ -345,7 +345,7 @@ export const instanceService = mkSingleton(
DAEMON_PB_DATA_DIR, DAEMON_PB_DATA_DIR,
instance.id, instance.id,
`worker`, `worker`,
`index.ts` `index.ts`,
) )
dbg(`Checking ${workerPath} for a worker entry point`) dbg(`Checking ${workerPath} for a worker entry point`)
if (existsSync(workerPath)) { if (existsSync(workerPath)) {
@ -405,7 +405,7 @@ export const instanceService = mkSingleton(
} }
return true return true
}), }),
RECHECK_TTL RECHECK_TTL,
) )
} }
@ -418,7 +418,7 @@ export const instanceService = mkSingleton(
warn(`_pingInvocation failed with ${e}`) warn(`_pingInvocation failed with ${e}`)
return true return true
}), }),
1000 1000,
) )
} }
@ -442,7 +442,7 @@ export const instanceService = mkSingleton(
.catch((e: ClientResponseError) => { .catch((e: ClientResponseError) => {
if (e.status !== 404) { if (e.status !== 404) {
throw new Error( throw new Error(
`Unexpected response ${JSON.stringify(e)} from mothership` `Unexpected response ${JSON.stringify(e)} from mothership`,
) )
} }
return [] return []
@ -454,9 +454,8 @@ export const instanceService = mkSingleton(
} }
{ {
dbg(`Trying to get instance by subdomain: ${idOrSubdomain}`) dbg(`Trying to get instance by subdomain: ${idOrSubdomain}`)
const [instance, owner] = await client.getInstanceBySubdomain( const [instance, owner] =
idOrSubdomain await client.getInstanceBySubdomain(idOrSubdomain)
)
if (instance && owner) { if (instance && owner) {
dbg(`${idOrSubdomain} is a subdomain`) dbg(`${idOrSubdomain} is a subdomain`)
return { instance, owner } return { instance, owner }
@ -477,14 +476,14 @@ export const instanceService = mkSingleton(
if (instanceIdOrSubdomain === PUBLIC_APP_DB) return if (instanceIdOrSubdomain === PUBLIC_APP_DB) return
const { instance, owner } = await getInstanceByIdOrSubdomain( const { instance, owner } = await getInstanceByIdOrSubdomain(
instanceIdOrSubdomain instanceIdOrSubdomain,
) )
if (!owner) { if (!owner) {
throw new Error(`Instance owner is invalid`) throw new Error(`Instance owner is invalid`)
} }
if (!instance) { if (!instance) {
throw new Error( throw new Error(
`Subdomain ${instanceIdOrSubdomain} does not resolve to an instance` `Subdomain ${instanceIdOrSubdomain} does not resolve to an instance`,
) )
} }
@ -494,7 +493,7 @@ export const instanceService = mkSingleton(
dbg(`Checking for maintenance mode`) dbg(`Checking for maintenance mode`)
if (instance.maintenance) { if (instance.maintenance) {
throw new Error( throw new Error(
`This instance is in Maintenance Mode. See https://pockethost.gitbook.io/manual/daily-usage/maintenance for more information.` `This instance is in Maintenance Mode. See https://pockethost.gitbook.io/manual/daily-usage/maintenance for more information.`,
) )
} }
@ -504,7 +503,7 @@ export const instanceService = mkSingleton(
dbg(`Checking for verified account`) dbg(`Checking for verified account`)
if (!owner?.verified) { if (!owner?.verified) {
throw new Error( throw new Error(
`Log in at ${PUBLIC_APP_PROTOCOL}://${PUBLIC_APP_DOMAIN} to verify your account.` `Log in at ${PUBLIC_APP_PROTOCOL}://${PUBLIC_APP_DOMAIN} to verify your account.`,
) )
} }
@ -518,12 +517,12 @@ export const instanceService = mkSingleton(
dbg( dbg(
`Forwarding proxy request for ${ `Forwarding proxy request for ${
req.url req.url
} to instance ${api.internalUrl()}` } to instance ${api.internalUrl()}`,
) )
proxy.web(req, res, { target: api.internalUrl() }) proxy.web(req, res, { target: api.internalUrl() })
}, },
`InstanceService` `InstanceService`,
) )
const { getNextPort } = await portManager({ maxPorts }) const { getNextPort } = await portManager({ maxPorts })
@ -537,5 +536,5 @@ export const instanceService = mkSingleton(
const getInstanceApiIfExistsById = (id: InstanceId) => instanceApis[id] const getInstanceApiIfExistsById = (id: InstanceId) => instanceApis[id]
return { shutdown, getInstanceApiIfExistsById } return { shutdown, getInstanceApiIfExistsById }
} },
) )

View File

@ -37,8 +37,8 @@ export const portManager = mkSingleton(async (cfg: PortManagerConfig) => {
const removed = remove(exclude, (v) => v === newPort) const removed = remove(exclude, (v) => v === newPort)
dbg( dbg(
`Removed ${removed.join(',')} from excluded ports: ${exclude.join( `Removed ${removed.join(',')} from excluded ports: ${exclude.join(
',' ',',
)}` )}`,
) )
}, },
] ]

View File

@ -2,8 +2,8 @@ import { DAEMON_PB_DATA_DIR, DAEMON_PB_MIGRATIONS_DIR } from '$constants'
import { mkInternalAddress, mkInternalUrl, tryFetch } from '$util' import { mkInternalAddress, mkInternalUrl, tryFetch } from '$util'
import { createCleanupManager, createTimerManager } from '@pockethost/common' import { createCleanupManager, createTimerManager } from '@pockethost/common'
import { import {
mkSingleton,
SingletonBaseConfig, SingletonBaseConfig,
mkSingleton,
} from '@pockethost/common/src/mkSingleton' } from '@pockethost/common/src/mkSingleton'
import { spawn } from 'child_process' import { spawn } from 'child_process'
import { existsSync } from 'fs' import { existsSync } from 'fs'
@ -23,7 +23,7 @@ export type SpawnConfig = {
onUnexpectedStop: ( onUnexpectedStop: (
code: number | null, code: number | null,
stdout: string[], stdout: string[],
stderr: string[] stderr: string[],
) => void ) => void
} }
export type PocketbaseServiceApi = AsyncReturnType< export type PocketbaseServiceApi = AsyncReturnType<
@ -49,7 +49,7 @@ function pidIsRunning(pid: number) {
} }
export const createPocketbaseService = async ( export const createPocketbaseService = async (
config: PocketbaseServiceConfig config: PocketbaseServiceConfig,
) => { ) => {
const { logger } = config const { logger } = config
const _serviceLogger = logger.create('PocketbaseService') const _serviceLogger = logger.create('PocketbaseService')
@ -77,7 +77,7 @@ export const createPocketbaseService = async (
const bin = realVersion.binPath const bin = realVersion.binPath
if (!existsSync(bin)) { if (!existsSync(bin)) {
throw new Error( throw new Error(
`PocketBase binary (${bin}) not found. Contact pockethost.io.` `PocketBase binary (${bin}) not found. Contact pockethost.io.`,
) )
} }
@ -93,7 +93,7 @@ export const createPocketbaseService = async (
args.push( args.push(
isMothership isMothership
? DAEMON_PB_MIGRATIONS_DIR ? DAEMON_PB_MIGRATIONS_DIR
: `${DAEMON_PB_DATA_DIR}/${slug}/pb_migrations` : `${DAEMON_PB_DATA_DIR}/${slug}/pb_migrations`,
) )
} }
if (command === 'serve') { if (command === 'serve') {
@ -157,7 +157,7 @@ export const createPocketbaseService = async (
const { pid } = ls const { pid } = ls
if (!pid) { if (!pid) {
throw new Error( throw new Error(
`Attempt to kill a PocketBase process that was never running.` `Attempt to kill a PocketBase process that was never running.`,
) )
} }
const p = new Promise<boolean>((resolve, reject) => { const p = new Promise<boolean>((resolve, reject) => {

View File

@ -22,7 +22,7 @@ export type ProxyMiddleware = (
proxy: Server proxy: Server
host: string host: string
}, },
logger: Logger logger: Logger,
) => void | Promise<void> ) => void | Promise<void>
export type ProxyServiceConfig = SingletonBaseConfig & { export type ProxyServiceConfig = SingletonBaseConfig & {
@ -44,7 +44,7 @@ export const proxyService = mkSingleton(async (config: ProxyServiceConfig) => {
dbg(`Incoming request ${req.method} ${req.headers.host}/${req.url}`) dbg(`Incoming request ${req.method} ${req.headers.host}/${req.url}`)
if (!req.headers.host?.endsWith(PUBLIC_APP_DOMAIN)) { if (!req.headers.host?.endsWith(PUBLIC_APP_DOMAIN)) {
warn( warn(
`Request for ${req.headers.host} rejected because host does not end in ${PUBLIC_APP_DOMAIN}` `Request for ${req.headers.host} rejected because host does not end in ${PUBLIC_APP_DOMAIN}`,
) )
res.writeHead(502, { res.writeHead(502, {
'Content-Type': `text/plain`, 'Content-Type': `text/plain`,
@ -54,7 +54,7 @@ export const proxyService = mkSingleton(async (config: ProxyServiceConfig) => {
} }
{ {
const { warn } = _proxyLogger.create( const { warn } = _proxyLogger.create(
`${req.method} ${req.headers.host}/${req.url}` `${req.method} ${req.headers.host}/${req.url}`,
) )
try { try {
for (let i = 0; i < middleware.length; i++) { for (let i = 0; i < middleware.length; i++) {
@ -94,7 +94,7 @@ export const proxyService = mkSingleton(async (config: ProxyServiceConfig) => {
subdomainFilter: string | ((subdomain: string) => boolean), subdomainFilter: string | ((subdomain: string) => boolean),
urlFilters: string | string[], urlFilters: string | string[],
handler: ProxyMiddleware, handler: ProxyMiddleware,
handlerName: string handlerName: string,
) => { ) => {
const _handlerLogger = _proxyLogger.create(`${handlerName}`) const _handlerLogger = _proxyLogger.create(`${handlerName}`)
const { dbg, trace } = _handlerLogger const { dbg, trace } = _handlerLogger
@ -149,7 +149,7 @@ export const proxyService = mkSingleton(async (config: ProxyServiceConfig) => {
req, req,
res, res,
{ host, subdomain, coreInternalUrl, proxy }, { host, subdomain, coreInternalUrl, proxy },
_requestLogger _requestLogger,
) )
}) })
} }

View File

@ -59,7 +59,7 @@ export const realtimeLog = mkSingleton(async (config: RealtimeLogConfig) => {
res.setHeader('Access-Control-Allow-Methods', 'POST, OPTIONS') res.setHeader('Access-Control-Allow-Methods', 'POST, OPTIONS')
res.setHeader( res.setHeader(
'Access-Control-Allow-Headers', 'Access-Control-Allow-Headers',
'authorization,content-type,cache-control' 'authorization,content-type,cache-control',
) )
res.setHeader('Access-Control-Max-Age', 86400) res.setHeader('Access-Control-Max-Age', 86400)
res.statusCode = 204 res.statusCode = 204
@ -106,7 +106,7 @@ export const realtimeLog = mkSingleton(async (config: RealtimeLogConfig) => {
.getOne<InstanceFields>(instanceId) .getOne<InstanceFields>(instanceId)
if (!instance) { if (!instance) {
throw new Error( throw new Error(
`instanceId ${instanceId} not found for user ${user.id}` `instanceId ${instanceId} not found for user ${user.id}`,
) )
} }
dbg(`Instance is `, instance) dbg(`Instance is `, instance)
@ -142,14 +142,14 @@ export const realtimeLog = mkSingleton(async (config: RealtimeLogConfig) => {
const evt = mkEvent(`log`, record) const evt = mkEvent(`log`, record)
trace( trace(
`Dispatching SSE log event from ${instance.subdomain} (${instance.id})`, `Dispatching SSE log event from ${instance.subdomain} (${instance.id})`,
evt evt,
) )
limiter.schedule(() => write(evt)).catch(error) limiter.schedule(() => write(evt)).catch(error)
}) })
req.on('close', () => { req.on('close', () => {
limiter.stop() limiter.stop()
dbg( dbg(
`SSE request for ${instance.subdomain} (${instance.id}) closed. Unsubscribing.` `SSE request for ${instance.subdomain} (${instance.id}) closed. Unsubscribing.`,
) )
unsub() unsub()
}) })
@ -172,7 +172,7 @@ export const realtimeLog = mkSingleton(async (config: RealtimeLogConfig) => {
const evt = mkEvent(`log`, rec) const evt = mkEvent(`log`, rec)
trace( trace(
`Dispatching SSE initial log event from ${instance.subdomain} (${instance.id})`, `Dispatching SSE initial log event from ${instance.subdomain} (${instance.id})`,
evt evt,
) )
return write(evt) return write(evt)
}) })
@ -186,7 +186,7 @@ export const realtimeLog = mkSingleton(async (config: RealtimeLogConfig) => {
.catch(error) .catch(error)
} }
}, },
`RealtimeLogService` `RealtimeLogService`,
) )
return { return {

View File

@ -1,12 +1,12 @@
import { clientService } from '$services' import { clientService } from '$services'
import { import {
assertTruthy, RPC_COMMANDS,
mkSingleton,
RpcCommands, RpcCommands,
RpcFields, RpcFields,
RpcStatus, RpcStatus,
RPC_COMMANDS,
SingletonBaseConfig, SingletonBaseConfig,
assertTruthy,
mkSingleton,
} from '@pockethost/common' } from '@pockethost/common'
import { isObject } from '@s-libs/micro-dash' import { isObject } from '@s-libs/micro-dash'
import Ajv, { JSONSchemaType, ValidateFunction } from 'ajv' import Ajv, { JSONSchemaType, ValidateFunction } from 'ajv'
@ -22,12 +22,12 @@ export type KnexApi = ReturnType<typeof knexFactory>
export type CommandModuleInitializer = ( export type CommandModuleInitializer = (
register: RpcServiceApi['registerCommand'], register: RpcServiceApi['registerCommand'],
client: pocketbaseEs, client: pocketbaseEs,
knex: KnexApi knex: KnexApi,
) => void ) => void
export type RpcRunner< export type RpcRunner<
TPayload extends JsonObject, TPayload extends JsonObject,
TResult extends JsonObject TResult extends JsonObject,
> = (job: RpcFields<TPayload, TResult>) => Promise<TResult> > = (job: RpcFields<TPayload, TResult>) => Promise<TResult>
export type RpcServiceConfig = SingletonBaseConfig & {} export type RpcServiceConfig = SingletonBaseConfig & {}
@ -58,8 +58,8 @@ export const rpcService = mkSingleton(async (config: RpcServiceConfig) => {
if (!RPC_COMMANDS.find((c) => c === cmd)) { if (!RPC_COMMANDS.find((c) => c === cmd)) {
throw new Error( throw new Error(
`RPC command '${cmd}' is invalid. It must be one of: ${RPC_COMMANDS.join( `RPC command '${cmd}' is invalid. It must be one of: ${RPC_COMMANDS.join(
'|' '|',
)}.` )}.`,
) )
} }
return cmd as RpcCommands return cmd as RpcCommands
@ -76,7 +76,7 @@ export const rpcService = mkSingleton(async (config: RpcServiceConfig) => {
const { validate, run } = handler const { validate, run } = handler
if (!validate(payload)) { if (!validate(payload)) {
throw new Error( throw new Error(
`Payload for ${cmd} fails validation: ${JSON.stringify(payload)}` `Payload for ${cmd} fails validation: ${JSON.stringify(payload)}`,
) )
} }
dbg(`Running RPC ${rpc.id}`, rpc) dbg(`Running RPC ${rpc.id}`, rpc)
@ -115,11 +115,11 @@ export const rpcService = mkSingleton(async (config: RpcServiceConfig) => {
const registerCommand = < const registerCommand = <
TPayload extends JsonObject, TPayload extends JsonObject,
TResult extends JsonObject TResult extends JsonObject,
>( >(
commandName: RpcCommands, commandName: RpcCommands,
schema: JSONSchemaType<TPayload>, schema: JSONSchemaType<TPayload>,
runner: RpcRunner<TPayload, TResult> runner: RpcRunner<TPayload, TResult>,
) => { ) => {
if (jobHandlers[commandName]) { if (jobHandlers[commandName]) {
throw new Error(`${commandName} job handler already registered.`) throw new Error(`${commandName} job handler already registered.`)

View File

@ -20,9 +20,9 @@ import {
type SetInstanceMaintenanceResult, type SetInstanceMaintenanceResult,
} from '@pockethost/common' } from '@pockethost/common'
import { valid, validRange } from 'semver' import { valid, validRange } from 'semver'
import { clientService } from '../clientService/clientService'
import { instanceService } from '../InstanceService/InstanceService' import { instanceService } from '../InstanceService/InstanceService'
import { updaterService } from '../UpdaterService/UpdaterService' import { updaterService } from '../UpdaterService/UpdaterService'
import { clientService } from '../clientService/clientService'
import { rpcService } from './RpcService' import { rpcService } from './RpcService'
export const registerRpcCommands = async (logger: Logger) => { export const registerRpcCommands = async (logger: Logger) => {
@ -48,7 +48,7 @@ export const registerRpcCommands = async (logger: Logger) => {
maintenance: false, maintenance: false,
}) })
return { instance } return { instance }
} },
) )
registerCommand<SaveVersionPayload, SaveVersionResult>( registerCommand<SaveVersionPayload, SaveVersionResult>(
@ -65,7 +65,7 @@ export const registerRpcCommands = async (logger: Logger) => {
} }
await client.updateInstance(instanceId, { version }) await client.updateInstance(instanceId, { version })
return { status: 'ok' } return { status: 'ok' }
} },
) )
registerCommand<SaveSecretsPayload, SaveSecretsResult>( registerCommand<SaveSecretsPayload, SaveSecretsResult>(
@ -76,7 +76,7 @@ export const registerRpcCommands = async (logger: Logger) => {
const { instanceId, secrets } = payload const { instanceId, secrets } = payload
await client.updateInstance(instanceId, { secrets }) await client.updateInstance(instanceId, { secrets })
return { status: 'ok' } return { status: 'ok' }
} },
) )
registerCommand<RenameInstancePayload, RenameInstanceResult>( registerCommand<RenameInstancePayload, RenameInstanceResult>(
@ -90,7 +90,7 @@ export const registerRpcCommands = async (logger: Logger) => {
await client.updateInstance(instanceId, { subdomain }) await client.updateInstance(instanceId, { subdomain })
dbg(`Instance updated successfully `) dbg(`Instance updated successfully `)
return {} return {}
} },
) )
registerCommand<SetInstanceMaintenancePayload, SetInstanceMaintenanceResult>( registerCommand<SetInstanceMaintenancePayload, SetInstanceMaintenanceResult>(
@ -112,7 +112,7 @@ export const registerRpcCommands = async (logger: Logger) => {
} }
} }
return {} return {}
} },
) )
// gen:command // gen:command

View File

@ -5,13 +5,13 @@ import {
serialAsyncExecutionGuard, serialAsyncExecutionGuard,
SingletonBaseConfig, SingletonBaseConfig,
} from '@pockethost/common' } from '@pockethost/common'
import { Database as SqliteDatabase, open } from 'sqlite' import { open, Database as SqliteDatabase } from 'sqlite'
import { Database } from 'sqlite3' import { Database } from 'sqlite3'
import { JsonObject } from 'type-fest' import { JsonObject } from 'type-fest'
export type SqliteUnsubscribe = () => void export type SqliteUnsubscribe = () => void
export type SqliteChangeHandler<TRecord extends JsonObject> = ( export type SqliteChangeHandler<TRecord extends JsonObject> = (
e: SqliteChangeEvent<TRecord> e: SqliteChangeEvent<TRecord>,
) => void ) => void
export type SqliteEventType = 'update' | 'insert' | 'delete' export type SqliteEventType = 'update' | 'insert' | 'delete'
export type SqliteChangeEvent<TRecord extends JsonObject> = { export type SqliteChangeEvent<TRecord extends JsonObject> = {
@ -25,7 +25,7 @@ export type SqliteServiceApi = {
migrate: SqliteDatabase['migrate'] migrate: SqliteDatabase['migrate']
exec: SqliteDatabase['exec'] exec: SqliteDatabase['exec']
subscribe: <TRecord extends JsonObject>( subscribe: <TRecord extends JsonObject>(
cb: SqliteChangeHandler<TRecord> cb: SqliteChangeHandler<TRecord>,
) => SqliteUnsubscribe ) => SqliteUnsubscribe
} }
export type SqliteServiceConfig = SingletonBaseConfig & {} export type SqliteServiceConfig = SingletonBaseConfig & {}
@ -43,7 +43,7 @@ export const sqliteService = mkSingleton((config: SqliteServiceConfig) => {
This function This function
*/ */
const _unsafe_getDatabase = async ( const _unsafe_getDatabase = async (
filename: string filename: string,
): Promise<SqliteServiceApi> => { ): Promise<SqliteServiceApi> => {
const _dbLogger = logger.create(`SqliteService`) const _dbLogger = logger.create(`SqliteService`)
_dbLogger.breadcrumb(filename) _dbLogger.breadcrumb(filename)
@ -62,7 +62,7 @@ export const sqliteService = mkSingleton((config: SqliteServiceConfig) => {
eventType: SqliteEventType, eventType: SqliteEventType,
database: string, database: string,
table: string, table: string,
rowId: number rowId: number,
) => { ) => {
trace(`Got a raw change event`, { trace(`Got a raw change event`, {
eventType, eventType,
@ -73,7 +73,7 @@ export const sqliteService = mkSingleton((config: SqliteServiceConfig) => {
if (eventType === 'delete') return // Not supported if (eventType === 'delete') return // Not supported
const record = await db.get( const record = await db.get(
`select * from ${table} where rowid = '${rowId}'` `select * from ${table} where rowid = '${rowId}'`,
) )
const e: SqliteChangeEvent<any> = { const e: SqliteChangeEvent<any> = {
table, table,
@ -81,7 +81,7 @@ export const sqliteService = mkSingleton((config: SqliteServiceConfig) => {
record, record,
} }
fireChange(e) fireChange(e)
} },
) )
cm.add(() => { cm.add(() => {
@ -110,7 +110,7 @@ export const sqliteService = mkSingleton((config: SqliteServiceConfig) => {
} }
const getDatabase = serialAsyncExecutionGuard( const getDatabase = serialAsyncExecutionGuard(
_unsafe_getDatabase, _unsafe_getDatabase,
(fileName) => fileName (fileName) => fileName,
) )
const shutdown = async () => { const shutdown = async () => {

View File

@ -1,9 +1,9 @@
import { downloadAndExtract, smartFetch } from '$util' import { downloadAndExtract, smartFetch } from '$util'
import { import {
SingletonBaseConfig,
createCleanupManager, createCleanupManager,
createTimerManager, createTimerManager,
mkSingleton, mkSingleton,
SingletonBaseConfig,
} from '@pockethost/common' } from '@pockethost/common'
import { keys } from '@s-libs/micro-dash' import { keys } from '@s-libs/micro-dash'
import { chmodSync, existsSync } from 'fs' import { chmodSync, existsSync } from 'fs'
@ -49,7 +49,7 @@ export const updaterService = mkSingleton(
const check = async () => { const check = async () => {
const releases = await smartFetch<Releases>( const releases = await smartFetch<Releases>(
`https://api.github.com/repos/pocketbase/pocketbase/releases?per_page=100`, `https://api.github.com/repos/pocketbase/pocketbase/releases?per_page=100`,
join(cachePath, `releases.json`) join(cachePath, `releases.json`),
) )
// dbg({ releases }) // dbg({ releases })
@ -77,7 +77,7 @@ export const updaterService = mkSingleton(
await Promise.all(promises) await Promise.all(promises)
if (keys(binPaths).length === 0) { if (keys(binPaths).length === 0) {
throw new Error( throw new Error(
`No version found, probably mismatched architecture and OS (${osName}/${cpuArchitecture})` `No version found, probably mismatched architecture and OS (${osName}/${cpuArchitecture})`,
) )
} }
maxVersion = `~${rsort(keys(binPaths))[0]}` maxVersion = `~${rsort(keys(binPaths))[0]}`
@ -94,7 +94,7 @@ export const updaterService = mkSingleton(
const version = maxSatisfying(keys(binPaths), semVer) const version = maxSatisfying(keys(binPaths), semVer)
if (!version) if (!version)
throw new Error( throw new Error(
`No version satisfies ${semVer} (${keys(binPaths).join(', ')})` `No version satisfies ${semVer} (${keys(binPaths).join(', ')})`,
) )
const binPath = binPaths[version] const binPath = binPaths[version]
if (!binPath) throw new Error(`binPath for ${version} not found`) if (!binPath) throw new Error(`binPath for ${version} not found`)
@ -109,5 +109,5 @@ export const updaterService = mkSingleton(
getVersion, getVersion,
shutdown: async () => {}, shutdown: async () => {},
} }
} },
) )

View File

@ -1,12 +1,12 @@
import { import {
assertExists, INSTANCE_COLLECTION,
InstanceFields, InstanceFields,
InstanceFields_Create, InstanceFields_Create,
InstanceId, InstanceId,
InstanceStatus, InstanceStatus,
INSTANCE_COLLECTION,
safeCatch,
UserFields, UserFields,
assertExists,
safeCatch,
} from '@pockethost/common' } from '@pockethost/common'
import { reduce } from '@s-libs/micro-dash' import { reduce } from '@s-libs/micro-dash'
import Bottleneck from 'bottleneck' import Bottleneck from 'bottleneck'
@ -25,7 +25,7 @@ export const createInstanceMixin = (context: MixinContext) => {
const resetInstances = safeCatch(`resetRpcs`, logger, async () => const resetInstances = safeCatch(`resetRpcs`, logger, async () =>
rawDb(INSTANCE_COLLECTION).update<InstanceFields>({ rawDb(INSTANCE_COLLECTION).update<InstanceFields>({
status: InstanceStatus.Idle, status: InstanceStatus.Idle,
}) }),
) )
const createInstance = safeCatch( const createInstance = safeCatch(
@ -35,7 +35,7 @@ export const createInstanceMixin = (context: MixinContext) => {
return client return client
.collection(INSTANCE_COLLECTION) .collection(INSTANCE_COLLECTION)
.create<InstanceFields>(payload) .create<InstanceFields>(payload)
} },
) )
const getInstanceBySubdomain = safeCatch( const getInstanceBySubdomain = safeCatch(
@ -57,12 +57,12 @@ export const createInstanceMixin = (context: MixinContext) => {
.then((user) => { .then((user) => {
return [instance, user] return [instance, user]
}) })
}) }),
) )
const getInstanceById = async ( const getInstanceById = async (
instanceId: InstanceId, instanceId: InstanceId,
context?: AsyncContext context?: AsyncContext,
): Promise<[InstanceFields, UserFields] | []> => ): Promise<[InstanceFields, UserFields] | []> =>
client client
.collection(INSTANCE_COLLECTION) .collection(INSTANCE_COLLECTION)
@ -86,7 +86,7 @@ export const createInstanceMixin = (context: MixinContext) => {
logger, logger,
async (instanceId: InstanceId, fields: Partial<InstanceFields>) => { async (instanceId: InstanceId, fields: Partial<InstanceFields>) => {
await client.collection(INSTANCE_COLLECTION).update(instanceId, fields) await client.collection(INSTANCE_COLLECTION).update(instanceId, fields)
} },
) )
const updateInstanceStatus = safeCatch( const updateInstanceStatus = safeCatch(
@ -94,7 +94,7 @@ export const createInstanceMixin = (context: MixinContext) => {
logger, logger,
async (instanceId: InstanceId, status: InstanceStatus) => { async (instanceId: InstanceId, status: InstanceStatus) => {
await updateInstance(instanceId, { status }) await updateInstance(instanceId, { status })
} },
) )
const getInstance = safeCatch( const getInstance = safeCatch(
@ -104,7 +104,7 @@ export const createInstanceMixin = (context: MixinContext) => {
return client return client
.collection(INSTANCE_COLLECTION) .collection(INSTANCE_COLLECTION)
.getOne<InstanceFields>(instanceId) .getOne<InstanceFields>(instanceId)
} },
) )
const getInstances = safeCatch(`getInstances`, logger, async () => { const getInstances = safeCatch(`getInstances`, logger, async () => {
@ -129,14 +129,14 @@ export const createInstanceMixin = (context: MixinContext) => {
return client return client
.collection(INSTANCE_COLLECTION) .collection(INSTANCE_COLLECTION)
.update(r.id, toUpdate) .update(r.id, toUpdate)
}) }),
) )
return c return c
}, },
[] as Promise<void>[] [] as Promise<void>[],
) )
await Promise.all(promises) await Promise.all(promises)
} },
) )
const updateInstanceSeconds = safeCatch( const updateInstanceSeconds = safeCatch(
@ -156,7 +156,7 @@ export const createInstanceMixin = (context: MixinContext) => {
assertExists(row, `Expected row here`) assertExists(row, `Expected row here`)
const secondsThisMonth = row.t const secondsThisMonth = row.t
await updateInstance(instanceId, { secondsThisMonth }) await updateInstance(instanceId, { secondsThisMonth })
} },
) )
return { return {

View File

@ -9,7 +9,7 @@ import { MixinContext } from './PbClient'
export const createInvocationMixin = ( export const createInvocationMixin = (
context: MixinContext, context: MixinContext,
instanceApi: InstanceApi instanceApi: InstanceApi,
) => { ) => {
const { logger } = context const { logger } = context
const { dbg } = logger.create('InvocationMixin') const { dbg } = logger.create('InvocationMixin')
@ -32,7 +32,7 @@ export const createInvocationMixin = (
$cancelKey: `createInvocation:${instance.id}:${pid}`, $cancelKey: `createInvocation:${instance.id}:${pid}`,
}) })
return _inv return _inv
} },
) )
const pingInvocation = safeCatch( const pingInvocation = safeCatch(
@ -49,7 +49,7 @@ export const createInvocationMixin = (
.update<InvocationFields>(invocation.id, toUpdate) .update<InvocationFields>(invocation.id, toUpdate)
await instanceApi.updateInstanceSeconds(invocation.instanceId) await instanceApi.updateInstanceSeconds(invocation.instanceId)
return _inv return _inv
} },
) )
const finalizeInvocation = safeCatch( const finalizeInvocation = safeCatch(
@ -69,7 +69,7 @@ export const createInvocationMixin = (
.update<InvocationFields>(invocation.id, toUpdate) .update<InvocationFields>(invocation.id, toUpdate)
await instanceApi.updateInstanceSeconds(invocation.instanceId) await instanceApi.updateInstanceSeconds(invocation.instanceId)
return _inv return _inv
} },
) )
return { finalizeInvocation, pingInvocation, createInvocation } return { finalizeInvocation, pingInvocation, createInvocation }

View File

@ -18,7 +18,7 @@ export const createPbClient = (url: string, logger: Logger) => {
info(`Initializing client: ${url}`) info(`Initializing client: ${url}`)
const rawDb = createRawPbClient( const rawDb = createRawPbClient(
`${DAEMON_PB_DATA_DIR}/${PUBLIC_APP_DB}/pb_data/data.db`, `${DAEMON_PB_DATA_DIR}/${PUBLIC_APP_DB}/pb_data/data.db`,
_clientLogger _clientLogger,
) )
const client = new PocketBase(url) const client = new PocketBase(url)
@ -27,7 +27,7 @@ export const createPbClient = (url: string, logger: Logger) => {
`adminAuthViaEmail`, `adminAuthViaEmail`,
_clientLogger, _clientLogger,
(email: string, password: string) => (email: string, password: string) =>
client.admins.authWithPassword(email, password) client.admins.authWithPassword(email, password),
) )
const createFirstAdmin = safeCatch( const createFirstAdmin = safeCatch(
@ -40,7 +40,7 @@ export const createPbClient = (url: string, logger: Logger) => {
console.log({ email, password }) console.log({ email, password })
console.log(JSON.stringify(res, null, 2)) console.log(JSON.stringify(res, null, 2))
return res return res
}) }),
) )
const context: MixinContext = { client, rawDb, logger: _clientLogger } const context: MixinContext = { client, rawDb, logger: _clientLogger }

View File

@ -1,7 +1,7 @@
import { import {
RPC_COLLECTION,
RpcFields, RpcFields,
RpcStatus, RpcStatus,
RPC_COLLECTION,
safeCatch, safeCatch,
} from '@pockethost/common' } from '@pockethost/common'
import { ClientResponseError } from 'pocketbase' import { ClientResponseError } from 'pocketbase'
@ -31,7 +31,7 @@ export const createRpcHelper = (config: RpcHelperConfig) => {
cb(e.record) cb(e.record)
}) })
return unsub return unsub
} },
) )
const resetRpcs = safeCatch(`resetRpcs`, logger, async () => const resetRpcs = safeCatch(`resetRpcs`, logger, async () =>
@ -43,7 +43,7 @@ export const createRpcHelper = (config: RpcHelperConfig) => {
.update<RpcFields<any, any>>({ .update<RpcFields<any, any>>({
status: RpcStatus.FinishedError, status: RpcStatus.FinishedError,
result: `Canceled by reset`, result: `Canceled by reset`,
}) }),
) )
const incompleteRpcs = safeCatch(`incompleteRpcs`, logger, async () => { const incompleteRpcs = safeCatch(`incompleteRpcs`, logger, async () => {
@ -65,7 +65,7 @@ export const createRpcHelper = (config: RpcHelperConfig) => {
return client return client
.collection(RPC_COLLECTION) .collection(RPC_COLLECTION)
.update<RpcFields<any, any>>(rpc.id, fields) .update<RpcFields<any, any>>(rpc.id, fields)
} },
) )
const setRpcStatus = safeCatch( const setRpcStatus = safeCatch(
@ -74,12 +74,12 @@ export const createRpcHelper = (config: RpcHelperConfig) => {
async ( async (
rpc: RpcFields<any, any>, rpc: RpcFields<any, any>,
status: RpcStatus, status: RpcStatus,
result: JsonObject = {} result: JsonObject = {},
) => { ) => {
return client return client
.collection(RPC_COLLECTION) .collection(RPC_COLLECTION)
.update(rpc.id, { status, result }) .update(rpc.id, { status, result })
} },
) )
return { return {

View File

@ -31,7 +31,7 @@ export const clientService = mkSingleton(async (cfg: ClientServiceConfig) => {
dbg(`Logged in`) dbg(`Logged in`)
} catch (e) { } catch (e) {
error( error(
`CANNOT AUTHENTICATE TO ${PUBLIC_APP_PROTOCOL}://${PUBLIC_APP_DB}.${PUBLIC_APP_DOMAIN}/_/` `CANNOT AUTHENTICATE TO ${PUBLIC_APP_PROTOCOL}://${PUBLIC_APP_DB}.${PUBLIC_APP_DOMAIN}/_/`,
) )
process.exit(-1) process.exit(-1)
} }

View File

@ -1,5 +1,3 @@
export * from './clientService/clientService'
export * from './clientService/PbClient'
export * from './FtpService/FtpService' export * from './FtpService/FtpService'
export * from './InstanceService/InstanceService' export * from './InstanceService/InstanceService'
export * from './PocketBaseService' export * from './PocketBaseService'
@ -7,3 +5,5 @@ export * from './ProxyService'
export * from './RealtimeLog' export * from './RealtimeLog'
export * from './RpcService/RpcService' export * from './RpcService/RpcService'
export * from './SqliteService/SqliteService' export * from './SqliteService/SqliteService'
export * from './clientService/PbClient'
export * from './clientService/clientService'

View File

@ -1,12 +1,12 @@
import { clientService } from '$services' import { clientService } from '$services'
import { import {
InstanceFields,
INSTANCE_COLLECTION, INSTANCE_COLLECTION,
InvocationFields,
INVOCATION_COLLECTION, INVOCATION_COLLECTION,
logger, InstanceFields,
RpcFields, InvocationFields,
RPC_COLLECTION, RPC_COLLECTION,
RpcFields,
logger,
singletonAsyncExecutionGuard, singletonAsyncExecutionGuard,
} from '@pockethost/common' } from '@pockethost/common'
import Bottleneck from 'bottleneck' import Bottleneck from 'bottleneck'
@ -17,7 +17,7 @@ export const deleteInvocation = singletonAsyncExecutionGuard(
const { client } = await clientService() const { client } = await clientService()
await client.client.collection(INVOCATION_COLLECTION).delete(invocation.id) await client.client.collection(INVOCATION_COLLECTION).delete(invocation.id)
}, },
(invocation) => `deleteInvocation:${invocation.id}` (invocation) => `deleteInvocation:${invocation.id}`,
) )
export const deleteInvocationsForInstance = singletonAsyncExecutionGuard( export const deleteInvocationsForInstance = singletonAsyncExecutionGuard(
@ -50,7 +50,7 @@ export const deleteInvocationsForInstance = singletonAsyncExecutionGuard(
} }
} }
}, },
(instance) => `deleteInvocationsForInstance:${instance.id}` (instance) => `deleteInvocationsForInstance:${instance.id}`,
) )
export const deleteRpc = singletonAsyncExecutionGuard( export const deleteRpc = singletonAsyncExecutionGuard(
@ -58,7 +58,7 @@ export const deleteRpc = singletonAsyncExecutionGuard(
const { client } = await clientService() const { client } = await clientService()
await client.client.collection(RPC_COLLECTION).delete(rpc.id) await client.client.collection(RPC_COLLECTION).delete(rpc.id)
}, },
(rpc) => `deleteRpc:${rpc.id}` (rpc) => `deleteRpc:${rpc.id}`,
) )
export const getAllRpcs = singletonAsyncExecutionGuard( export const getAllRpcs = singletonAsyncExecutionGuard(
@ -70,7 +70,7 @@ export const getAllRpcs = singletonAsyncExecutionGuard(
console.log(`Loaded rpcs`) console.log(`Loaded rpcs`)
return rpcs return rpcs
}, },
() => `getAllRpcs` () => `getAllRpcs`,
) )
export const deleteRpcsForInstance = singletonAsyncExecutionGuard( export const deleteRpcsForInstance = singletonAsyncExecutionGuard(
@ -80,7 +80,7 @@ export const deleteRpcsForInstance = singletonAsyncExecutionGuard(
const instanceRpcs = allRpcs.filter((rpc) => rpc.payload?.instanceId === id) const instanceRpcs = allRpcs.filter((rpc) => rpc.payload?.instanceId === id)
await Promise.all(instanceRpcs.map(deleteRpc)) await Promise.all(instanceRpcs.map(deleteRpc))
}, },
(instance) => `deleteRpcsForInstance:${instance.id}` (instance) => `deleteRpcsForInstance:${instance.id}`,
) )
export const deleteInstance = singletonAsyncExecutionGuard( export const deleteInstance = singletonAsyncExecutionGuard(
@ -95,7 +95,7 @@ export const deleteInstance = singletonAsyncExecutionGuard(
await deleteInvocationsForInstance(instance).catch((e) => { await deleteInvocationsForInstance(instance).catch((e) => {
console.error( console.error(
`deleteInvocationsForInstance error`, `deleteInvocationsForInstance error`,
JSON.stringify(e, null, 2) JSON.stringify(e, null, 2),
) )
throw e throw e
}) })
@ -110,7 +110,7 @@ export const deleteInstance = singletonAsyncExecutionGuard(
}) })
console.log(`Instance deleted ${id}`) console.log(`Instance deleted ${id}`)
}, },
(instance) => `deleteInstance:${instance.id}` (instance) => `deleteInstance:${instance.id}`,
) )
export const deleteInstancesByFilter = singletonAsyncExecutionGuard( export const deleteInstancesByFilter = singletonAsyncExecutionGuard(
@ -122,9 +122,9 @@ export const deleteInstancesByFilter = singletonAsyncExecutionGuard(
const limiter = new Bottleneck({ maxConcurrent: 50 }) const limiter = new Bottleneck({ maxConcurrent: 50 })
await Promise.all( await Promise.all(
instances.map((instance) => instances.map((instance) =>
limiter.schedule(() => deleteInstance(instance)) limiter.schedule(() => deleteInstance(instance)),
) ),
) )
}, },
(filter) => `deleteInstancesByFilter:${filter}` (filter) => `deleteInstancesByFilter:${filter}`,
) )

View File

@ -16,7 +16,7 @@ export const createCleanup = (context: { program: Command } & ContextBase) => {
.option( .option(
`-f, --filter <filter>`, `-f, --filter <filter>`,
`Filter to use when deleting instances`, `Filter to use when deleting instances`,
`stress-%` `stress-%`,
) )
.action(async () => { .action(async () => {
const options = cleanupCmd.optsWithGlobals<CleanupOptions>() const options = cleanupCmd.optsWithGlobals<CleanupOptions>()

View File

@ -38,7 +38,7 @@ export const createSeed = (context: { program: Command } & ContextBase) => {
`-c, --count`, `-c, --count`,
`Number of new seed instances to create`, `Number of new seed instances to create`,
parseInt, parseInt,
10 10,
) )
.action(async () => { .action(async () => {
const options = seedCmd.optsWithGlobals<SeedOptions>() const options = seedCmd.optsWithGlobals<SeedOptions>()

View File

@ -24,25 +24,25 @@ export const createStress = (context: { program: Command } & ContextBase) => {
'-ic, --instance-count <number>', '-ic, --instance-count <number>',
`Number of simultaneous instances to hit`, `Number of simultaneous instances to hit`,
parseInt, parseInt,
100 100,
) )
.option( .option(
'-rc, --requests-per-instance <number>', '-rc, --requests-per-instance <number>',
`Number of simultaneous requests per instance`, `Number of simultaneous requests per instance`,
parseInt, parseInt,
50 50,
) )
.option( .option(
'-mind, --min-delay <number>', '-mind, --min-delay <number>',
`Minimum number of milliseconds to delay before sending another request`, `Minimum number of milliseconds to delay before sending another request`,
parseInt, parseInt,
50 50,
) )
.option( .option(
'-maxd, --max-delay <number>', '-maxd, --max-delay <number>',
`Maximum number of milliseconds to delay before sending another request`, `Maximum number of milliseconds to delay before sending another request`,
parseInt, parseInt,
500 500,
) )
.action(async () => { .action(async () => {
const options = seedCmd.optsWithGlobals<StressOptions>() const options = seedCmd.optsWithGlobals<StressOptions>()
@ -63,7 +63,7 @@ export const createStress = (context: { program: Command } & ContextBase) => {
if (excluded[instanceId]) return if (excluded[instanceId]) return
await client.updateInstance(instanceId, { maintenance: false }) await client.updateInstance(instanceId, { maintenance: false })
}, },
(id) => `reset:${id}` (id) => `reset:${id}`,
) )
const instances = await client.getInstances() const instances = await client.getInstances()
@ -80,7 +80,7 @@ export const createStress = (context: { program: Command } & ContextBase) => {
dbg( dbg(
`There are ${instances.length} instances and ${ `There are ${instances.length} instances and ${
values(excluded).length values(excluded).length
} excluded` } excluded`,
) )
if (!instance) throw new Error(`No instance to grab`) if (!instance) throw new Error(`No instance to grab`)
@ -108,7 +108,7 @@ export const createStress = (context: { program: Command } & ContextBase) => {
return // Timeout return // Timeout
} }
} }
}) }),
) )
} }
} catch (e) { } catch (e) {

View File

@ -22,7 +22,7 @@ program
.option( .option(
'-u, --mothership-url', '-u, --mothership-url',
'URL to central database', 'URL to central database',
'http://127.0.0.1:8090' 'http://127.0.0.1:8090',
) )
createCleanup({ program, logger }) createCleanup({ program, logger })

View File

@ -7,7 +7,7 @@ import { dirname } from 'path'
export function assert<T>( export function assert<T>(
v: T | undefined | void | null, v: T | undefined | void | null,
msg?: string msg?: string,
): asserts v is T { ): asserts v is T {
if (!v) { if (!v) {
throw new Error(msg || `Assertion failure`) throw new Error(msg || `Assertion failure`)
@ -28,7 +28,7 @@ const downloadFile = async (url: string, path: string) => {
const _unsafe_downloadAndExtract = async ( const _unsafe_downloadAndExtract = async (
url: string, url: string,
binPath: string, binPath: string,
logger: Logger logger: Logger,
) => { ) => {
const { dbg, error } = logger.create('downloadAndExtract') const { dbg, error } = logger.create('downloadAndExtract')
@ -48,5 +48,5 @@ const _unsafe_downloadAndExtract = async (
export const downloadAndExtract = singletonAsyncExecutionGuard( export const downloadAndExtract = singletonAsyncExecutionGuard(
_unsafe_downloadAndExtract, _unsafe_downloadAndExtract,
(url) => url (url) => url,
) )

View File

@ -5,7 +5,7 @@ import { dirname } from 'path'
export const smartFetch = async <TRet>( export const smartFetch = async <TRet>(
url: string, url: string,
path: string path: string,
): Promise<TRet> => { ): Promise<TRet> => {
const { dbg } = logger().create(`smartFetch`) const { dbg } = logger().create(`smartFetch`)

View File

@ -40,7 +40,7 @@ export const tryFetch = async (url: string, config?: Partial<Config>) => {
resolve() resolve()
} catch (e) { } catch (e) {
dbg( dbg(
`Could not fetch ${url}, trying again in ${retryMs}ms. Raw error ${e}` `Could not fetch ${url}, trying again in ${retryMs}ms. Raw error ${e}`,
) )
setTimeout(tryFetch, retryMs) setTimeout(tryFetch, retryMs)
} }

View File

@ -250,7 +250,7 @@ export class EventSource extends EventTarget {
await new Promise<void>((res) => { await new Promise<void>((res) => {
const id = setTimeout( const id = setTimeout(
() => res(clearTimeout(id)), () => res(clearTimeout(id)),
this.#settings.reconnectionTime this.#settings.reconnectionTime,
) )
}) })

View File

@ -19,7 +19,7 @@ declare class EventSource {
constructor( constructor(
url: string, url: string,
eventSourceInitDict?: EventSource.EventSourceInitDict eventSourceInitDict?: EventSource.EventSourceInitDict,
) )
readonly CLOSED: number readonly CLOSED: number

View File

@ -23,7 +23,7 @@ export const init = (klass: typeof PocketBase) => {
const adminAuthWithPassword = async ( const adminAuthWithPassword = async (
login = ADMIN_LOGIN, login = ADMIN_LOGIN,
password = ADMIN_PASSWORD password = ADMIN_PASSWORD,
) => { ) => {
console.log(`Connecting to ${POCKETBASE_URL} with ${ADMIN_LOGIN}`) console.log(`Connecting to ${POCKETBASE_URL} with ${ADMIN_LOGIN}`)
await client.admins.authWithPassword(login, password) await client.admins.authWithPassword(login, password)

View File

@ -1,16 +0,0 @@
{
"useTabs": false,
"singleQuote": true,
"semi": false,
"trailingComma": "none",
"printWidth": 100,
"pluginSearchDirs": [".", "../.."],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}

View File

@ -10,7 +10,7 @@
</script> </script>
<div class="accordion-item"> <div class="accordion-item">
<h2 class="accordion-header " id={headerId}> <h2 class="accordion-header" id={headerId}>
<button <button
class="accordion-button {show ? '' : 'collapsed'} text-bg-{header} " class="accordion-button {show ? '' : 'collapsed'} text-bg-{header} "
type="button" type="button"

View File

@ -6,5 +6,5 @@ export enum AlertTypes {
Warning = 'warning', Warning = 'warning',
Info = 'info', Info = 'info',
Light = 'light', Light = 'light',
Dark = 'dark' Dark = 'dark',
} }

View File

@ -5,13 +5,13 @@ import Cookies from 'js-cookie'
// Set some default values to be referenced later // Set some default values to be referenced later
export enum ThemeNames { export enum ThemeNames {
Light = 'light', Light = 'light',
Dark = 'dark' Dark = 'dark',
} }
export const HLJS_THEMES = { export const HLJS_THEMES = {
[ThemeNames.Light]: [ThemeNames.Light]:
'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/default.min.css', 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/default.min.css',
[ThemeNames.Dark]: [ThemeNames.Dark]:
'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/a11y-dark.min.css' 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/a11y-dark.min.css',
} }
export const ALLOWED_THEMES: ThemeNames[] = [ThemeNames.Light, ThemeNames.Dark] export const ALLOWED_THEMES: ThemeNames[] = [ThemeNames.Light, ThemeNames.Dark]
export const DEFAULT_THEME: ThemeNames = ThemeNames.Light export const DEFAULT_THEME: ThemeNames = ThemeNames.Light
@ -19,7 +19,7 @@ export const STORAGE_NAME: string = 'theme'
export const THEME_ATTRIBUTE: string = 'data-bs-theme' export const THEME_ATTRIBUTE: string = 'data-bs-theme'
export const THEME_ICONS: { [_ in ThemeNames]: string } = { export const THEME_ICONS: { [_ in ThemeNames]: string } = {
[ThemeNames.Light]: 'bi bi-moon-stars', [ThemeNames.Light]: 'bi bi-moon-stars',
[ThemeNames.Dark]: 'bi bi-brightness-high' [ThemeNames.Dark]: 'bi bi-brightness-high',
} }
export const html = () => { export const html = () => {
@ -30,7 +30,8 @@ export const html = () => {
export const getCurrentTheme = () => { export const getCurrentTheme = () => {
const savedTheme = Cookies.get(STORAGE_NAME) const savedTheme = Cookies.get(STORAGE_NAME)
const currentTheme = find(ALLOWED_THEMES, (v) => savedTheme === v) || DEFAULT_THEME const currentTheme =
find(ALLOWED_THEMES, (v) => savedTheme === v) || DEFAULT_THEME
return currentTheme return currentTheme
} }

View File

@ -28,7 +28,9 @@ export const PUBLIC_DEBUG = envb('PUBLIC_DEBUG', dev)
export const PUBLIC_POCKETHOST_VERSION = base.version export const PUBLIC_POCKETHOST_VERSION = base.version
export const PUBLIC_ROUTES = publicRoutes.map((pattern) => new UrlPattern(pattern)) export const PUBLIC_ROUTES = publicRoutes.map(
(pattern) => new UrlPattern(pattern),
)
try { try {
logger() logger()

View File

@ -1,17 +1,17 @@
import { createGenericSyncEvent } from '$util/events' import { createGenericSyncEvent } from '$util/events'
import { fetchEventSource } from '@microsoft/fetch-event-source' import { fetchEventSource } from '@microsoft/fetch-event-source'
import { import {
assertExists,
CreateInstancePayloadSchema, CreateInstancePayloadSchema,
createRpcHelper,
createWatchHelper,
logger,
RenameInstancePayloadSchema, RenameInstancePayloadSchema,
RpcCommands, RpcCommands,
safeCatch,
SaveSecretsPayloadSchema, SaveSecretsPayloadSchema,
SaveVersionPayloadSchema, SaveVersionPayloadSchema,
SetInstanceMaintenancePayloadSchema, SetInstanceMaintenancePayloadSchema,
assertExists,
createRpcHelper,
createWatchHelper,
logger,
safeCatch,
type CreateInstancePayload, type CreateInstancePayload,
type CreateInstanceResult, type CreateInstanceResult,
type InstanceFields, type InstanceFields,
@ -26,7 +26,7 @@ import {
type SetInstanceMaintenancePayload, type SetInstanceMaintenancePayload,
type SetInstanceMaintenanceResult, type SetInstanceMaintenanceResult,
// gen:import // gen:import
type UserFields type UserFields,
} from '@pockethost/common' } from '@pockethost/common'
import { keys, map } from '@s-libs/micro-dash' import { keys, map } from '@s-libs/micro-dash'
import PocketBase, { import PocketBase, {
@ -34,7 +34,7 @@ import PocketBase, {
BaseAuthStore, BaseAuthStore,
ClientResponseError, ClientResponseError,
type RecordSubscription, type RecordSubscription,
type UnsubscribeFunc type UnsubscribeFunc,
} from 'pocketbase' } from 'pocketbase'
export type AuthChangeHandler = (user: BaseAuthStore) => void export type AuthChangeHandler = (user: BaseAuthStore) => void
@ -66,36 +66,45 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
const logOut = () => authStore.clear() const logOut = () => authStore.clear()
const createUser = safeCatch(`createUser`, _logger, (email: string, password: string) => const createUser = safeCatch(
client `createUser`,
.collection('users') _logger,
.create({ (email: string, password: string) =>
email, client
password, .collection('users')
passwordConfirm: password .create({
}) email,
.then(() => { password,
// dbg(`Sending verification email to ${email}`) passwordConfirm: password,
return client.collection('users').requestVerification(email) })
}) .then(() => {
// dbg(`Sending verification email to ${email}`)
return client.collection('users').requestVerification(email)
}),
) )
const confirmVerification = safeCatch(`confirmVerification`, _logger, (token: string) => const confirmVerification = safeCatch(
client `confirmVerification`,
.collection('users') _logger,
.confirmVerification(token) (token: string) =>
.then((response) => { client
return response .collection('users')
}) .confirmVerification(token)
.then((response) => {
return response
}),
) )
const requestPasswordReset = safeCatch(`requestPasswordReset`, _logger, (email: string) => const requestPasswordReset = safeCatch(
client `requestPasswordReset`,
.collection('users') _logger,
.requestPasswordReset(email) (email: string) =>
.then(() => { client
return true .collection('users')
}) .requestPasswordReset(email)
.then(() => {
return true
}),
) )
const requestPasswordResetConfirm = safeCatch( const requestPasswordResetConfirm = safeCatch(
@ -107,15 +116,18 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
.confirmPasswordReset(token, password, password) .confirmPasswordReset(token, password, password)
.then((response) => { .then((response) => {
return response return response
}) }),
) )
const authViaEmail = safeCatch(`authViaEmail`, _logger, (email: string, password: string) => const authViaEmail = safeCatch(
client.collection('users').authWithPassword(email, password) `authViaEmail`,
_logger,
(email: string, password: string) =>
client.collection('users').authWithPassword(email, password),
) )
const refreshAuthToken = safeCatch(`refreshAuthToken`, _logger, () => const refreshAuthToken = safeCatch(`refreshAuthToken`, _logger, () =>
client.collection('users').authRefresh() client.collection('users').authRefresh(),
) )
const watchHelper = createWatchHelper({ client }) const watchHelper = createWatchHelper({ client })
@ -125,27 +137,27 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
const createInstance = mkRpc<CreateInstancePayload, CreateInstanceResult>( const createInstance = mkRpc<CreateInstancePayload, CreateInstanceResult>(
RpcCommands.CreateInstance, RpcCommands.CreateInstance,
CreateInstancePayloadSchema CreateInstancePayloadSchema,
) )
const saveSecrets = mkRpc<SaveSecretsPayload, SaveSecretsResult>( const saveSecrets = mkRpc<SaveSecretsPayload, SaveSecretsResult>(
RpcCommands.SaveSecrets, RpcCommands.SaveSecrets,
SaveSecretsPayloadSchema SaveSecretsPayloadSchema,
) )
const saveVersion = mkRpc<SaveVersionPayload, SaveVersionResult>( const saveVersion = mkRpc<SaveVersionPayload, SaveVersionResult>(
RpcCommands.SaveVersion, RpcCommands.SaveVersion,
SaveVersionPayloadSchema SaveVersionPayloadSchema,
) )
const renameInstance = mkRpc<RenameInstancePayload, RenameInstanceResult>( const renameInstance = mkRpc<RenameInstancePayload, RenameInstanceResult>(
RpcCommands.RenameInstance, RpcCommands.RenameInstance,
RenameInstancePayloadSchema RenameInstancePayloadSchema,
) )
const setInstanceMaintenance = mkRpc<SetInstanceMaintenancePayload, SetInstanceMaintenanceResult>( const setInstanceMaintenance = mkRpc<
RpcCommands.SetInstanceMaintenance, SetInstanceMaintenancePayload,
SetInstanceMaintenancePayloadSchema SetInstanceMaintenanceResult
) >(RpcCommands.SetInstanceMaintenance, SetInstanceMaintenancePayloadSchema)
// gen:mkRpc // gen:mkRpc
@ -153,42 +165,56 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
`getInstanceById`, `getInstanceById`,
_logger, _logger,
(id: InstanceId): Promise<InstanceFields | undefined> => (id: InstanceId): Promise<InstanceFields | undefined> =>
client.collection('instances').getOne<InstanceFields>(id) client.collection('instances').getOne<InstanceFields>(id),
) )
const watchInstanceById = async ( const watchInstanceById = async (
id: InstanceId, id: InstanceId,
cb: (data: RecordSubscription<InstanceFields>) => void cb: (data: RecordSubscription<InstanceFields>) => void,
): Promise<UnsubscribeFunc> => watchById('instances', id, cb) ): Promise<UnsubscribeFunc> => watchById('instances', id, cb)
const getAllInstancesById = safeCatch(`getAllInstancesById`, _logger, async () => const getAllInstancesById = safeCatch(
(await client.collection('instances').getFullList()).reduce((c, v) => { `getAllInstancesById`,
c[v.id] = v as unknown as InstanceFields _logger,
return c async () =>
}, {} as { [_: InstanceId]: InstanceFields }) (await client.collection('instances').getFullList()).reduce(
(c, v) => {
c[v.id] = v as unknown as InstanceFields
return c
},
{} as { [_: InstanceId]: InstanceFields },
),
) )
const parseError = (e: Error): string[] => { const parseError = (e: Error): string[] => {
if (!(e instanceof ClientResponseError)) return [e.message] if (!(e instanceof ClientResponseError)) return [e.message]
if (e.data.message && keys(e.data.data).length === 0) return [e.data.message] if (e.data.message && keys(e.data.data).length === 0)
return map(e.data.data, (v, k) => (v ? v.message : undefined)).filter((v) => !!v) return [e.data.message]
return map(e.data.data, (v, k) => (v ? v.message : undefined)).filter(
(v) => !!v,
)
} }
const resendVerificationEmail = safeCatch(`resendVerificationEmail`, _logger, async () => { const resendVerificationEmail = safeCatch(
const user = client.authStore.model `resendVerificationEmail`,
assertExists(user, `Login required`) _logger,
await client.collection('users').requestVerification(user.email) async () => {
}) const user = client.authStore.model
assertExists(user, `Login required`)
await client.collection('users').requestVerification(user.email)
},
)
const getAuthStoreProps = (): AuthStoreProps => { const getAuthStoreProps = (): AuthStoreProps => {
const { token, model, isValid } = client.authStore as AuthStoreProps const { token, model, isValid } = client.authStore as AuthStoreProps
// dbg(`current authStore`, { token, model, isValid }) // dbg(`current authStore`, { token, model, isValid })
if (model instanceof Admin) throw new Error(`Admin models not supported`) if (model instanceof Admin) throw new Error(`Admin models not supported`)
if (model && !model.email) throw new Error(`Expected model to be a user here`) if (model && !model.email)
throw new Error(`Expected model to be a user here`)
return { return {
token, token,
model, model,
isValid isValid,
} }
} }
@ -196,7 +222,8 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
* Use synthetic event for authStore changers so we can broadcast just * Use synthetic event for authStore changers so we can broadcast just
* the props we want and not the actual authStore object. * the props we want and not the actual authStore object.
*/ */
const [onAuthChange, fireAuthChange] = createGenericSyncEvent<AuthStoreProps>() const [onAuthChange, fireAuthChange] =
createGenericSyncEvent<AuthStoreProps>()
/** /**
* This section is for initialization * This section is for initialization
@ -254,7 +281,7 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
const watchInstanceLog = ( const watchInstanceLog = (
instanceId: InstanceId, instanceId: InstanceId,
update: (log: InstanceLogFields) => void, update: (log: InstanceLogFields) => void,
nInitial = 100 nInitial = 100,
): (() => void) => { ): (() => void) => {
const { dbg, trace } = _logger.create('watchInstanceLog') const { dbg, trace } = _logger.create('watchInstanceLog')
const auth = client.authStore.exportToCookie() const auth = client.authStore.exportToCookie()
@ -266,12 +293,12 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
fetchEventSource(`${url}/logs`, { fetchEventSource(`${url}/logs`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
instanceId, instanceId,
n: nInitial, n: nInitial,
auth auth,
}), }),
onmessage: (event) => { onmessage: (event) => {
trace(`Got stream event`, event) trace(`Got stream event`, event)
@ -290,7 +317,7 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
setTimeout(continuallyFetchFromEventSource, 100) setTimeout(continuallyFetchFromEventSource, 100)
dbg(`Stream closed`) dbg(`Stream closed`)
}, },
signal signal,
}) })
} }
continuallyFetchFromEventSource() continuallyFetchFromEventSource()
@ -323,6 +350,6 @@ export const createPocketbaseClient = (config: PocketbaseClientConfig) => {
renameInstance, renameInstance,
setInstanceMaintenance, setInstanceMaintenance,
// gen:export // gen:export
saveVersion saveVersion,
} }
} }

View File

@ -1,7 +1,10 @@
import { browser } from '$app/environment' import { browser } from '$app/environment'
import { PUBLIC_APP_DB, PUBLIC_APP_DOMAIN } from '$src/env' import { PUBLIC_APP_DB, PUBLIC_APP_DOMAIN } from '$src/env'
import { logger } from '@pockethost/common' import { logger } from '@pockethost/common'
import { createPocketbaseClient, type PocketbaseClient } from './PocketbaseClient' import {
createPocketbaseClient,
type PocketbaseClient,
} from './PocketbaseClient'
export const client = (() => { export const client = (() => {
let clientInstance: PocketbaseClient | undefined let clientInstance: PocketbaseClient | undefined

View File

@ -23,14 +23,14 @@ function formatInput(input: SecretsArray): SecretsArray {
.map(({ name, value }, index) => ({ .map(({ name, value }, index) => ({
name, name,
value, value,
color: colorScale(index.toString()) color: colorScale(index.toString()),
})) }))
} }
const sanitize = (item: SecretItem) => { const sanitize = (item: SecretItem) => {
return { return {
name: item.name.toUpperCase().trim(), name: item.name.toUpperCase().trim(),
value: item.value.trim() value: item.value.trim(),
} }
} }
@ -54,8 +54,8 @@ function createItems(initialItems: SecretsArray) {
...n, ...n,
{ {
name, name,
value value,
} },
] ]
return formatInput(n) return formatInput(n)
}) })
@ -69,7 +69,7 @@ function createItems(initialItems: SecretsArray) {
n = [...n.slice(0, index), ...n.slice(index + 1)] n = [...n.slice(0, index), ...n.slice(index + 1)]
return formatInput(n) return formatInput(n)
}) })
} },
} }
} }

View File

@ -28,7 +28,7 @@ export const handleLogin = async (
email: string, email: string,
password: string, password: string,
setError?: FormErrorHandler, setError?: FormErrorHandler,
shouldRedirect: boolean = true shouldRedirect: boolean = true,
) => { ) => {
const { authViaEmail } = client() const { authViaEmail } = client()
// Reset the form error if the form is submitted // Reset the form error if the form is submitted
@ -42,7 +42,9 @@ export const handleLogin = async (
} }
} catch (error) { } catch (error) {
if (!(error instanceof Error)) { if (!(error instanceof Error)) {
throw new Error(`Expected Error type here, but got ${typeof error}:${error}`) throw new Error(
`Expected Error type here, but got ${typeof error}:${error}`,
)
} }
handleFormError(error, setError) handleFormError(error, setError)
} }
@ -57,7 +59,7 @@ export const handleLogin = async (
export const handleRegistration = async ( export const handleRegistration = async (
email: string, email: string,
password: string, password: string,
setError?: FormErrorHandler setError?: FormErrorHandler,
) => { ) => {
const { createUser } = client() const { createUser } = client()
// Reset the form error if the form is submitted // Reset the form error if the form is submitted
@ -75,7 +77,10 @@ export const handleRegistration = async (
* @param token {string} The token from the verification email * @param token {string} The token from the verification email
* @param setError {function} This can be used to show an alert bar if an error occurs during the login process * @param setError {function} This can be used to show an alert bar if an error occurs during the login process
*/ */
export const handleAccountConfirmation = async (token: string, setError?: FormErrorHandler) => { export const handleAccountConfirmation = async (
token: string,
setError?: FormErrorHandler,
) => {
const { confirmVerification } = client() const { confirmVerification } = client()
// Reset the form error if the form is submitted // Reset the form error if the form is submitted
setError?.('') setError?.('')
@ -98,7 +103,7 @@ export const handleAccountConfirmation = async (token: string, setError?: FormEr
*/ */
export const handleUnauthenticatedPasswordReset = async ( export const handleUnauthenticatedPasswordReset = async (
email: string, email: string,
setError?: FormErrorHandler setError?: FormErrorHandler,
) => { ) => {
const { requestPasswordReset } = client() const { requestPasswordReset } = client()
// Reset the form error if the form is submitted // Reset the form error if the form is submitted
@ -122,7 +127,7 @@ export const handleUnauthenticatedPasswordReset = async (
export const handleUnauthenticatedPasswordResetConfirm = async ( export const handleUnauthenticatedPasswordResetConfirm = async (
token: string, token: string,
password: string, password: string,
setError?: FormErrorHandler setError?: FormErrorHandler,
) => { ) => {
const { requestPasswordResetConfirm } = client() const { requestPasswordResetConfirm } = client()
// Reset the form error if the form is submitted // Reset the form error if the form is submitted
@ -141,7 +146,7 @@ export const handleUnauthenticatedPasswordResetConfirm = async (
export const handleCreateNewInstance = async ( export const handleCreateNewInstance = async (
instanceName: string, instanceName: string,
setError?: FormErrorHandler setError?: FormErrorHandler,
) => { ) => {
const { user, createInstance } = client() const { user, createInstance } = client()
// Get the newly created user id // Get the newly created user id
@ -154,7 +159,7 @@ export const handleCreateNewInstance = async (
// Create a new instance using the generated name // Create a new instance using the generated name
const record = await createInstance({ const record = await createInstance({
subdomain: instanceName subdomain: instanceName,
}) })
await goto(`/app/instances/${record.instance.id}`) await goto(`/app/instances/${record.instance.id}`)
@ -167,7 +172,7 @@ export const handleInstanceGeneratorWidget = async (
email: string, email: string,
password: string, password: string,
instanceName: string, instanceName: string,
setError = (value: string) => {} setError = (value: string) => {},
) => { ) => {
const { dbg, error, warn } = logger() const { dbg, error, warn } = logger()
@ -203,7 +208,7 @@ export const handleInstanceGeneratorWidget = async (
// If registration succeeds, login should always succeed. // If registration succeeds, login should always succeed.
// If a login fails at this point, the system is broken. // If a login fails at this point, the system is broken.
throw new Error( throw new Error(
`Login system is currently down. Please contact us so we can fix this.` `Login system is currently down. Please contact us so we can fix this.`,
) )
}) })
}) })
@ -247,7 +252,9 @@ export const handleInstanceGeneratorWidget = async (
} }
} }
export const handleResendVerificationEmail = async (setError = (value: string) => {}) => { export const handleResendVerificationEmail = async (
setError = (value: string) => {},
) => {
const { resendVerificationEmail } = client() const { resendVerificationEmail } = client()
try { try {
await resendVerificationEmail() await resendVerificationEmail()

View File

@ -4,7 +4,7 @@ export type Unsubscribe = () => void
export const createGenericAsyncEvent = <TPayload>(): [ export const createGenericAsyncEvent = <TPayload>(): [
(cb: (payload: TPayload) => Promise<void>) => Unsubscribe, (cb: (payload: TPayload) => Promise<void>) => Unsubscribe,
(payload: TPayload) => Promise<void> (payload: TPayload) => Promise<void>,
] => { ] => {
let i = 0 let i = 0
const callbacks: any = {} const callbacks: any = {}
@ -22,7 +22,7 @@ export const createGenericAsyncEvent = <TPayload>(): [
(c, cb) => { (c, cb) => {
return c.then(cb(payload)) return c.then(cb(payload))
}, },
Promise.resolve() Promise.resolve(),
) )
return [onEvent, fireEvent] return [onEvent, fireEvent]
@ -30,7 +30,7 @@ export const createGenericAsyncEvent = <TPayload>(): [
export const createGenericSyncEvent = <TPayload>(): [ export const createGenericSyncEvent = <TPayload>(): [
(cb: (payload: TPayload) => void) => Unsubscribe, (cb: (payload: TPayload) => void) => Unsubscribe,
(payload: TPayload) => void (payload: TPayload) => void,
] => { ] => {
let i = 0 let i = 0
const callbacks: any = {} const callbacks: any = {}

View File

@ -4,7 +4,11 @@ import type { AuthStoreProps } from '$src/pocketbase/PocketbaseClient'
import { logger } from '@pockethost/common' import { logger } from '@pockethost/common'
import { writable } from 'svelte/store' import { writable } from 'svelte/store'
export const authStoreState = writable<AuthStoreProps>({ isValid: false, model: null, token: '' }) export const authStoreState = writable<AuthStoreProps>({
isValid: false,
model: null,
token: '',
})
export const isUserLoggedIn = writable(false) export const isUserLoggedIn = writable(false)
export const isUserVerified = writable(false) export const isUserVerified = writable(false)
export const isAuthStateInitialized = writable(false) export const isAuthStateInitialized = writable(false)

View File

@ -6,8 +6,8 @@ import markedOptions from './marked.config.js'
const config: UserConfig = { const config: UserConfig = {
plugins: [markdown({ markedOptions }), sveltekit()], plugins: [markdown({ markedOptions }), sveltekit()],
optimizeDeps: { optimizeDeps: {
include: ['highlight.js', 'highlight.js/lib/core'] include: ['highlight.js', 'highlight.js/lib/core'],
} },
} }
export default config export default config

255
yarn.lock
View File

@ -31,6 +31,13 @@
chalk "^2.0.0" chalk "^2.0.0"
js-tokens "^4.0.0" js-tokens "^4.0.0"
"@babel/runtime@^7.21.0":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.15.tgz#38f46494ccf6cf020bd4eed7124b425e83e523b8"
integrity sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==
dependencies:
regenerator-runtime "^0.14.0"
"@dansvel/vite-plugin-markdown@^2.0.5": "@dansvel/vite-plugin-markdown@^2.0.5":
version "2.0.5" version "2.0.5"
resolved "https://registry.yarnpkg.com/@dansvel/vite-plugin-markdown/-/vite-plugin-markdown-2.0.5.tgz#55cff46adb457cb654b84a424aef2e25ca635926" resolved "https://registry.yarnpkg.com/@dansvel/vite-plugin-markdown/-/vite-plugin-markdown-2.0.5.tgz#55cff46adb457cb654b84a424aef2e25ca635926"
@ -1296,6 +1303,11 @@ aria-query@^5.3.0:
dependencies: dependencies:
dequal "^2.0.3" dequal "^2.0.3"
at-least-node@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
axobject-query@^3.2.1: axobject-query@^3.2.1:
version "3.2.1" version "3.2.1"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-3.2.1.tgz#39c378a6e3b06ca679f29138151e45b2b32da62a" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-3.2.1.tgz#39c378a6e3b06ca679f29138151e45b2b32da62a"
@ -1534,10 +1546,10 @@ chrome-trace-event@^1.0.2:
resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac" resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac"
integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg== integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==
ci-info@^2.0.0: ci-info@^3.7.0:
version "2.0.0" version "3.8.0"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.8.0.tgz#81408265a5380c929f0bc665d62256628ce9ef91"
integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== integrity sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==
clean-stack@^2.0.0: clean-stack@^2.0.0:
version "2.2.0" version "2.2.0"
@ -1651,20 +1663,20 @@ concat-map@0.0.1:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
concurrently@^7.4.0: concurrently@^8.2.1:
version "7.5.0" version "8.2.1"
resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-7.5.0.tgz#4dd432d4634a8251f27ab000c4974e78e3906bd3" resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-8.2.1.tgz#bcab9cacc38c23c503839583151e0fa96fd5b584"
integrity sha512-5E3mwiS+i2JYBzr5BpXkFxOnleZTMsG+WnE/dCG4/P+oiVXrbmrBwJ2ozn4SxwB2EZDrKR568X+puVohxz3/Mg== integrity sha512-nVraf3aXOpIcNud5pB9M82p1tynmZkrSGQ1p6X/VY8cJ+2LMVqAgXsJxYYefACSHbTYlm92O1xuhdGTjwoEvbQ==
dependencies: dependencies:
chalk "^4.1.0" chalk "^4.1.2"
date-fns "^2.29.1" date-fns "^2.30.0"
lodash "^4.17.21" lodash "^4.17.21"
rxjs "^7.0.0" rxjs "^7.8.1"
shell-quote "^1.7.3" shell-quote "^1.8.1"
spawn-command "^0.0.2-1" spawn-command "0.0.2"
supports-color "^8.1.0" supports-color "^8.1.1"
tree-kill "^1.2.2" tree-kill "^1.2.2"
yargs "^17.3.1" yargs "^17.7.2"
console-control-strings@^1.0.0, console-control-strings@^1.1.0: console-control-strings@^1.0.0, console-control-strings@^1.1.0:
version "1.1.0" version "1.1.0"
@ -1699,16 +1711,14 @@ cross-fetch@^3.1.5:
dependencies: dependencies:
node-fetch "2.6.7" node-fetch "2.6.7"
cross-spawn@^6.0.5: cross-spawn@^7.0.3:
version "6.0.5" version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
dependencies: dependencies:
nice-try "^1.0.4" path-key "^3.1.0"
path-key "^2.0.1" shebang-command "^2.0.0"
semver "^5.5.0" which "^2.0.1"
shebang-command "^1.2.0"
which "^1.2.9"
css-select@^4.1.3: css-select@^4.1.3:
version "4.3.0" version "4.3.0"
@ -1822,10 +1832,12 @@ data-uri-to-buffer@^4.0.0:
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b" resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz#b5db46aea50f6176428ac05b73be39a57701a64b"
integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA== integrity sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==
date-fns@^2.29.1, date-fns@^2.29.3: date-fns@^2.29.3, date-fns@^2.30.0:
version "2.29.3" version "2.30.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0"
integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA== integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==
dependencies:
"@babel/runtime" "^7.21.0"
debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.3.3, debug@^4.3.4: debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.3.3, debug@^4.3.4:
version "4.3.4" version "4.3.4"
@ -2524,14 +2536,15 @@ fs-constants@^1.0.0:
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==
fs-extra@^7.0.1: fs-extra@^9.0.0:
version "7.0.1" version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
dependencies: dependencies:
graceful-fs "^4.1.2" at-least-node "^1.0.0"
jsonfile "^4.0.0" graceful-fs "^4.2.0"
universalify "^0.1.0" jsonfile "^6.0.1"
universalify "^2.0.0"
fs-minipass@^2.0.0: fs-minipass@^2.0.0:
version "2.1.0" version "2.1.0"
@ -2693,7 +2706,7 @@ globrex@^0.1.2:
resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098"
integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==
graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.2.6: graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.6:
version "4.2.11" version "4.2.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
@ -2894,13 +2907,6 @@ is-builtin-module@^3.2.0:
dependencies: dependencies:
builtin-modules "^3.3.0" builtin-modules "^3.3.0"
is-ci@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c"
integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==
dependencies:
ci-info "^2.0.0"
is-core-module@^2.9.0: is-core-module@^2.9.0:
version "2.11.0" version "2.11.0"
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144"
@ -3024,18 +3030,32 @@ json-schema-traverse@^1.0.0:
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2"
integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==
json-stable-stringify@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.2.tgz#e06f23128e0bbe342dc996ed5a19e28b57b580e0"
integrity sha512-eunSSaEnxV12z+Z73y/j5N37/In40GK4GmsSy+tEHJMxknvqnA7/djeYtAgW0GsWHUfg+847WJjKaEylk2y09g==
dependencies:
jsonify "^0.0.1"
json5@^2.2.0, json5@^2.2.1: json5@^2.2.0, json5@^2.2.1:
version "2.2.1" version "2.2.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
jsonfile@^4.0.0: jsonfile@^6.0.1:
version "4.0.0" version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
dependencies:
universalify "^2.0.0"
optionalDependencies: optionalDependencies:
graceful-fs "^4.1.6" graceful-fs "^4.1.6"
jsonify@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978"
integrity sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==
klaw-sync@^6.0.0: klaw-sync@^6.0.0:
version "6.0.0" version "6.0.0"
resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c"
@ -3477,11 +3497,6 @@ negotiator@^0.6.2:
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==
nice-try@^1.0.4:
version "1.0.5"
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
node-addon-api@^3.2.1: node-addon-api@^3.2.1:
version "3.2.1" version "3.2.1"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161"
@ -3710,25 +3725,26 @@ parse-json@^5.0.0:
json-parse-even-better-errors "^2.3.0" json-parse-even-better-errors "^2.3.0"
lines-and-columns "^1.1.6" lines-and-columns "^1.1.6"
patch-package@^6.5.0: patch-package@^8.0.0:
version "6.5.0" version "8.0.0"
resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.5.0.tgz#feb058db56f0005da59cfa316488321de585e88a" resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-8.0.0.tgz#d191e2f1b6e06a4624a0116bcb88edd6714ede61"
integrity sha512-tC3EqJmo74yKqfsMzELaFwxOAu6FH6t+FzFOsnWAuARm7/n2xB5AOeOueE221eM9gtMuIKMKpF9tBy/X2mNP0Q== integrity sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==
dependencies: dependencies:
"@yarnpkg/lockfile" "^1.1.0" "@yarnpkg/lockfile" "^1.1.0"
chalk "^4.1.2" chalk "^4.1.2"
cross-spawn "^6.0.5" ci-info "^3.7.0"
cross-spawn "^7.0.3"
find-yarn-workspace-root "^2.0.0" find-yarn-workspace-root "^2.0.0"
fs-extra "^7.0.1" fs-extra "^9.0.0"
is-ci "^2.0.0" json-stable-stringify "^1.0.2"
klaw-sync "^6.0.0" klaw-sync "^6.0.0"
minimist "^1.2.6" minimist "^1.2.6"
open "^7.4.2" open "^7.4.2"
rimraf "^2.6.3" rimraf "^2.6.3"
semver "^5.6.0" semver "^7.5.3"
slash "^2.0.0" slash "^2.0.0"
tmp "^0.0.33" tmp "^0.0.33"
yaml "^1.10.2" yaml "^2.2.2"
path-exists@^3.0.0: path-exists@^3.0.0:
version "3.0.0" version "3.0.0"
@ -3750,10 +3766,10 @@ path-is-absolute@^1.0.0:
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==
path-key@^2.0.1: path-key@^3.1.0:
version "2.0.1" version "3.1.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
path-parse@^1.0.7: path-parse@^1.0.7:
version "1.0.7" version "1.0.7"
@ -3869,20 +3885,20 @@ postinstall-postinstall@^2.1.0:
resolved "https://registry.yarnpkg.com/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3" resolved "https://registry.yarnpkg.com/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3"
integrity sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ== integrity sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ==
prettier-plugin-organize-imports@^3.1.1: prettier-plugin-organize-imports@^3.2.3:
version "3.2.0" version "3.2.3"
resolved "https://registry.yarnpkg.com/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.0.tgz#d33d739109ae4108e02738b9d8f7eb2b29deae93" resolved "https://registry.yarnpkg.com/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-3.2.3.tgz#6b0141ac71f7ee9a673ce83e95456319e3a7cf0d"
integrity sha512-jeZ13YVKgXYCzkuwnoR6saKxJmdRYWMxS2G/su1V3qDWqTo1Q5iSoTblBxsXXAmomXfPqa/uA7YCK0/S86KLOQ== integrity sha512-KFvk8C/zGyvUaE3RvxN2MhCLwzV6OBbFSkwZ2OamCrs9ZY4i5L77jQ/w4UmUr+lqX8qbaqVq6bZZkApn+IgJSg==
prettier-plugin-svelte@^2.7.0: prettier-plugin-svelte@^3.0.3:
version "2.8.0" version "3.0.3"
resolved "https://registry.yarnpkg.com/prettier-plugin-svelte/-/prettier-plugin-svelte-2.8.0.tgz#e5681d9867c4ab584c0ccbe43c3684d132b389f2" resolved "https://registry.yarnpkg.com/prettier-plugin-svelte/-/prettier-plugin-svelte-3.0.3.tgz#a823295167f27dc71a4462ee6cb3da9f3f5ca2ea"
integrity sha512-QlXv/U3bUszks3XYDPsk1fsaQC+fo2lshwKbcbO+lrSVdJ+40mB1BfL8OCAk1W9y4pJxpqO/4gqm6NtF3zNGCw== integrity sha512-dLhieh4obJEK1hnZ6koxF+tMUrZbV5YGvRpf2+OADyanjya5j0z1Llo8iGwiHmFWZVG/hLEw/AJD5chXd9r3XA==
prettier@^2.7.1: prettier@^3.0.3:
version "2.7.1" version "3.0.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==
pretty-bytes@^6.0.0: pretty-bytes@^6.0.0:
version "6.0.0" version "6.0.0"
@ -3981,6 +3997,11 @@ regenerator-runtime@^0.13.7:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz#ed07b19616bcbec5da6274ebc75ae95634bfc2ee" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz#ed07b19616bcbec5da6274ebc75ae95634bfc2ee"
integrity sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw== integrity sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==
regenerator-runtime@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45"
integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==
replace-in-file@^7.0.1: replace-in-file@^7.0.1:
version "7.0.1" version "7.0.1"
resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-7.0.1.tgz#1bb69a2e5596341cc6f0f581309add6c1d364b71" resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-7.0.1.tgz#1bb69a2e5596341cc6f0f581309add6c1d364b71"
@ -4081,10 +4102,10 @@ run-parallel@^1.1.9:
dependencies: dependencies:
queue-microtask "^1.2.2" queue-microtask "^1.2.2"
rxjs@^7.0.0: rxjs@^7.8.1:
version "7.5.7" version "7.8.1"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543"
integrity sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA== integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==
dependencies: dependencies:
tslib "^2.1.0" tslib "^2.1.0"
@ -4141,7 +4162,7 @@ seek-bzip@^1.0.5:
dependencies: dependencies:
commander "^2.8.1" commander "^2.8.1"
semver@^5.5.0, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1: semver@^5.7.0, semver@^5.7.1:
version "5.7.1" version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
@ -4151,10 +4172,10 @@ semver@^6.0.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
semver@^7.3.5, semver@^7.3.8: semver@^7.3.5, semver@^7.3.8, semver@^7.5.3:
version "7.3.8" version "7.5.4"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
dependencies: dependencies:
lru-cache "^6.0.0" lru-cache "^6.0.0"
@ -4168,22 +4189,22 @@ set-cookie-parser@^2.6.0:
resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51" resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz#131921e50f62ff1a66a461d7d62d7b21d5d15a51"
integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ== integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==
shebang-command@^1.2.0: shebang-command@^2.0.0:
version "1.2.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg== integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
dependencies: dependencies:
shebang-regex "^1.0.0" shebang-regex "^3.0.0"
shebang-regex@^1.0.0: shebang-regex@^3.0.0:
version "1.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
shell-quote@^1.7.3: shell-quote@^1.8.1:
version "1.7.4" version "1.8.1"
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.4.tgz#33fe15dee71ab2a81fcbd3a52106c5cfb9fb75d8" resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680"
integrity sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw== integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==
signal-exit@^3.0.0, signal-exit@^3.0.7: signal-exit@^3.0.0, signal-exit@^3.0.7:
version "3.0.7" version "3.0.7"
@ -4259,10 +4280,10 @@ source-map@^0.6.0, source-map@^0.6.1:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
spawn-command@^0.0.2-1: spawn-command@0.0.2:
version "0.0.2-1" version "0.0.2"
resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0" resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2.tgz#9544e1a43ca045f8531aac1a48cb29bdae62338e"
integrity sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg== integrity sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==
sprintf-js@~1.0.2: sprintf-js@~1.0.2:
version "1.0.3" version "1.0.3"
@ -4376,7 +4397,7 @@ supports-color@^7.1.0:
dependencies: dependencies:
has-flag "^4.0.0" has-flag "^4.0.0"
supports-color@^8.1.0: supports-color@^8.1.1:
version "8.1.1" version "8.1.1"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
@ -4631,10 +4652,10 @@ unique-slug@^2.0.0:
dependencies: dependencies:
imurmurhash "^0.1.4" imurmurhash "^0.1.4"
universalify@^0.1.0: universalify@^2.0.0:
version "0.1.2" version "2.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
update-browserslist-db@^1.0.9: update-browserslist-db@^1.0.9:
version "1.0.10" version "1.0.10"
@ -4741,14 +4762,7 @@ which-module@^2.0.0:
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
integrity sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q== integrity sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==
which@^1.2.9: which@^2.0.1, which@^2.0.2:
version "1.3.1"
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==
dependencies:
isexe "^2.0.0"
which@^2.0.2:
version "2.0.2" version "2.0.2"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
@ -4819,11 +4833,16 @@ yallist@^4.0.0:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
yaml@^1.10.0, yaml@^1.10.2: yaml@^1.10.0:
version "1.10.2" version "1.10.2"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==
yaml@^2.2.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.2.tgz#f522db4313c671a0ca963a75670f1c12ea909144"
integrity sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==
yargs-parser@^13.1.2: yargs-parser@^13.1.2:
version "13.1.2" version "13.1.2"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38"
@ -4878,7 +4897,7 @@ yargs@^15.4.1:
y18n "^4.0.0" y18n "^4.0.0"
yargs-parser "^18.1.2" yargs-parser "^18.1.2"
yargs@^17.3.1, yargs@^17.7.2: yargs@^17.7.2:
version "17.7.2" version "17.7.2"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==