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