backend-plugin-api: fix API report warnings
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -33,13 +33,18 @@ export type ServiceRef<T> = {
|
||||
$$ref: 'service';
|
||||
};
|
||||
|
||||
type TypesToServiceRef<T> = { [key in keyof T]: ServiceRef<T[key]> };
|
||||
type DepsToDepFactories<T> = {
|
||||
/** @public */
|
||||
export type TypesToServiceRef<T> = { [key in keyof T]: ServiceRef<T[key]> };
|
||||
|
||||
/** @public */
|
||||
export type DepsToDepFactories<T> = {
|
||||
[key in keyof T]: (pluginId: string) => Promise<T[key]>;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type FactoryFunc<Impl> = (pluginId: string) => Promise<Impl>;
|
||||
|
||||
/** @public */
|
||||
export type ServiceFactory<
|
||||
TApi,
|
||||
TImpl extends TApi,
|
||||
@@ -50,6 +55,7 @@ export type ServiceFactory<
|
||||
factory(deps: DepsToDepFactories<TDeps>): Promise<FactoryFunc<TImpl>>;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type AnyServiceFactory = ServiceFactory<
|
||||
unknown,
|
||||
unknown,
|
||||
|
||||
@@ -25,9 +25,8 @@ export type ExtensionPoint<T> = {
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Utility for getting the type of the extension point, using `typeof
|
||||
* extensionPoint.T`. Attempting to actually read this value will result in an
|
||||
* exception.
|
||||
* Utility for getting the type of the extension point, using `typeof extensionPoint.T`.
|
||||
* Attempting to actually read this value will result in an exception.
|
||||
*/
|
||||
T: T;
|
||||
|
||||
@@ -36,6 +35,7 @@ export type ExtensionPoint<T> = {
|
||||
$$ref: 'extension-point';
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export function createExtensionPoint<T>(options: {
|
||||
id: string;
|
||||
}): ExtensionPoint<T> {
|
||||
@@ -51,6 +51,7 @@ export function createExtensionPoint<T>(options: {
|
||||
};
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface BackendInitRegistry {
|
||||
registerExtensionPoint<TExtensionPoint>(
|
||||
ref: ServiceRef<TExtensionPoint>,
|
||||
@@ -62,16 +63,19 @@ export interface BackendInitRegistry {
|
||||
}): void;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface BackendRegistrable {
|
||||
id: string;
|
||||
register(reg: BackendInitRegistry): void;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface BackendPluginConfig<TOptions> {
|
||||
id: string;
|
||||
register(reg: BackendInitRegistry, options: TOptions): void;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export function createBackendPlugin<TOptions>(
|
||||
config: BackendPluginConfig<TOptions>,
|
||||
): (option: TOptions) => BackendRegistrable {
|
||||
@@ -83,6 +87,7 @@ export function createBackendPlugin<TOptions>(
|
||||
});
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface BackendModuleConfig<TOptions> {
|
||||
pluginId: string;
|
||||
moduleId: string;
|
||||
@@ -92,6 +97,7 @@ export interface BackendModuleConfig<TOptions> {
|
||||
): void;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export function createBackendModule<TOptions>(
|
||||
config: BackendModuleConfig<TOptions>,
|
||||
): (option: TOptions) => BackendRegistrable {
|
||||
|
||||
Reference in New Issue
Block a user