UNPKG

@apistudio/apim-cli

Version:

CLI for API Management Products

108 lines 5.03 kB
import { IRuntimeInventory, MasterContent, PolicyInfo } from "./interfaces/IRuntimeInventory.js"; declare const STAGED = "staged"; declare const FREE_FLOW = "free-flow"; export declare enum CommonKind { Api = "api", Plan = "plan", Product = "product", TestApi = "testapi", Tuple = "tuple", UriSchemes = "urischemes" } export type CommonKindType = `${CommonKind}`; export declare class RuntimeInventory implements IRuntimeInventory { masterContent: MasterContent; schemaDefinitions: Record<string, any>; defaultVersionMap: Record<string, string>; private rulesetDefinitions; constructor(); /** * Overrides the master content with new data * @param newMasterContent - New master content to replace the existing data */ setMasterContent(newMasterContent: MasterContent): void; /** * Extends or overrides the master content with custom data * @param customMasterContent - Custom master content to merge with existing data * @param overrideExisting - If true, will override existing entries; if false, will only add new entries */ extendMasterContent(customMasterContent: Partial<MasterContent>, overrideExisting?: boolean): void; /** * Extends or overrides the schema definitions with custom schemas * @param customSchemas - Custom schemas to merge with existing schemas * @param overrideExisting - If true, will override existing schemas; if false, will only add new schemas */ extendSchemaDefinitions(customSchemas: Record<string, any>, overrideExisting?: boolean): void; /** * Extends or overrides the default versions with custom default versions * @param customDefaultVersions - Custom default versions to merge with existing versions * @param overrideExisting - If true, will override existing versions; if false, will only add new versions */ extendDefaultVersions(customDefaultVersions: Record<string, string>, overrideExisting?: boolean): void; /** * Extends or overrides the ruleset definitions with custom rulesets * @param customRulesets - Custom rulesets to merge with existing rulesets * @param overrideExisting - If true, will override existing rulesets; if false, will only add new rulesets */ extendRulesetDefinitions(customRulesets: Record<string, any>, overrideExisting?: boolean): void; /** * Hook method for subclasses to provide overridden schema for a specific schema key * This is called automatically by getSchema() to check if there's an override * Extended classes can override this to provide custom schemas * @param schemaKey - The schema key (e.g., "api.ibm.com_v1_customkind.json") * @returns The overridden schema object or undefined if no override */ getOverriddenSchema(schemaKey: string): any | undefined; /** * Hook method for subclasses to provide overridden ruleset for a specific ruleset key * This is called automatically by getLintRuleset() to check if there's an override * Extended classes can override this to provide custom rulesets * @param rulesetKey - The ruleset key (e.g., "api.ibm.com_v1_customkind.ruleset.yaml") * @returns The overridden ruleset object or undefined if no override */ getOverriddenRule(rulesetKey: string): any | undefined; getSchema(name: string, version?: string): any | undefined; getSchemaFromDestination(name: string, version?: string): any | undefined; getTypescript(name: string, version?: string): Record<string, any> | undefined; getLintRuleset(name: string, version?: string): Record<string, any> | undefined; getPolicySequenceType(): { sequenceTypes: string[]; } | undefined; getStagedPolicies(): Record<string, { stage: string; policies: PolicyInfo[]; }> | undefined; getFreeFlowPolicies(): Record<string, { group: string; type: string; policies: PolicyInfo[]; }> | undefined; getPolicyDefaultVersion(sequenceType: typeof STAGED | typeof FREE_FLOW, groupName: string, policyName: string): string | undefined; getMasterContents(): MasterContent; /** * Get the complete default versions mapping * @returns A record mapping kind names to their default API versions */ getDefaultVersions(): Record<string, string>; /** * Get the list of required kinds * @returns An array of required kind names */ getRequiredKinds(): string[]; /** * Get the list of optional kinds * @returns An array of optional kind names */ getOptionalKinds(): string[]; getPolicyInfo(sequenceType: typeof STAGED | typeof FREE_FLOW, groupName: string, policyName: string): { name: string; sequenceType: string; group: string; defaultVersion: any; policy: any; } | undefined; private flattenPolicies; } export declare const runtimeInventory: RuntimeInventory; export {}; //# sourceMappingURL=runtimeInventory.d.ts.map