chore: need to export things

Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
benjdlambert
2025-06-13 14:53:30 +02:00
parent dbd64a283f
commit fcc9fa9e90
3 changed files with 69 additions and 0 deletions
+35
View File
@@ -3,8 +3,11 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { ActionsRegistryActionOptions } from '@backstage/backend-plugin-api';
import { ActionsRegistryService } from '@backstage/backend-plugin-api';
import { ActionsService } from '@backstage/backend-plugin-api';
import { ActionsServiceAction } from '@backstage/backend-plugin-api';
import { AnyZodObject } from 'zod';
import { AuditorService } from '@backstage/backend-plugin-api';
import { AuthorizeResult } from '@backstage/plugin-permission-common';
import { AuthService } from '@backstage/backend-plugin-api';
@@ -26,6 +29,7 @@ import { ExtensionPoint } from '@backstage/backend-plugin-api';
import { HttpAuthService } from '@backstage/backend-plugin-api';
import { HttpRouterService } from '@backstage/backend-plugin-api';
import { JsonObject } from '@backstage/types';
import { JsonValue } from '@backstage/types';
import Keyv from 'keyv';
import { Knex } from 'knex';
import { LifecycleService } from '@backstage/backend-plugin-api';
@@ -56,6 +60,33 @@ export interface CreateMockDirectoryOptions {
mockOsTmpDir?: boolean;
}
// @public
export class MockActionsRegistry
implements ActionsRegistryService, ActionsService
{
// (undocumented)
readonly actions: Map<string, ActionsRegistryActionOptions<any, any>>;
// (undocumented)
static create(opts: { logger: LoggerService }): MockActionsRegistry;
// (undocumented)
invoke(opts: {
id: string;
input?: JsonObject;
credentials?: BackstageCredentials;
}): Promise<{
output: JsonValue;
}>;
// (undocumented)
list(): Promise<{
actions: ActionsServiceAction[];
}>;
// (undocumented)
register<
TInputSchema extends AnyZodObject,
TOutputSchema extends AnyZodObject,
>(options: ActionsRegistryActionOptions<TInputSchema, TOutputSchema>): void;
}
// @public (undocumented)
export namespace mockCredentials {
export function limitedUser(
@@ -174,6 +205,10 @@ export namespace mockServices {
) => ServiceMock<ActionsService>;
}
// (undocumented)
export function actionsRegistry(options?: {
logger: LoggerService;
}): MockActionsRegistry;
// (undocumented)
export namespace actionsRegistry {
const // (undocumented)
factory: () => ServiceFactory<
@@ -27,6 +27,39 @@ import { z, AnyZodObject } from 'zod';
import zodToJsonSchema from 'zod-to-json-schema';
import { mockCredentials } from './mockCredentials';
/**
* A mock implementation of the ActionsRegistryService and ActionsService that can be used in tests.
*
* This is useful for testing actions that are registered with the ActionsRegistryService and ActionsService.
*
* The plugin ID is hardcoded to `testing` in the mock implementation.
*
* @example
* ```ts
* const actionsRegistry = mockServices.actionsRegistry();
*
* actionsRegistry.register({
* name: 'test',
* title: 'Test',
* description: 'Test',
* schema: {
* input: z.object({ name: z.string() }),
* output: z.object({ name: z.string() }),
* },
* action: async ({ input }) => ({ output: { name: input.name } }),
* });
*
*
* const result = await actionsRegistry.invoke({
* id: 'testing:test',
* input: { name: 'test' },
* });
*
* expect(result).toEqual({ output: { name: 'test' } });
* ```
*
* @public
*/
export class MockActionsRegistry
implements ActionsRegistryService, ActionsService
{
@@ -15,3 +15,4 @@
*/
export { mockServices, type ServiceMock } from './mockServices';
export { mockCredentials } from './mockCredentials';
export { type MockActionsRegistry } from './MockActionsRegistry';