mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 02:11:56 +00:00
feat: Update the type of the network interface to type
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Address, Effects } from "../types"
|
||||
import { NetworkInterfaceType } from "../util/utils"
|
||||
import { AddressReceipt } from "./AddressReceipt"
|
||||
import { Host } from "./Host"
|
||||
import { Origin } from "./Origin"
|
||||
@@ -23,7 +24,7 @@ export class NetworkInterfaceBuilder {
|
||||
description: string
|
||||
hasPrimary: boolean
|
||||
disabled: boolean
|
||||
ui: boolean
|
||||
type: NetworkInterfaceType
|
||||
username: null | string
|
||||
path: string
|
||||
search: Record<string, string>
|
||||
@@ -47,7 +48,7 @@ export class NetworkInterfaceBuilder {
|
||||
hasPrimary,
|
||||
disabled,
|
||||
id,
|
||||
ui,
|
||||
type,
|
||||
username,
|
||||
path,
|
||||
search,
|
||||
@@ -64,7 +65,7 @@ export class NetworkInterfaceBuilder {
|
||||
hasPrimary,
|
||||
disabled,
|
||||
addresses,
|
||||
ui,
|
||||
type,
|
||||
})
|
||||
|
||||
return addresses as Address[] & AddressReceipt
|
||||
|
||||
@@ -15,7 +15,7 @@ describe("host", () => {
|
||||
description: "A Foo",
|
||||
hasPrimary: false,
|
||||
disabled: false,
|
||||
ui: true,
|
||||
type: "ui",
|
||||
username: "bar",
|
||||
path: "/baz",
|
||||
search: { qux: "yes" },
|
||||
|
||||
@@ -3,6 +3,7 @@ import { InputSpec } from "./config/configTypes"
|
||||
import { DependenciesReceipt } from "./config/setupConfig"
|
||||
import { PortOptions } from "./interfaces/Host"
|
||||
import { UrlString } from "./util/getNetworkInterface"
|
||||
import { NetworkInterfaceType } from "./util/utils"
|
||||
|
||||
export type ExportedAction = (options: {
|
||||
effects: Effects
|
||||
@@ -186,10 +187,9 @@ export type NetworkInterface = {
|
||||
disabled: boolean
|
||||
/** All URIs */
|
||||
addresses: Address[]
|
||||
/** Defaults to false, but describes if this address can be opened in a browser as an
|
||||
* ui interface
|
||||
*/
|
||||
ui: boolean
|
||||
|
||||
/** The netowrk interface could be serveral types, something like ui, p2p, or network */
|
||||
type: NetworkInterfaceType
|
||||
}
|
||||
// prettier-ignore
|
||||
export type ExposeAllServicePaths<Store, PreviousPath extends string = ""> =
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Address, Effects, HostName, NetworkInterface } from "../types"
|
||||
import * as regexes from "./regexes"
|
||||
import { NetworkInterfaceType } from "./utils"
|
||||
|
||||
export type UrlString = string
|
||||
export type HostId = string
|
||||
@@ -45,10 +46,9 @@ export type NetworkInterfaceFilled = {
|
||||
disabled: boolean
|
||||
/** All URIs */
|
||||
addresses: FilledAddress[]
|
||||
/** Defaults to false, but describes if this address can be opened in a browser as an
|
||||
* ui interface
|
||||
*/
|
||||
ui: boolean
|
||||
|
||||
/** Indicates if we are a ui/ p2p/ api/ other for the kind of interface that this is representing */
|
||||
type: NetworkInterfaceType
|
||||
|
||||
primaryHostname: HostName | null
|
||||
primaryUrl: UrlString | null
|
||||
|
||||
@@ -43,6 +43,8 @@ const childProcess = {
|
||||
execFile: promisify(CP.execFile),
|
||||
}
|
||||
|
||||
export type NetworkInterfaceType = "ui" | "p2p" | "api" | "other"
|
||||
|
||||
export type Utils<Store, WrapperOverWrite = { const: never }> = {
|
||||
checkPortListening(
|
||||
port: number,
|
||||
@@ -68,7 +70,7 @@ export type Utils<Store, WrapperOverWrite = { const: never }> = {
|
||||
description: string
|
||||
hasPrimary: boolean
|
||||
disabled: boolean
|
||||
ui: boolean
|
||||
type: NetworkInterfaceType
|
||||
username: null | string
|
||||
path: string
|
||||
search: Record<string, string>
|
||||
@@ -128,7 +130,7 @@ export const utils = <Store = never, WrapperOverWrite = { const: never }>(
|
||||
description: string
|
||||
hasPrimary: boolean
|
||||
disabled: boolean
|
||||
ui: boolean
|
||||
type: NetworkInterfaceType
|
||||
username: null | string
|
||||
path: string
|
||||
search: Record<string, string>
|
||||
|
||||
Reference in New Issue
Block a user