mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
chore: bump sdk to beta.54, add device-info RPC, improve SDK abort handling and InputSpec filtering
- Bump SDK version to 0.4.0-beta.54 - Add `server.device-info` RPC endpoint and `s9pk select` CLI command - Extract `HardwareRequirements::is_compatible()` method, reuse in registry filtering - Add `AbortedError` class with `muteUnhandled` flag, replace generic abort errors - Handle unhandled promise rejections in container-runtime with mute support - Improve `InputSpec.filter()` with `keepByDefault` param and boolean filter values - Accept readonly tuples in `CommandType` and `splitCommand` - Remove `sync_host` calls from host API handlers (binding/address changes) - Filter mDNS hostnames by secure gateway availability - Derive mDNS enabled state from LAN IPs in web UI - Add "Open UI" action to address table, disable mDNS toggle - Hide debug details in service error component - Update rpc-toolkit docs for no-params handlers
This commit is contained in:
10
sdk/base/lib/util/AbortedError.ts
Normal file
10
sdk/base/lib/util/AbortedError.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export class AbortedError extends Error {
|
||||
readonly muteUnhandled = true as const
|
||||
declare cause?: unknown
|
||||
|
||||
constructor(message?: string, options?: { cause?: unknown }) {
|
||||
super(message)
|
||||
this.name = 'AbortedError'
|
||||
if (options?.cause !== undefined) this.cause = options.cause
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Effects } from '../Effects'
|
||||
import { AbortedError } from './AbortedError'
|
||||
import { DropGenerator, DropPromise } from './Drop'
|
||||
|
||||
export class GetOutboundGateway {
|
||||
@@ -38,7 +39,7 @@ export class GetOutboundGateway {
|
||||
})
|
||||
await waitForNext
|
||||
}
|
||||
return new Promise<never>((_, rej) => rej(new Error('aborted')))
|
||||
return new Promise<never>((_, rej) => rej(new AbortedError()))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Effects } from '../Effects'
|
||||
import * as T from '../types'
|
||||
import { AbortedError } from './AbortedError'
|
||||
import { DropGenerator, DropPromise } from './Drop'
|
||||
|
||||
export class GetSystemSmtp {
|
||||
@@ -39,7 +40,7 @@ export class GetSystemSmtp {
|
||||
})
|
||||
await waitForNext
|
||||
}
|
||||
return new Promise<never>((_, rej) => rej(new Error('aborted')))
|
||||
return new Promise<never>((_, rej) => rej(new AbortedError()))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
HostnameInfo,
|
||||
} from '../types'
|
||||
import { Effects } from '../Effects'
|
||||
import { AbortedError } from './AbortedError'
|
||||
import { DropGenerator, DropPromise } from './Drop'
|
||||
import { IpAddress, IPV6_LINK_LOCAL } from './ip'
|
||||
import { deepEqual } from './deepEqual'
|
||||
@@ -394,7 +395,7 @@ export class GetServiceInterface<Mapped = ServiceInterfaceFilled | null> {
|
||||
}
|
||||
await waitForNext
|
||||
}
|
||||
return new Promise<never>((_, rej) => rej(new Error('aborted')))
|
||||
return new Promise<never>((_, rej) => rej(new AbortedError()))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Effects } from '../Effects'
|
||||
import { PackageId } from '../osBindings'
|
||||
import { AbortedError } from './AbortedError'
|
||||
import { deepEqual } from './deepEqual'
|
||||
import { DropGenerator, DropPromise } from './Drop'
|
||||
import { ServiceInterfaceFilled, filledAddress } from './getServiceInterface'
|
||||
@@ -105,7 +106,7 @@ export class GetServiceInterfaces<Mapped = ServiceInterfaceFilled[]> {
|
||||
}
|
||||
await waitForNext
|
||||
}
|
||||
return new Promise<never>((_, rej) => rej(new Error('aborted')))
|
||||
return new Promise<never>((_, rej) => rej(new AbortedError()))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,5 +22,6 @@ export { splitCommand } from './splitCommand'
|
||||
export { nullIfEmpty } from './nullIfEmpty'
|
||||
export { deepMerge, partialDiff } from './deepMerge'
|
||||
export { deepEqual } from './deepEqual'
|
||||
export { AbortedError } from './AbortedError'
|
||||
export * as regexes from './regexes'
|
||||
export { stringFromStdErrOut } from './stringFromStdErrOut'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { AllowReadonly } from '../types'
|
||||
|
||||
/**
|
||||
* Normalizes a command into an argv-style string array.
|
||||
* If given a string, wraps it as `["sh", "-c", command]`.
|
||||
@@ -13,8 +15,8 @@
|
||||
* ```
|
||||
*/
|
||||
export const splitCommand = (
|
||||
command: string | [string, ...string[]],
|
||||
command: string | AllowReadonly<[string, ...string[]]>,
|
||||
): string[] => {
|
||||
if (Array.isArray(command)) return command
|
||||
return ['sh', '-c', command]
|
||||
return ['sh', '-c', command as string]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user