From 04525293745fdb736d9918042633a3cc9d077c49 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 12 Aug 2022 14:02:15 +0200 Subject: [PATCH] BackendInitRegistry -> BackendRegistrationPoints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- .../backend-plugin-api/src/wiring/factories.ts | 14 +++++++++----- packages/backend-plugin-api/src/wiring/index.ts | 2 +- packages/backend-plugin-api/src/wiring/types.ts | 5 +++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/backend-plugin-api/src/wiring/factories.ts b/packages/backend-plugin-api/src/wiring/factories.ts index a057c0d6ec..68f13f6c30 100644 --- a/packages/backend-plugin-api/src/wiring/factories.ts +++ b/packages/backend-plugin-api/src/wiring/factories.ts @@ -14,7 +14,11 @@ * limitations under the License. */ -import { BackendInitRegistry, BackendFeature, ExtensionPoint } from './types'; +import { + BackendRegistrationPoints, + BackendFeature, + ExtensionPoint, +} from './types'; /** @public */ export function createExtensionPoint(options: { @@ -35,7 +39,7 @@ export function createExtensionPoint(options: { /** @public */ export interface BackendPluginConfig { id: string; - register(reg: BackendInitRegistry, options: TOptions): void; + register(reg: BackendRegistrationPoints, options: TOptions): void; } /** @public */ @@ -46,7 +50,7 @@ export function createBackendPlugin( : (options: TOptions) => BackendFeature { return (options?: TOptions) => ({ id: config.id, - register(register: BackendInitRegistry) { + register(register: BackendRegistrationPoints) { return config.register(register, options!); }, }); @@ -57,7 +61,7 @@ export interface BackendModuleConfig { pluginId: string; moduleId: string; register( - reg: Omit, + reg: Omit, options: TOptions, ): void; } @@ -70,7 +74,7 @@ export function createBackendModule( : (options: TOptions) => BackendFeature { return (options?: TOptions) => ({ id: `${config.pluginId}.${config.moduleId}`, - register(register: BackendInitRegistry) { + register(register: BackendRegistrationPoints) { // TODO: Hide registerExtensionPoint return config.register(register, options!); }, diff --git a/packages/backend-plugin-api/src/wiring/index.ts b/packages/backend-plugin-api/src/wiring/index.ts index 2ad414beca..8f85edb2eb 100644 --- a/packages/backend-plugin-api/src/wiring/index.ts +++ b/packages/backend-plugin-api/src/wiring/index.ts @@ -21,7 +21,7 @@ export { createExtensionPoint, } from './factories'; export type { - BackendInitRegistry, + BackendRegistrationPoints, BackendFeature, ExtensionPoint, } from './types'; diff --git a/packages/backend-plugin-api/src/wiring/types.ts b/packages/backend-plugin-api/src/wiring/types.ts index 3f01879f80..1801127ddb 100644 --- a/packages/backend-plugin-api/src/wiring/types.ts +++ b/packages/backend-plugin-api/src/wiring/types.ts @@ -36,7 +36,7 @@ export type ExtensionPoint = { }; /** @public */ -export interface BackendInitRegistry { +export interface BackendRegistrationPoints { registerExtensionPoint( ref: ServiceRef, impl: TExtensionPoint, @@ -49,6 +49,7 @@ export interface BackendInitRegistry { /** @public */ export interface BackendFeature { + // TODO(Rugvip): Try to get rid of the ID at this level, allowing for a feature to register multiple features as a bundle id: string; - register(reg: BackendInitRegistry): void; + register(reg: BackendRegistrationPoints): void; }