Fix StartOS 0.4 TypeScript packaging to match SDK API
This commit is contained in:
+101
@@ -0,0 +1,101 @@
|
||||
import { Effects } from '../Effects';
|
||||
import { Origin } from './Origin';
|
||||
import { AddSslOptions } from '../osBindings';
|
||||
import { Security } from '../osBindings';
|
||||
import { BindOptions } from '../osBindings';
|
||||
import { AlpnInfo } from '../osBindings';
|
||||
export { AddSslOptions, Security, BindOptions };
|
||||
export declare const knownProtocols: {
|
||||
readonly http: {
|
||||
readonly secure: null;
|
||||
readonly defaultPort: 80;
|
||||
readonly withSsl: "https";
|
||||
readonly alpn: AlpnInfo;
|
||||
readonly addXForwardedHeaders: true;
|
||||
};
|
||||
readonly https: {
|
||||
readonly secure: {
|
||||
readonly ssl: true;
|
||||
};
|
||||
readonly defaultPort: 443;
|
||||
readonly addXForwardedHeaders: true;
|
||||
};
|
||||
readonly ws: {
|
||||
readonly secure: null;
|
||||
readonly defaultPort: 80;
|
||||
readonly withSsl: "wss";
|
||||
readonly alpn: AlpnInfo;
|
||||
readonly addXForwardedHeaders: true;
|
||||
};
|
||||
readonly wss: {
|
||||
readonly secure: {
|
||||
readonly ssl: true;
|
||||
};
|
||||
readonly defaultPort: 443;
|
||||
readonly addXForwardedHeaders: true;
|
||||
};
|
||||
readonly ssh: {
|
||||
readonly secure: {
|
||||
readonly ssl: false;
|
||||
};
|
||||
readonly defaultPort: 22;
|
||||
readonly addXForwardedHeaders: false;
|
||||
};
|
||||
readonly dns: {
|
||||
readonly secure: {
|
||||
readonly ssl: false;
|
||||
};
|
||||
readonly defaultPort: 53;
|
||||
readonly addXForwardedHeaders: false;
|
||||
};
|
||||
};
|
||||
export type Scheme = string | null;
|
||||
type KnownProtocols = typeof knownProtocols;
|
||||
type ProtocolsWithSslVariants = {
|
||||
[K in keyof KnownProtocols]: KnownProtocols[K] extends {
|
||||
withSsl: string;
|
||||
} ? K : never;
|
||||
}[keyof KnownProtocols];
|
||||
type NotProtocolsWithSslVariants = Exclude<keyof KnownProtocols, ProtocolsWithSslVariants>;
|
||||
type BindOptionsByKnownProtocol = {
|
||||
protocol: ProtocolsWithSslVariants;
|
||||
preferredExternalPort?: number;
|
||||
addSsl?: Partial<AddSslOptions>;
|
||||
} | {
|
||||
protocol: NotProtocolsWithSslVariants;
|
||||
preferredExternalPort?: number;
|
||||
addSsl?: AddSslOptions;
|
||||
};
|
||||
export type BindOptionsByProtocol = BindOptionsByKnownProtocol | (BindOptions & {
|
||||
protocol: null;
|
||||
});
|
||||
export declare class MultiHost {
|
||||
readonly options: {
|
||||
effects: Effects;
|
||||
id: string;
|
||||
};
|
||||
constructor(options: {
|
||||
effects: Effects;
|
||||
id: string;
|
||||
});
|
||||
/**
|
||||
* @description Use this function to bind the host to an internal port and configured options for protocol, security, and external port.
|
||||
*
|
||||
* @param internalPort - The internal port to be bound.
|
||||
* @param options - The protocol options for this binding.
|
||||
* @returns A multi-origin that is capable of exporting one or more service interfaces.
|
||||
* @example
|
||||
* In this example, we bind a previously created multi-host to port 80, then select the http protocol and request an external port of 8332.
|
||||
*
|
||||
* ```
|
||||
const uiMultiOrigin = await uiMulti.bindPort(80, {
|
||||
protocol: 'http',
|
||||
preferredExternalPort: 8332,
|
||||
})
|
||||
* ```
|
||||
*/
|
||||
bindPort(internalPort: number, options: BindOptionsByProtocol): Promise<Origin>;
|
||||
private bindPortForUnknown;
|
||||
private bindPortForKnown;
|
||||
private getSslProto;
|
||||
}
|
||||
Reference in New Issue
Block a user