mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
rename some things in the sdk (#2809)
* rename some things in the sdk * fix docs * rename some types exported from rust
This commit is contained in:
@@ -215,18 +215,14 @@ export class StartSdk<Manifest extends T.SDKManifest, Store> {
|
||||
}),
|
||||
},
|
||||
|
||||
host: {
|
||||
// static: (effects: Effects, id: string) =>
|
||||
// new StaticHost({ id, effects }),
|
||||
// single: (effects: Effects, id: string) =>
|
||||
// new SingleHost({ id, effects }),
|
||||
multi: (effects: Effects, id: string) => new MultiHost({ id, effects }),
|
||||
MultiHost: {
|
||||
of: (effects: Effects, id: string) => new MultiHost({ id, effects }),
|
||||
},
|
||||
nullIfEmpty,
|
||||
runCommand: async <A extends string>(
|
||||
effects: Effects,
|
||||
image: {
|
||||
id: keyof Manifest["images"] & T.ImageId
|
||||
imageId: keyof Manifest["images"] & T.ImageId
|
||||
sharedRun?: boolean
|
||||
},
|
||||
command: T.CommandType,
|
||||
@@ -548,7 +544,7 @@ export class StartSdk<Manifest extends T.SDKManifest, Store> {
|
||||
inputSpecSpec,
|
||||
async ({ effects, input }) => {
|
||||
// ** UI multi-host **
|
||||
const uiMulti = sdk.host.multi(effects, 'ui-multi')
|
||||
const uiMulti = sdk.MultiHost.of(effects, 'ui-multi')
|
||||
const uiMultiOrigin = await uiMulti.bindPort(80, {
|
||||
protocol: 'http',
|
||||
})
|
||||
@@ -580,7 +576,7 @@ export class StartSdk<Manifest extends T.SDKManifest, Store> {
|
||||
const uiReceipt = await uiMultiOrigin.export([primaryUi, adminUi])
|
||||
|
||||
// ** API multi-host **
|
||||
const apiMulti = sdk.host.multi(effects, 'api-multi')
|
||||
const apiMulti = sdk.MultiHost.of(effects, 'api-multi')
|
||||
const apiMultiOrigin = await apiMulti.bindPort(5959, {
|
||||
protocol: 'http',
|
||||
})
|
||||
@@ -685,7 +681,7 @@ export class StartSdk<Manifest extends T.SDKManifest, Store> {
|
||||
of(
|
||||
effects: Effects,
|
||||
image: {
|
||||
id: T.ImageId & keyof Manifest["images"]
|
||||
imageId: T.ImageId & keyof Manifest["images"]
|
||||
sharedRun?: boolean
|
||||
},
|
||||
name: string,
|
||||
@@ -1414,7 +1410,7 @@ export class StartSdk<Manifest extends T.SDKManifest, Store> {
|
||||
|
||||
export async function runCommand<Manifest extends T.SDKManifest>(
|
||||
effects: Effects,
|
||||
image: { id: keyof Manifest["images"] & T.ImageId; sharedRun?: boolean },
|
||||
image: { imageId: keyof Manifest["images"] & T.ImageId; sharedRun?: boolean },
|
||||
command: string | [string, ...string[]],
|
||||
options: CommandOptions & {
|
||||
mounts?: { path: string; options: MountOptions }[]
|
||||
|
||||
@@ -23,7 +23,7 @@ export class CommandController {
|
||||
effects: T.Effects,
|
||||
subcontainer:
|
||||
| {
|
||||
id: keyof Manifest["images"] & T.ImageId
|
||||
imageId: keyof Manifest["images"] & T.ImageId
|
||||
sharedRun?: boolean
|
||||
}
|
||||
| SubContainer,
|
||||
|
||||
@@ -22,7 +22,7 @@ export class Daemon {
|
||||
effects: T.Effects,
|
||||
subcontainer:
|
||||
| {
|
||||
id: keyof Manifest["images"] & T.ImageId
|
||||
imageId: keyof Manifest["images"] & T.ImageId
|
||||
sharedRun?: boolean
|
||||
}
|
||||
| SubContainer,
|
||||
|
||||
@@ -53,7 +53,7 @@ type DaemonsParams<
|
||||
subcontainer:
|
||||
| {
|
||||
/** The ID of the image. Must be one of the image IDs declared in the manifest */
|
||||
id: keyof Manifest["images"] & T.ImageId
|
||||
imageId: keyof Manifest["images"] & T.ImageId
|
||||
/**
|
||||
* Whether or not to share the `/run` directory with the parent container.
|
||||
* This is useful if you are trying to connect to a service that exposes a unix domain socket or auth cookie via the `/run` directory
|
||||
|
||||
@@ -5,7 +5,7 @@ import { sdk } from "../test/output.sdk"
|
||||
describe("host", () => {
|
||||
test("Testing that the types work", () => {
|
||||
async function test(effects: Effects) {
|
||||
const foo = sdk.host.multi(effects, "foo")
|
||||
const foo = sdk.MultiHost.of(effects, "foo")
|
||||
const fooOrigin = await foo.bindPort(80, {
|
||||
protocol: "http" as const,
|
||||
preferredExternalPort: 80,
|
||||
|
||||
@@ -86,12 +86,12 @@ export class SubContainer implements ExecSpawnable {
|
||||
}
|
||||
static async of(
|
||||
effects: T.Effects,
|
||||
image: { id: T.ImageId; sharedRun?: boolean },
|
||||
image: { imageId: T.ImageId; sharedRun?: boolean },
|
||||
name: string,
|
||||
) {
|
||||
const { id, sharedRun } = image
|
||||
const { imageId, sharedRun } = image
|
||||
const [rootfs, guid] = await effects.subcontainer.createFs({
|
||||
imageId: id as string,
|
||||
imageId,
|
||||
name,
|
||||
})
|
||||
|
||||
@@ -111,12 +111,12 @@ export class SubContainer implements ExecSpawnable {
|
||||
await execFile("mount", ["--rbind", from, to])
|
||||
}
|
||||
|
||||
return new SubContainer(effects, id, rootfs, guid)
|
||||
return new SubContainer(effects, imageId, rootfs, guid)
|
||||
}
|
||||
|
||||
static async with<T>(
|
||||
effects: T.Effects,
|
||||
image: { id: T.ImageId; sharedRun?: boolean },
|
||||
image: { imageId: T.ImageId; sharedRun?: boolean },
|
||||
mounts: { options: MountOptions; path: string }[],
|
||||
name: string,
|
||||
fn: (subContainer: SubContainer) => Promise<T>,
|
||||
|
||||
4
sdk/package/package-lock.json
generated
4
sdk/package/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.3.6-beta.3",
|
||||
"version": "0.3.6-beta.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.3.6-beta.3",
|
||||
"version": "0.3.6-beta.4",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@iarna/toml": "^2.2.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.3.6-beta.3",
|
||||
"version": "0.3.6-beta.4",
|
||||
"description": "Software development kit to facilitate packaging services for StartOS",
|
||||
"main": "./package/lib/index.js",
|
||||
"types": "./package/lib/index.d.ts",
|
||||
|
||||
Reference in New Issue
Block a user