UNPKG

powerplatform-review-tool

Version:

Evaluate Power Platform solution zip files based on best practice patterns

78 lines 3.95 kB
import JSZip from "jszip"; import { PatternResult } from "../interface/pattern"; import { IPatternDetails } from "../utilities/pattern"; import { BotSkeleton, ComponentInfo, Agents, TopicIOProperty, EntityItem } from "../interface/botInterface"; /** * Extracts trigger queries from the component data structure. * * @param componentData - The component's data object. * @returns An array of trigger queries if found, otherwise an empty array. */ export declare function extractTriggerPhrases(componentData: any): string[]; export declare function extractBotDisplayName(zipContent: JSZip, botFolderName: string): Promise<string>; export declare function getAuthenticationMode(botXmlContent: string): Promise<string>; export declare function countConditionsInActions(actions: any[]): number; export declare function extractUniqueFlowIds(actions: any[], flowIdSet: Set<string>): void; /** * NEW HELPER: * Recursively collects the 'dialog' property from any 'BeginDialog' actions. */ export declare function collectBeginDialogReferences(actions: any[], usedTopicRefs: Set<string>): void; /** * NEW HELPER: * Formats the reference string for a topic: * e.g. "cra0f_forecastAgentWithFlow.topic.Getweatherforecast" */ export declare function formatTopicName(botLogicalName: string, topicName: string): string; /** * Helper to map numeric authentication modes 1, 2, or 3 * to their corresponding descriptive strings. */ export declare function mapAuthMode(authModeNum: string): "No Authentication" | "EntraID" | "Manual" | "Unknown"; /** * Helper function to retrieve the base pattern info (name, description, recommendation, docLinks, severity, category) * either from the user-provided patternDetails array or from the default BotPatternDetails. * * - If the patternID exists in `patternDetails`, we use its property values if they are non-empty (string check). * - If any such property is empty, null, or missing, we fallback to the corresponding BotPatternDetails property. * - If patternID not found in `patternDetails`, or not found in BotPatternDetails, we use final fallback defaults. */ export declare function getBasePatternInfo(patternID: string, patternDetails?: IPatternDetails[]): Omit<PatternResult, "status" | "instanceValue" | "failureReason" | "patternID">; /** * If 'statecode' is found in XML and is "0", topic is enabled. * If not found or any other value, treat as disabled => "1". */ export declare function getComponentStatus(botComponentXml: string | null): string; export declare function isEndOfConversationTopic(data: any): boolean; /** Return the text of the first `<tag>` in xml or null. */ export declare function xmlTag(xml: string, tag: string): string | null; /** Convert an IO-properties object into an array of TopicIOProperty. */ export declare function toIOArray(obj: any): TopicIOProperty[]; /** Convert ClosedListEntity items into array form. */ export declare function toEntityItems(arr: any): EntityItem[]; /** * collectBots * Reads **every** folder under /bots, parses bot.xml + configuration.json * and builds a map keyed by botSchemaName. */ export declare function collectBots(zip: JSZip): Promise<Map<string, BotSkeleton>>; /** * collectComponents * Crawls every file in /botcomponents/, reads botcomponent.xml (+ data), * and returns a list with **no dependency on the directory layout**. */ export declare function collectComponents(zip: JSZip): Promise<ComponentInfo[]>; /** * buildAgents * Combines the outputs of collectBots() + collectComponents() into * the final Agents[] array required by the rest of the solution. */ export declare function buildAgents(bots: Map<string, BotSkeleton>, comps: ComponentInfo[]): Agents[]; /** * extractAgentsDetails(zip) * Convenience wrapper that performs all three steps and returns Agents[]. */ export declare function extractAgentsDetails(zip: JSZip): Promise<{ agents: Agents[]; }>; //# sourceMappingURL=bothelper.d.ts.map