From 009f79e2898d59c63eb23ab0c2afd200467cc71d Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 18 Jan 2024 16:12:37 -0700 Subject: [PATCH] tyoe changes --- lib/interfaces/Host.ts | 4 ++-- lib/interfaces/Origin.ts | 1 - lib/manifest/setupManifest.ts | 2 +- lib/test/mountDependencies.test.ts | 22 ++++++---------------- lib/test/output.sdk.ts | 9 +++------ lib/types.ts | 1 - lib/util/getNetworkInterface.ts | 8 +++++--- 7 files changed, 17 insertions(+), 30 deletions(-) diff --git a/lib/interfaces/Host.ts b/lib/interfaces/Host.ts index 41577cf..190769d 100644 --- a/lib/interfaces/Host.ts +++ b/lib/interfaces/Host.ts @@ -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> { - if (hasStringProtocal(options)) { + if (hasStringProtocol(options)) { return await this.bindPortForKnown(options, internalPort) } else { return await this.bindPortForUnknown(internalPort, options) diff --git a/lib/interfaces/Origin.ts b/lib/interfaces/Origin.ts index 7feab28..08ad3f8 100644 --- a/lib/interfaces/Origin.ts +++ b/lib/interfaces/Origin.ts @@ -18,7 +18,6 @@ export class Origin { options: this.options, suffix: `${path}${qp}`, username, - scheme: this.options.scheme, } } } diff --git a/lib/manifest/setupManifest.ts b/lib/manifest/setupManifest.ts index 4dd7ff5..071c817 100644 --- a/lib/manifest/setupManifest.ts +++ b/lib/manifest/setupManifest.ts @@ -4,7 +4,7 @@ export function setupManifest< Id extends string, Version extends ManifestVersion, Dependencies extends Record, - Volumes extends Record, + Volumes extends string[], Manifest extends SDKManifest & { dependencies: Dependencies id: Id diff --git a/lib/test/mountDependencies.test.ts b/lib/test/mountDependencies.test.ts index 7c84c7e..6de66d4 100644 --- a/lib/test/mountDependencies.test.ts +++ b/lib/test/mountDependencies.test.ts @@ -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, diff --git a/lib/test/output.sdk.ts b/lib/test/output.sdk.ts index 5cf2374..e69ef2a 100644 --- a/lib/test/output.sdk.ts +++ b/lib/test/output.sdk.ts @@ -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, diff --git a/lib/types.ts b/lib/types.ts index c9a80f2..64c9254 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -170,7 +170,6 @@ export type Address = { hostId: string options: PortOptions suffix: string - scheme: string | null } export type InterfaceId = string diff --git a/lib/util/getNetworkInterface.ts b/lib/util/getNetworkInterface.ts index 9e26c46..7dcb8c5 100644 --- a/lib/util/getNetworkInterface.ts +++ b/lib/util/getNetworkInterface.ts @@ -63,12 +63,14 @@ const negate = !fn(a) const unique = (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[]