mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 10:21:55 +00:00
beta4
This commit is contained in:
@@ -196,7 +196,7 @@ export class StartSdk<Manifest extends SDKManifest, Store> {
|
||||
setupMain: (
|
||||
fn: (o: {
|
||||
effects: Effects
|
||||
started(onTerm: () => void): null
|
||||
started(onTerm: () => PromiseLike<void>): PromiseLike<void>
|
||||
utils: Utils<Manifest, Store, {}>
|
||||
}) => Promise<Daemons<Manifest, any>>,
|
||||
) => setupMain<Manifest, Store>(fn),
|
||||
|
||||
@@ -17,28 +17,28 @@ export type ValueSpec = ValueSpecOf<ValueType>
|
||||
export type ValueSpecOf<T extends ValueType> = T extends "text"
|
||||
? ValueSpecText
|
||||
: T extends "textarea"
|
||||
? ValueSpecTextarea
|
||||
: T extends "number"
|
||||
? ValueSpecNumber
|
||||
: T extends "color"
|
||||
? ValueSpecColor
|
||||
: T extends "datetime"
|
||||
? ValueSpecDatetime
|
||||
: T extends "toggle"
|
||||
? ValueSpecToggle
|
||||
: T extends "select"
|
||||
? ValueSpecSelect
|
||||
: T extends "multiselect"
|
||||
? ValueSpecMultiselect
|
||||
: T extends "list"
|
||||
? ValueSpecList
|
||||
: T extends "object"
|
||||
? ValueSpecObject
|
||||
: T extends "file"
|
||||
? ValueSpecFile
|
||||
: T extends "union"
|
||||
? ValueSpecUnion
|
||||
: never
|
||||
? ValueSpecTextarea
|
||||
: T extends "number"
|
||||
? ValueSpecNumber
|
||||
: T extends "color"
|
||||
? ValueSpecColor
|
||||
: T extends "datetime"
|
||||
? ValueSpecDatetime
|
||||
: T extends "toggle"
|
||||
? ValueSpecToggle
|
||||
: T extends "select"
|
||||
? ValueSpecSelect
|
||||
: T extends "multiselect"
|
||||
? ValueSpecMultiselect
|
||||
: T extends "list"
|
||||
? ValueSpecList
|
||||
: T extends "object"
|
||||
? ValueSpecObject
|
||||
: T extends "file"
|
||||
? ValueSpecFile
|
||||
: T extends "union"
|
||||
? ValueSpecUnion
|
||||
: never
|
||||
|
||||
export interface ValueSpecText extends ListValueSpecText, WithStandalone {
|
||||
required: boolean
|
||||
@@ -164,10 +164,10 @@ export type ListValueSpecType = "text" | "number" | "object"
|
||||
export type ListValueSpecOf<T extends ListValueSpecType> = T extends "text"
|
||||
? ListValueSpecText
|
||||
: T extends "number"
|
||||
? ListValueSpecNumber
|
||||
: T extends "object"
|
||||
? ListValueSpecObject
|
||||
: never
|
||||
? ListValueSpecNumber
|
||||
: T extends "object"
|
||||
? ListValueSpecObject
|
||||
: never
|
||||
/** represents a spec for a list */
|
||||
export type ValueSpecList = ValueSpecListOf<ListValueSpecType>
|
||||
export interface ValueSpecListOf<T extends ListValueSpecType>
|
||||
|
||||
@@ -2,7 +2,10 @@ import { Address } from "../types"
|
||||
import { Host, PortOptions } from "./Host"
|
||||
|
||||
export class Origin<T extends Host> {
|
||||
constructor(readonly host: T, readonly options: PortOptions) {}
|
||||
constructor(
|
||||
readonly host: T,
|
||||
readonly options: PortOptions,
|
||||
) {}
|
||||
|
||||
build({ username, path, search }: BuildOptions): Address {
|
||||
const qpEntries = Object.entries(search)
|
||||
|
||||
@@ -123,7 +123,7 @@ export class Daemons<Manifest extends SDKManifest, Ids extends string> {
|
||||
({
|
||||
status: "failing",
|
||||
message: "message" in err ? err.message : String(err),
|
||||
} as CheckResult),
|
||||
}) as CheckResult,
|
||||
)
|
||||
currentInput.lastResult = response.status || null
|
||||
if (!currentInput.hadSuccess && response.status === "passing") {
|
||||
|
||||
@@ -21,7 +21,7 @@ import { SDKManifest } from "../manifest/ManifestTypes"
|
||||
export const setupMain = <Manifest extends SDKManifest, Store>(
|
||||
fn: (o: {
|
||||
effects: Effects
|
||||
started(onTerm: () => void): null
|
||||
started(onTerm: () => PromiseLike<void>): PromiseLike<void>
|
||||
utils: Utils<Manifest, Store, {}>
|
||||
}) => Promise<Daemons<Manifest, any>>,
|
||||
): ExpectedExports.main => {
|
||||
@@ -30,6 +30,6 @@ export const setupMain = <Manifest extends SDKManifest, Store>(
|
||||
...options,
|
||||
utils: createMainUtils<Manifest, Store>(options.effects),
|
||||
})
|
||||
await result.build().then((x) => x.wait())
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export namespace ExpectedExports {
|
||||
*/
|
||||
export type main = (options: {
|
||||
effects: Effects
|
||||
started(onTerm: () => Promise<void>): Promise<void>
|
||||
started(onTerm: () => PromiseLike<void>): PromiseLike<void>
|
||||
}) => Promise<Daemons<any, any>>
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,10 @@ import { Buffer } from "node:buffer"
|
||||
export const execFile = promisify(cp.execFile)
|
||||
|
||||
export class Overlay {
|
||||
private constructor(readonly effects: T.Effects, readonly rootfs: string) {}
|
||||
private constructor(
|
||||
readonly effects: T.Effects,
|
||||
readonly rootfs: string,
|
||||
) {}
|
||||
static async of(effects: T.Effects, imageId: string) {
|
||||
const rootfs = await effects.createOverlayedImage({ imageId })
|
||||
|
||||
|
||||
@@ -66,7 +66,11 @@ const addressHostToUrl = (
|
||||
{ options, username, suffix }: Address,
|
||||
host: HostName,
|
||||
): UrlString => {
|
||||
const scheme = host.endsWith('.onion') ? options.scheme : (options.addSsl ? options.addSsl.scheme : options.scheme) // TODO: encode whether hostname transport is "secure"?
|
||||
const scheme = host.endsWith(".onion")
|
||||
? options.scheme
|
||||
: options.addSsl
|
||||
? options.addSsl.scheme
|
||||
: options.scheme // TODO: encode whether hostname transport is "secure"?
|
||||
return `${scheme ? `${scheme}//` : ""}${
|
||||
username ? `${username}@` : ""
|
||||
}${host}${suffix}`
|
||||
|
||||
Reference in New Issue
Block a user