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