mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 12:21:57 +00:00
tyoe changes
This commit is contained in:
@@ -87,7 +87,7 @@ type PortOptionsByKnownProtocol =
|
|||||||
}
|
}
|
||||||
type PortOptionsByProtocol = PortOptionsByKnownProtocol | PortOptions
|
type PortOptionsByProtocol = PortOptionsByKnownProtocol | PortOptions
|
||||||
|
|
||||||
const hasStringProtocal = object({
|
const hasStringProtocol = object({
|
||||||
protocol: string,
|
protocol: string,
|
||||||
}).test
|
}).test
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ export class Host {
|
|||||||
internalPort: number,
|
internalPort: number,
|
||||||
options: PortOptionsByProtocol,
|
options: PortOptionsByProtocol,
|
||||||
): Promise<Origin<this>> {
|
): Promise<Origin<this>> {
|
||||||
if (hasStringProtocal(options)) {
|
if (hasStringProtocol(options)) {
|
||||||
return await this.bindPortForKnown(options, internalPort)
|
return await this.bindPortForKnown(options, internalPort)
|
||||||
} else {
|
} else {
|
||||||
return await this.bindPortForUnknown(internalPort, options)
|
return await this.bindPortForUnknown(internalPort, options)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ export class Origin<T extends Host> {
|
|||||||
options: this.options,
|
options: this.options,
|
||||||
suffix: `${path}${qp}`,
|
suffix: `${path}${qp}`,
|
||||||
username,
|
username,
|
||||||
scheme: this.options.scheme,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export function setupManifest<
|
|||||||
Id extends string,
|
Id extends string,
|
||||||
Version extends ManifestVersion,
|
Version extends ManifestVersion,
|
||||||
Dependencies extends Record<string, unknown>,
|
Dependencies extends Record<string, unknown>,
|
||||||
Volumes extends Record<string, unknown>,
|
Volumes extends string[],
|
||||||
Manifest extends SDKManifest & {
|
Manifest extends SDKManifest & {
|
||||||
dependencies: Dependencies
|
dependencies: Dependencies
|
||||||
id: Id
|
id: Id
|
||||||
|
|||||||
@@ -22,13 +22,9 @@ describe("mountDependencies", () => {
|
|||||||
short: "",
|
short: "",
|
||||||
long: "",
|
long: "",
|
||||||
},
|
},
|
||||||
assets: {
|
assets: [],
|
||||||
icon: "",
|
images: [],
|
||||||
instructions: "",
|
volumes: ["main"],
|
||||||
license: "",
|
|
||||||
},
|
|
||||||
containers: {},
|
|
||||||
volumes: { main: "data" },
|
|
||||||
alerts: {
|
alerts: {
|
||||||
install: null,
|
install: null,
|
||||||
update: null,
|
update: null,
|
||||||
@@ -55,15 +51,9 @@ describe("mountDependencies", () => {
|
|||||||
short: "",
|
short: "",
|
||||||
long: "",
|
long: "",
|
||||||
},
|
},
|
||||||
assets: {
|
assets: [],
|
||||||
icon: "",
|
images: [],
|
||||||
instructions: "",
|
volumes: ["main2"],
|
||||||
license: "",
|
|
||||||
},
|
|
||||||
containers: {},
|
|
||||||
volumes: {
|
|
||||||
main2: "data",
|
|
||||||
},
|
|
||||||
alerts: {
|
alerts: {
|
||||||
install: null,
|
install: null,
|
||||||
update: null,
|
update: null,
|
||||||
|
|||||||
@@ -20,13 +20,10 @@ export const sdk = StartSdk.of()
|
|||||||
short: "",
|
short: "",
|
||||||
long: "",
|
long: "",
|
||||||
},
|
},
|
||||||
assets: {
|
|
||||||
icon: "",
|
|
||||||
instructions: "",
|
|
||||||
license: "",
|
|
||||||
},
|
|
||||||
containers: {},
|
containers: {},
|
||||||
volumes: {},
|
images: [],
|
||||||
|
volumes: [],
|
||||||
|
assets: [],
|
||||||
alerts: {
|
alerts: {
|
||||||
install: null,
|
install: null,
|
||||||
update: null,
|
update: null,
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ export type Address = {
|
|||||||
hostId: string
|
hostId: string
|
||||||
options: PortOptions
|
options: PortOptions
|
||||||
suffix: string
|
suffix: string
|
||||||
scheme: string | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type InterfaceId = string
|
export type InterfaceId = string
|
||||||
|
|||||||
@@ -63,12 +63,14 @@ const negate =
|
|||||||
!fn(a)
|
!fn(a)
|
||||||
const unique = <A>(values: A[]) => Array.from(new Set(values))
|
const unique = <A>(values: A[]) => Array.from(new Set(values))
|
||||||
const addressHostToUrl = (
|
const addressHostToUrl = (
|
||||||
{ scheme, username, suffix }: Address,
|
{ options, username, suffix }: Address,
|
||||||
host: HostName,
|
host: HostName,
|
||||||
): UrlString =>
|
): UrlString => {
|
||||||
`${scheme ? `${scheme}//` : ""}${
|
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}@` : ""
|
username ? `${username}@` : ""
|
||||||
}${host}${suffix}`
|
}${host}${suffix}`
|
||||||
|
}
|
||||||
export const filledAddress = (
|
export const filledAddress = (
|
||||||
mapHostnames: {
|
mapHostnames: {
|
||||||
[hostId: string]: HostName[]
|
[hostId: string]: HostName[]
|
||||||
|
|||||||
Reference in New Issue
Block a user