import { APIPluginManifest, APIPluginManifestLatest } from "../generated-types"; import { BaseManifest } from "./BaseManifest"; type LatestManifestType = APIPluginManifestLatest; type RuntimeObject = NonNullable[number]; type FunctionObjectType = NonNullable[number]; export type FunctionObject = FunctionObjectType; export type RuntimeAuthenticationObject = RuntimeObject["auth"]; /** * Runtime type value derived from the latest manifest schema. * This type is auto-generated from the JSON schema and represents all valid runtime types. */ export type RuntimeTypeValue = RuntimeObject["type"]; /** * Runtime type enum for plugin runtimes. * These values match the auto-generated RuntimeType from the schema. * @see RuntimeTypeValue for the type definition */ export declare const RuntimeType: { readonly [K in RuntimeTypeValue]: K; }; /** * OOP wrapper for API Plugin Manifest. * * Provides a fluent API for manipulating API plugin manifests with * type safety, state tracking, and convenient operations. * * @example * ```typescript * // Read existing manifest * const plugin = await APIPluginManifestWrapper.read("plugin.json"); * * // Modify with fluent API * plugin * .addFunction("getUser", "Get user information") * .addOpenApiRuntime("openapi.yaml", "Bearer"); * * // Save changes * await plugin.save(); * ``` */ export declare class APIPluginManifestWrapper extends BaseManifest { private constructor(); /** * Reads a plugin manifest from a file. * @param filePath - Path to the manifest JSON file. * @returns A new APIPluginManifestWrapper instance. */ static read(filePath: string): Promise; /** * Reads a plugin manifest from a file synchronously. * @param filePath - Path to the manifest JSON file. * @returns A new APIPluginManifestWrapper instance. */ static readSync(filePath: string): APIPluginManifestWrapper; /** * Creates an APIPluginManifestWrapper from a JSON string. * @param json - JSON string representing the manifest. * @returns A new APIPluginManifestWrapper instance. */ static fromJSON(json: string): APIPluginManifestWrapper; /** * Creates a new plugin manifest with required fields. * @param init - Initial manifest data with required fields. * @returns A new APIPluginManifestWrapper instance. */ static create(init: { schemaVersion: APIPluginManifest["schema_version"]; nameForHuman: string; descriptionForHuman: string; namespace?: string; }): APIPluginManifestWrapper; /** * Returns the schema version of the manifest. */ get schemaVersion(): string; /** * Returns the human-readable name. */ get nameForHuman(): string; /** * Returns the human-readable description. */ get descriptionForHuman(): string; /** * Returns the namespace (if available in the version). */ get namespace(): string | undefined; /** * Returns a readonly array of functions. */ get functions(): readonly FunctionObjectType[]; /** * Returns a readonly array of runtimes. */ get runtimes(): readonly RuntimeObject[]; /** * Sets the human-readable name. */ setNameForHuman(name: string): this; /** * Sets the human-readable description. */ setDescriptionForHuman(description: string): this; /** * Sets the model description. */ setDescriptionForModel(description: string): this; /** * Sets the namespace (for latest version). */ setNamespace(namespace: string): this; /** * Adds a function to the manifest. * @param name - The function name (must match operationId in OpenAPI). * @param description - Description for the model. */ addFunction(name: string, description?: string): this; /** * Removes a function by name. * @param name - The name of the function to remove. */ removeFunction(name: string): this; /** * Checks if a function exists by name. */ hasFunction(name: string): boolean; /** * Gets a function by name. */ getFunction(name: string): FunctionObjectType | undefined; /** * Adds a runtime configuration. * @param runtime - The runtime configuration object. */ addRuntime(runtime: RuntimeObject): this; /** * Adds an OpenAPI runtime. * @param specUrl - URL or relative path to the OpenAPI spec. * @param authType - Authentication type. * @param runForFunctions - Optional array of function names or "*" for all. */ addOpenApiRuntime(specUrl: string, authType?: "None" | "OAuthPluginVault" | "ApiKeyPluginVault", runForFunctions?: string[]): this; /** * Adds a LocalPlugin runtime. * @param localEndpoint - The local endpoint identifier. * @param runForFunctions - Optional array of function names. */ addLocalPluginRuntime(localEndpoint: "Microsoft.Office.Addin", runForFunctions?: string[]): this; /** * Removes a runtime by spec URL. * @param specUrl - The spec URL of the runtime to remove. */ removeRuntimeBySpecUrl(specUrl: string): this; /** * Returns all API spec paths/URLs from runtimes. */ getApiSpecPaths(): string[]; /** * Validates the manifest against its JSON schema. * @returns Array of validation error messages, empty if valid. */ validate(): Promise; /** * Converts the manifest to a formatted JSON string. */ toJSON(): string; /** * Creates a deep clone of this manifest. */ clone(): APIPluginManifestWrapper; /** * Creates a deep clone with partial modifications applied. * Useful for creating a modified copy without mutating the original. * @param changes - Partial manifest data to merge into the clone. Allows additional properties for extensibility. * @returns A new APIPluginManifestWrapper with the changes applied. */ cloneWith(changes: Partial & Record): APIPluginManifestWrapper; /** * Returns a mutable reference to the manifest data for direct modification. * Use with caution - prefer using the fluent API methods when possible. * Changes made through this reference will be tracked as dirty. */ get mutableData(): APIPluginManifest; } export {};