tyoe changes

This commit is contained in:
Matt Hill
2024-01-18 16:12:37 -07:00
parent 27127f58d4
commit 009f79e289
7 changed files with 17 additions and 30 deletions

View File

@@ -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)

View File

@@ -18,7 +18,6 @@ export class Origin<T extends Host> {
options: this.options,
suffix: `${path}${qp}`,
username,
scheme: this.options.scheme,
}
}
}

View File

@@ -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

View File

@@ -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,

View File

@@ -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,

View File

@@ -170,7 +170,6 @@ export type Address = {
hostId: string
options: PortOptions
suffix: string
scheme: string | null
}
export type InterfaceId = string

View File

@@ -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[]