Files
start-os/sdk/base/lib/interfaces/setupExportedUrls.ts
Aiden McClelland 9c3053f103 feat: implement URL plugins with table/row actions and prefill support
- Add URL plugin effects (register, export_url, clear_urls) in core
- Add PluginHostnameInfo, HostnameMetadata::Plugin, and plugin registration types
- Implement plugin URL table in web UI with tableAction button and rowAction overflow menus
- Thread urlPluginMetadata (packageId, hostId, interfaceId, internalPort) as prefill to actions
- Add prefill support to PackageActionData so metadata passes through form dialogs
- Add i18n translations for plugin error messages
- Clean up plugin URLs on package uninstall
2026-02-18 17:51:13 -07:00

29 lines
887 B
TypeScript

import { Effects, PluginHostnameInfo } from '../types'
export type SetExportedUrls = (opts: { effects: Effects }) => Promise<void>
export type UpdateExportedUrls = (effects: Effects) => Promise<null>
export type SetupExportedUrls = (fn: SetExportedUrls) => UpdateExportedUrls
export const setupExportedUrls: SetupExportedUrls = (fn: SetExportedUrls) => {
return (async (effects: Effects) => {
const urls: PluginHostnameInfo[] = []
await fn({
effects: {
...effects,
plugin: {
...effects.plugin,
url: {
...effects.plugin.url,
exportUrl: (params) => {
urls.push(params.hostnameInfo)
return effects.plugin.url.exportUrl(params)
},
},
},
},
})
await effects.plugin.url.clearUrls({ except: urls })
return null
}) as UpdateExportedUrls
}