From 5f80e7771414ff3cf3e7e34ec737157806a96bc3 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 15 Apr 2026 12:14:49 +0200 Subject: [PATCH] Remove orphaned ActionsService and ActionsRegistryService definitions Delete the unused `ActionsService.ts` and `ActionsRegistryService.ts` files under `services/definitions/`. These were never exported from the definitions index and had zero imports across the repo. The canonical copies live in the `alpha/` directory and have already diverged. Removing these eliminates a confusing dual source of truth. Signed-off-by: Patrik Oldsberg Made-with: Cursor --- .../definitions/ActionsRegistryService.ts | 85 ------------------- .../services/definitions/ActionsService.ts | 57 ------------- 2 files changed, 142 deletions(-) delete mode 100644 packages/backend-plugin-api/src/services/definitions/ActionsRegistryService.ts delete mode 100644 packages/backend-plugin-api/src/services/definitions/ActionsService.ts diff --git a/packages/backend-plugin-api/src/services/definitions/ActionsRegistryService.ts b/packages/backend-plugin-api/src/services/definitions/ActionsRegistryService.ts deleted file mode 100644 index 39c62ce731..0000000000 --- a/packages/backend-plugin-api/src/services/definitions/ActionsRegistryService.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2025 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { z, AnyZodObject } from 'zod/v3'; -import { BasicPermission } from '@backstage/plugin-permission-common'; -import { LoggerService } from './LoggerService'; -import { BackstageCredentials } from './AuthService'; - -/** - * @public - */ -export type ActionsRegistryActionContext = { - input: z.infer; - logger: LoggerService; - credentials: BackstageCredentials; -}; - -/** - * An example of how to use an action registered in the actions registry. - * - * @public - */ -export type ActionsRegistryActionExample< - TInputSchema extends AnyZodObject, - TOutputSchema extends AnyZodObject, -> = { - title: string; - description?: string; - input: z.infer; - output?: z.infer; -}; - -/** - * @public - */ -export type ActionsRegistryActionOptions< - TInputSchema extends AnyZodObject, - TOutputSchema extends AnyZodObject, -> = { - name: string; - title: string; - description: string; - schema: { - input: (zod: typeof z) => TInputSchema; - output: (zod: typeof z) => TOutputSchema; - }; - examples?: Array>; - visibilityPermission?: BasicPermission; - attributes?: { - destructive?: boolean; - idempotent?: boolean; - readOnly?: boolean; - }; - action: ( - context: ActionsRegistryActionContext, - ) => Promise< - z.infer extends void - ? void - : { output: z.infer } - >; -}; - -/** - * @public - */ -export interface ActionsRegistryService { - register< - TInputSchema extends AnyZodObject, - TOutputSchema extends AnyZodObject, - >( - options: ActionsRegistryActionOptions, - ): void; -} diff --git a/packages/backend-plugin-api/src/services/definitions/ActionsService.ts b/packages/backend-plugin-api/src/services/definitions/ActionsService.ts deleted file mode 100644 index 3afa131915..0000000000 --- a/packages/backend-plugin-api/src/services/definitions/ActionsService.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2025 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { JsonObject, JsonValue } from '@backstage/types'; -import { JSONSchema7 } from 'json-schema'; -import { BackstageCredentials } from './AuthService'; - -/** - * @public - */ -export type ActionsServiceAction = { - id: string; - name: string; - title: string; - description: string; - schema: { - input: JSONSchema7; - output: JSONSchema7; - }; - examples?: Array<{ - title: string; - description?: string; - input: JsonObject; - output?: JsonObject; - }>; - attributes: { - readOnly: boolean; - destructive: boolean; - idempotent: boolean; - }; -}; - -/** - * @public - */ -export interface ActionsService { - list: (opts: { - credentials: BackstageCredentials; - }) => Promise<{ actions: ActionsServiceAction[] }>; - invoke(opts: { - id: string; - input?: JsonObject; - credentials: BackstageCredentials; - }): Promise<{ output: JsonValue }>; -}