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 }>; -}