import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api'; import { PostType, SkillCategory } from '@spotify/backstage-plugin-skill-exchange-common'; import { ActionsRegistryActionOptions } from '@backstage/backend-plugin-api/alpha'; import { AnyZodObject } from 'zod/v3'; /** * @alpha **/ type PostMetadata = { title: string; description: string; }; /** * @alpha **/ interface ThumbnailGenerator { /** * Returns a URL to a thumbnail for a given post metadata * @param metadata - The metadata of the post */ generateThumbnail(metadata: PostMetadata): Promise; /** * Returns a string that describes the generator. This string is used to * describe the generator in the UI to the user. */ getGeneratorMetadata(): string; } /** * @alpha **/ interface SkillExchangeThumbnailGeneratorExtensionPoint { addThumbnailGenerator(generator: ThumbnailGenerator): void; } /** * An extension point that exposes the ability to configure a thumbnail generator provider. * * @alpha */ declare const skillExchangeThumbnailGeneratorExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint; /** @alpha */ type PostTypeToMessageBuilder = { [PostType.EMBED]: EmbedsMessageBuilder; [PostType.MENTOR]: MentorsMessageBuilder; [PostType.HACK]: HacksMessageBuilder; }; /** @alpha */ type PostData = { /** URL of the post */ postUrl?: string; /** Title of the post*/ postTitle?: string; }; /** @alpha */ type InquiryMessageArgs = PostData & { /** User entity ref or ID of the sender */ sender: string; /** Custom message from the sender */ customMessage?: string; }; /** @alpha */ type InquiryConfirmationArgs = PostData & { /** User entity ref or ID of the post contact */ postContact: string; }; /** @alpha */ type InquiryReminderArgs = InquiryMessageArgs & { /** Duration of how long it has been */ duration: string; }; /** @alpha */ type ParticipantAddedArgs = PostData & { /** User entity ref or ID of the post contact */ postContact?: string; }; /** @alpha */ type ParticipantAddedConfirmationArgs = PostData & { /** User entity ref or ID of the participant */ participant: string; }; /** @alpha */ type SavedSearchMatchArgs = PostData; /** @alpha */ type HackDigestMessageArgs = { postUrl: string; postTitle: string; newComments: number; newUpdates: number; }[]; /** @alpha */ interface BaseMessageBuilder { /** * Builds a message to be sent to the post owner that someone expressed interest in their post */ buildInquiryMessage(args: InquiryMessageArgs): string; /** * Builds a confirmation message to be sent to the sender that their interest in the post was sent to the contact person */ buildInquiryConfirmationMessage(args: InquiryConfirmationArgs): string; /** * Builds a message to remind a post owner about an inquiry they received */ buildInquiryReminderMessage(args: InquiryReminderArgs): string; /** * Builds a confirmation message that reminders about an inquiry have been stopped */ buildStopInquiryRemindersConfirmationMessage(): string; /** * Builds a message to notify user that an error occurred when trying to perform an action */ buildErrorOnActionMessage(): string; /** * Builds a message to notify a user that they were added as a participant to a post */ buildParticipantAddedMessage(args: ParticipantAddedArgs): string; /** * Builds a confirmation message to notify the post contact that a user was successfully added as a participant */ buildParticipantAddedConfirmationMessage(args: ParticipantAddedConfirmationArgs): string; /** * Builds a message to notify a user that a new post matches their saved search criteria */ buildSavedSearchMatchMessage(args: SavedSearchMatchArgs): string; } /** @alpha */ interface EmbedsMessageBuilder extends BaseMessageBuilder { } /** @alpha */ interface MentorsMessageBuilder extends BaseMessageBuilder { } /** @alpha */ interface HacksMessageBuilder extends Omit { /** * Builds a message that summarizes updates of posts that a user is following */ buildHackDigestMessage(args: HackDigestMessageArgs): string; } /** * @alpha **/ interface SkillExchangeMessageBuilderExtensionPoint { setNotificationsEmbedMessageBuilder(builder: EmbedsMessageBuilder): void; setNotificationsMentorsMessageBuilder(builder: MentorsMessageBuilder): void; setNotificationsHacksMessageBuilder(builder: HacksMessageBuilder): void; } /** * An extension point that exposes the ability to configure custom message builders for embeds, mentors and/or hacks. * * @alpha */ declare const skillExchangeMessageBuilderExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint; /** @alpha */ declare class MessageBuilderLoader { readonly embedsMessageBuilder: EmbedsMessageBuilder; readonly mentorsMessageBuilder: MentorsMessageBuilder; readonly hacksMessageBuilder: HacksMessageBuilder; constructor({ embedsMessageBuilder, mentorsMessageBuilder, hacksMessageBuilder, }: { embedsMessageBuilder: EmbedsMessageBuilder; mentorsMessageBuilder: MentorsMessageBuilder; hacksMessageBuilder: HacksMessageBuilder; }); getMessageBuilderForType(type: T): PostTypeToMessageBuilder[T]; } /** * Context provided to action factories for creating actions for Skill Exchange. * * @alpha */ interface ActionContext { /** * Search for skills in the skill exchange system */ searchSkills(params: SkillSearchParams, limit?: number): Promise; /** * Search for experts in the software catalog */ searchExperts(params: ExpertSearchParams, limit?: number): Promise; /** * Search for hack projects */ searchHackProjects(params: HackProjectSearchParams): Promise<{ results: HackProjectSearchResult[]; total: number; }>; } /** * Factory for creating Backstage actions for Skill Exchange * * @alpha */ interface ActionFactory { /** * Unique identifier for the action */ id: string; /** * Creates the action using the provided context */ createAction(context: ActionContext): Promise>; } /** * Skill definition in the skill exchange system * * @alpha */ interface SkillSearchResult { id: number; name: string; category: SkillCategory; } /** * Parameters for searching skills in the skill exchange system * * @alpha */ interface SkillSearchParams { query?: string; category?: SkillCategory; relatedToSkillIds?: number[]; } /** * Parameters for searching experts in the skill exchange system * * @alpha */ interface ExpertSearchParams { query?: string; teams?: string[]; skillNames?: string[]; } /** * User entity from the backstage catalog (enhanced with skill and team data from search) * * @alpha */ interface ExpertSearchResult { displayName: string; name: string; skills: string[]; teams: string[]; } /** * Search category for hack project queries. * Mirrors HackSearchCategory from the backend's generated GraphQL types, * but defined here to keep the node package independent of codegen output. * * @alpha */ type HackProjectSearchCategory = 'FREE_TEXT' | 'STATUS' | 'LOCATION' | 'EVENT' | 'TAGS' | 'MEMBER' | 'FOLLOWING' | 'SKILLS' | 'CATEGORY'; /** * Status values for hack projects. * * @alpha */ type HackProjectStatus = 'COMPLETE' | 'DROPPED' | 'FAILURE' | 'IN_PROGRESS' | 'LOOKING_FOR_MEMBERS' | 'PAUSED' | 'SHIPPED' | 'UNCLAIMED'; /** * A single filter for hack project search. Multiple filters of the same * category are ORed; different categories are ANDed. * * @alpha */ interface HackProjectSearchFilter { category: HackProjectSearchCategory; query: string; } /** * Parameters for searching hack projects * * @alpha */ interface HackProjectSearchParams { filters: HackProjectSearchFilter[]; limit?: number; } /** * A single hack project result returned from search * * @alpha */ interface HackProjectSearchResult { id: number; name: string; pitch: string; status: HackProjectStatus; teamLocation: string; tags: string[]; memberCount: number; skills: string[]; eventName?: string; } /** * Extension point for registering action factories * * @alpha */ interface ActionsExtensionPoint { /** * Register an action factory */ addActionFactory(factory: ActionFactory): void; } /** * Extension point for skill-exchange actions * * @alpha */ declare const actionsExtensionPoint: _backstage_backend_plugin_api.ExtensionPoint; export { type ActionContext, type ActionFactory, type ActionsExtensionPoint, type BaseMessageBuilder, type EmbedsMessageBuilder, type ExpertSearchParams, type ExpertSearchResult, type HackDigestMessageArgs, type HackProjectSearchCategory, type HackProjectSearchFilter, type HackProjectSearchParams, type HackProjectSearchResult, type HackProjectStatus, type HacksMessageBuilder, type InquiryConfirmationArgs, type InquiryMessageArgs, type InquiryReminderArgs, type MentorsMessageBuilder, MessageBuilderLoader, type ParticipantAddedArgs, type ParticipantAddedConfirmationArgs, type PostData, type PostMetadata, type PostTypeToMessageBuilder, type SavedSearchMatchArgs, type SkillExchangeMessageBuilderExtensionPoint, type SkillExchangeThumbnailGeneratorExtensionPoint, type SkillSearchParams, type SkillSearchResult, type ThumbnailGenerator, actionsExtensionPoint, skillExchangeMessageBuilderExtensionPoint, skillExchangeThumbnailGeneratorExtensionPoint };