From 6e5ebec1333b79e9d7406905f8e14c7c161024a7 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 3 Jan 2023 13:38:57 +0100 Subject: [PATCH] backend-plugin-api: generate api report for create* updates Signed-off-by: Patrik Oldsberg --- packages/backend-plugin-api/api-report.md | 107 ++++++++++++---------- packages/backend-plugin-api/src/types.ts | 2 - 2 files changed, 61 insertions(+), 48 deletions(-) diff --git a/packages/backend-plugin-api/api-report.md b/packages/backend-plugin-api/api-report.md index a829f6200c..2dcd0dccb4 100644 --- a/packages/backend-plugin-api/api-report.md +++ b/packages/backend-plugin-api/api-report.md @@ -111,28 +111,19 @@ export namespace coreServices { } // @public -export function createBackendModule< - TOptions extends object | undefined = undefined, ->( +export function createBackendModule( config: BackendModuleConfig, -): undefined extends TOptions - ? (options?: TOptions) => BackendFeature - : (options: TOptions) => BackendFeature; +): FactoryFunctionWithOptions; // @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( + config: BackendPluginConfig, +): FactoryFunctionWithOptions; // @public (undocumented) -export function createExtensionPoint(options: { - id: string; -}): ExtensionPoint; +export function createExtensionPoint( + config: ExtensionPointConfig, +): ExtensionPoint; // @public (undocumented) export function createServiceFactory< @@ -142,37 +133,20 @@ export function createServiceFactory< TDeps extends { [name in string]: ServiceRef; }, - TOpts extends object | undefined = undefined, ->(config: { - service: ServiceRef; - deps: TDeps; - factory( - deps: ServiceRefsToInstances, - options: TOpts, - ): TScope extends 'root' - ? Promise - : Promise<(deps: ServiceRefsToInstances) => Promise>; -}): undefined extends TOpts - ? (options?: TOpts) => ServiceFactory - : (options: TOpts) => ServiceFactory; + TOpts extends MaybeOptions = undefined, +>( + config: ServiceFactoryConfig, +): FactoryFunctionWithOptions, TOpts>; -// @public (undocumented) -export function createServiceRef(options: { - id: string; - scope?: 'plugin'; - defaultFactory?: ( - service: ServiceRef, - ) => Promise | (() => ServiceFactory)>; -}): ServiceRef; +// @public +export function createServiceRef( + config: ServiceRefConfig, +): ServiceRef; -// @public (undocumented) -export function createServiceRef(options: { - id: string; - scope: 'root'; - defaultFactory?: ( - service: ServiceRef, - ) => Promise | (() => ServiceFactory)>; -}): ServiceRef; +// @public +export function createServiceRef( + config: ServiceRefConfig, +): ServiceRef; // @public export interface DatabaseService { @@ -196,6 +170,12 @@ export type ExtensionPoint = { $$ref: 'extension-point'; }; +// @public (undocumented) +export interface ExtensionPointConfig { + // (undocumented) + id: string; +} + // @public (undocumented) export interface HttpRouterService { // (undocumented) @@ -344,6 +324,29 @@ export type ServiceFactory = >; }; +// @public (undocumented) +export interface ServiceFactoryConfig< + TService, + TScope extends 'root' | 'plugin', + TImpl extends TService, + TDeps extends { + [name in string]: ServiceRef; + }, + TOpts extends MaybeOptions = undefined, +> { + // (undocumented) + deps: TDeps; + // (undocumented) + factory( + deps: ServiceRefsToInstances, + options: TOpts, + ): TScope extends 'root' + ? Promise + : Promise<(deps: ServiceRefsToInstances) => Promise>; + // (undocumented) + service: ServiceRef; +} + // @public export type ServiceRef< TService, @@ -356,6 +359,18 @@ export type ServiceRef< $$ref: 'service'; }; +// @public (undocumented) +export interface ServiceRefConfig { + // (undocumented) + defaultFactory?: ( + service: ServiceRef, + ) => Promise | (() => ServiceFactory)>; + // (undocumented) + id: string; + // (undocumented) + scope?: TScope; +} + // @public export interface TokenManagerService { authenticate(token: string): Promise; diff --git a/packages/backend-plugin-api/src/types.ts b/packages/backend-plugin-api/src/types.ts index 59ecede753..6da3bafe17 100644 --- a/packages/backend-plugin-api/src/types.ts +++ b/packages/backend-plugin-api/src/types.ts @@ -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 =