backend-plugin-api: generate api report for create* updates

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-01-03 13:38:57 +01:00
parent 5b86b02d6c
commit 6e5ebec133
2 changed files with 61 additions and 48 deletions
+61 -46
View File
@@ -111,28 +111,19 @@ export namespace coreServices {
}
// @public
export function createBackendModule<
TOptions extends object | undefined = undefined,
>(
export function createBackendModule<TOptions extends MaybeOptions = undefined>(
config: BackendModuleConfig<TOptions>,
): undefined extends TOptions
? (options?: TOptions) => BackendFeature
: (options: TOptions) => BackendFeature;
): FactoryFunctionWithOptions<BackendFeature, TOptions>;
// @public (undocumented)
export function createBackendPlugin<
TOptions extends object | undefined = undefined,
>(config: {
id: string;
register(reg: BackendRegistrationPoints, options: TOptions): void;
}): undefined extends TOptions
? (options?: TOptions) => BackendFeature
: (options: TOptions) => BackendFeature;
export function createBackendPlugin<TOptions extends MaybeOptions = undefined>(
config: BackendPluginConfig<TOptions>,
): FactoryFunctionWithOptions<BackendFeature, TOptions>;
// @public (undocumented)
export function createExtensionPoint<T>(options: {
id: string;
}): ExtensionPoint<T>;
export function createExtensionPoint<T>(
config: ExtensionPointConfig,
): ExtensionPoint<T>;
// @public (undocumented)
export function createServiceFactory<
@@ -142,37 +133,20 @@ export function createServiceFactory<
TDeps extends {
[name in string]: ServiceRef<unknown>;
},
TOpts extends object | undefined = undefined,
>(config: {
service: ServiceRef<TService, TScope>;
deps: TDeps;
factory(
deps: ServiceRefsToInstances<TDeps, 'root'>,
options: TOpts,
): TScope extends 'root'
? Promise<TImpl>
: Promise<(deps: ServiceRefsToInstances<TDeps>) => Promise<TImpl>>;
}): undefined extends TOpts
? (options?: TOpts) => ServiceFactory<TService>
: (options: TOpts) => ServiceFactory<TService>;
TOpts extends MaybeOptions = undefined,
>(
config: ServiceFactoryConfig<TService, TScope, TImpl, TDeps, TOpts>,
): FactoryFunctionWithOptions<ServiceFactory<TService>, TOpts>;
// @public (undocumented)
export function createServiceRef<T>(options: {
id: string;
scope?: 'plugin';
defaultFactory?: (
service: ServiceRef<T, 'plugin'>,
) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;
}): ServiceRef<T, 'plugin'>;
// @public
export function createServiceRef<TService>(
config: ServiceRefConfig<TService, 'plugin'>,
): ServiceRef<TService, 'plugin'>;
// @public (undocumented)
export function createServiceRef<T>(options: {
id: string;
scope: 'root';
defaultFactory?: (
service: ServiceRef<T, 'root'>,
) => Promise<ServiceFactory<T> | (() => ServiceFactory<T>)>;
}): ServiceRef<T, 'root'>;
// @public
export function createServiceRef<TService>(
config: ServiceRefConfig<TService, 'root'>,
): ServiceRef<TService, 'root'>;
// @public
export interface DatabaseService {
@@ -196,6 +170,12 @@ export type ExtensionPoint<T> = {
$$ref: 'extension-point';
};
// @public (undocumented)
export interface ExtensionPointConfig {
// (undocumented)
id: string;
}
// @public (undocumented)
export interface HttpRouterService {
// (undocumented)
@@ -344,6 +324,29 @@ export type ServiceFactory<TService = unknown> =
>;
};
// @public (undocumented)
export interface ServiceFactoryConfig<
TService,
TScope extends 'root' | 'plugin',
TImpl extends TService,
TDeps extends {
[name in string]: ServiceRef<unknown>;
},
TOpts extends MaybeOptions = undefined,
> {
// (undocumented)
deps: TDeps;
// (undocumented)
factory(
deps: ServiceRefsToInstances<TDeps, 'root'>,
options: TOpts,
): TScope extends 'root'
? Promise<TImpl>
: Promise<(deps: ServiceRefsToInstances<TDeps>) => Promise<TImpl>>;
// (undocumented)
service: ServiceRef<TService, TScope>;
}
// @public
export type ServiceRef<
TService,
@@ -356,6 +359,18 @@ export type ServiceRef<
$$ref: 'service';
};
// @public (undocumented)
export interface ServiceRefConfig<TService, TScope extends 'root' | 'plugin'> {
// (undocumented)
defaultFactory?: (
service: ServiceRef<TService, TScope>,
) => Promise<ServiceFactory<TService> | (() => ServiceFactory<TService>)>;
// (undocumented)
id: string;
// (undocumented)
scope?: TScope;
}
// @public
export interface TokenManagerService {
authenticate(token: string): Promise<void>;
-2
View File
@@ -17,7 +17,6 @@
/**
* Base type for options objects that aren't required.
*
* @internal
* @ignore
*/
export type MaybeOptions = object | undefined;
@@ -25,7 +24,6 @@ export type MaybeOptions = object | undefined;
/**
* Helper type that makes the options argument optional if options are not required.
*
* @internal
* @ignore
*/
export type FactoryFunctionWithOptions<TResult, TOptions> =