feat(plugin-sdk): many more initial impl
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export { channels } from '../../../channels'
|
||||
export * from './resources'
|
||||
@@ -0,0 +1 @@
|
||||
export { providers } from './providers'
|
||||
@@ -0,0 +1,13 @@
|
||||
import { defineInvoke } from '@moeru/eventa'
|
||||
|
||||
import { channels } from '../../../../../channels'
|
||||
import { protocolListProviders } from '../../../protocol/resources/providers'
|
||||
|
||||
export async function listProviders() {
|
||||
const func = defineInvoke(channels.data, protocolListProviders)
|
||||
return func()
|
||||
}
|
||||
|
||||
export const providers = {
|
||||
listProviders,
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './client'
|
||||
export * from './protocol'
|
||||
@@ -0,0 +1 @@
|
||||
export * from './resources'
|
||||
@@ -0,0 +1 @@
|
||||
export { protocolProviders } from './providers'
|
||||
@@ -0,0 +1,7 @@
|
||||
import { defineInvokeEventa } from '@moeru/eventa'
|
||||
|
||||
export const protocolListProviders = defineInvokeEventa<{ name: string }[]>('proj-airi:plugin-sdk:apis:protocol:resources:providers:list-providers')
|
||||
|
||||
export const protocolProviders = {
|
||||
listProviders: protocolListProviders,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { Plugin } from './shared'
|
||||
|
||||
export function definePlugin(name: string, version: string, setup: () => Promise<Plugin> | Plugin): {
|
||||
name: string
|
||||
version: string
|
||||
setup: () => Promise<Plugin> | Plugin
|
||||
} {
|
||||
return {
|
||||
name,
|
||||
version,
|
||||
setup,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis'
|
||||
export * from './define'
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Setup the local plugin scope.
|
||||
*
|
||||
* TODO: now sure how this should be implemented, but perhaps it should call packages/plugin-sdk/src/channels to setup local channels
|
||||
* first? Then probably some other initialization steps.
|
||||
*/
|
||||
export async function setupLocalPluginScope() {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Setup the remote plugin scope.
|
||||
*
|
||||
* TODO: now sure how this should be implemented, but perhaps it should call packages/plugin-sdk/src/channels to setup remote channels
|
||||
* first? Then probably some other initialization steps.
|
||||
*/
|
||||
export async function setupRemotePluginScope() {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { ChannelControlPlane } from '../channels/shared'
|
||||
|
||||
export interface ContextInit {
|
||||
host: ChannelControlPlane
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
init?: (initContext: ContextInit) => Promise<void | undefined | false>
|
||||
/**
|
||||
*
|
||||
*/
|
||||
setupModules?: () => Promise<void | undefined>
|
||||
}
|
||||
Reference in New Issue
Block a user