mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
chore: Update the types
This commit is contained in:
@@ -26,12 +26,7 @@ export function setupInit<Manifest extends SDKManifest, Store>(
|
||||
})
|
||||
const { services, ui } = await setupExports(opts)
|
||||
await opts.effects.exposeForDependents(services)
|
||||
await opts.effects.exposeUi(
|
||||
forExpose({
|
||||
type: "object",
|
||||
value: ui,
|
||||
}),
|
||||
)
|
||||
await opts.effects.exposeUi(forExpose(ui))
|
||||
},
|
||||
uninit: async (opts) => {
|
||||
await migrations.uninit(opts)
|
||||
@@ -39,14 +34,23 @@ export function setupInit<Manifest extends SDKManifest, Store>(
|
||||
},
|
||||
}
|
||||
}
|
||||
function forExpose<Store>(ui: { [key: string]: ExposeUiPaths<Store> }) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(ui).map(([key, value]) => [key, forExpose_(value)]),
|
||||
)
|
||||
}
|
||||
|
||||
function forExpose<Store>(ui: ExposeUiPaths<Store>): ExposeUiPathsAll {
|
||||
function forExpose_<Store>(ui: ExposeUiPaths<Store>): ExposeUiPathsAll {
|
||||
if (ui.type === ("object" as const)) {
|
||||
return {
|
||||
type: "object" as const,
|
||||
value: Object.fromEntries(
|
||||
Object.entries(ui.value).map(([key, value]) => [key, forExpose(value)]),
|
||||
Object.entries(ui.value).map(([key, value]) => [
|
||||
key,
|
||||
forExpose_(value),
|
||||
]),
|
||||
),
|
||||
description: ui.description ?? null,
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -24,6 +24,7 @@ import { ExportActionParams } from "../../../core/startos/bindings/ExportActionP
|
||||
import { RemoveActionParams } from "../../../core/startos/bindings/RemoveActionParams"
|
||||
import { ReverseProxyParams } from "../../../core/startos/bindings/ReverseProxyParams"
|
||||
import { MountParams } from "../../../core/startos/bindings/MountParams"
|
||||
import { ExposedUI } from "../../../core/startos/bindings/ExposedUI"
|
||||
function typeEquality<ExpectedType>(_a: ExpectedType) {}
|
||||
describe("startosTypeValidation ", () => {
|
||||
test(`checking the params match`, () => {
|
||||
@@ -48,7 +49,7 @@ describe("startosTypeValidation ", () => {
|
||||
setConfigured: {} as SetConfigured,
|
||||
setHealth: {} as SetHealth,
|
||||
exposeForDependents: {} as ExposeForDependentsParams,
|
||||
exposeUi: {} as ExposeUiParams,
|
||||
exposeUi: {} as { [key: string]: ExposedUI },
|
||||
getSslCertificate: {} as GetSslCertificateParams,
|
||||
getSslKey: {} as GetSslKeyParams,
|
||||
getServiceInterface: {} as GetServiceInterfaceParams,
|
||||
|
||||
@@ -265,6 +265,7 @@ export type ExposeUiPaths<Store> =
|
||||
| {
|
||||
type: "object"
|
||||
value: { [k: string]: ExposeUiPaths<Store> }
|
||||
description?: string
|
||||
}
|
||||
| {
|
||||
type: "string"
|
||||
@@ -283,6 +284,7 @@ export type ExposeUiPathsAll =
|
||||
| {
|
||||
type: "object"
|
||||
value: { [k: string]: ExposeUiPathsAll }
|
||||
description: string | null
|
||||
}
|
||||
| {
|
||||
type: "string"
|
||||
@@ -395,7 +397,7 @@ export type Effects = {
|
||||
|
||||
exposeForDependents(options: { paths: string[] }): Promise<void>
|
||||
|
||||
exposeUi(options: ExposeUiPathsAll): Promise<void>
|
||||
exposeUi(options: { [key: string]: ExposeUiPathsAll }): Promise<void>
|
||||
/**
|
||||
* There are times that we want to see the addresses that where exported
|
||||
* @param options.addressId If we want to filter the address id
|
||||
|
||||
Reference in New Issue
Block a user