import * as lodash from "lodash"; import { Data, MutableStringMap, StringMap } from "@azure-tools/openapi-tools-common"; import * as commonmark from "commonmark"; export declare function executePromisesSequentially(promiseFactories: ReadonlyArray<() => Promise>): Promise; export interface Reference { readonly filePath?: string; readonly localReference?: LocalReference; } export interface LocalReference { readonly value: string; readonly accessorProperty: string; } export declare function parseReferenceInSwagger(reference: string): Reference; export declare function joinPath(...args: string[]): string; export declare function checkAndResolveGithubUrl(inputPath: string): string; /** * Finds the git root directory for the given directory. */ export declare function findGitRootDirectory(dir: string): string | undefined; export declare function mergeObjects>(source: T, target: T): T; export declare function mergeArrays(source: readonly T[], target: T[]): T[]; export declare function getObject(doc: StringMap, ptr: string): unknown; export declare function setObject(doc: StringMap, ptr: string, value: unknown, overwrite?: boolean): any; /** * Gets provider namespace from the given path. In case of multiple, last one will be returned. * @param {string} pathStr The path of the operation. * Example "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/ * providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/ * {resourceName}/providers/Microsoft.Authorization/roleAssignments" * will return "Microsoft.Authorization". * * @returns {string} result - provider namespace from the given path. */ export declare function getProvider(pathStr?: string | null): string | undefined; export interface PathProvider { provider: string; type: "resource-manager" | "data-plane"; } export declare function getProviderFromSpecPath(specPath: string): PathProvider | undefined; export declare const getValueByJsonPointer: (obj: any, pointer: string | string[]) => any; export declare function getProviderFromFilePath(pathStr: string): string | undefined; /** * @return return undefined indicates not found, otherwise return non-empty string. */ export declare const getDefaultReadmeTag: (markDown: commonmark.Node) => string | undefined; export declare function getInputFiles(readMe: string, tag?: string): Promise; export declare function getDefaultTag(readMe: string): Promise; export declare function getApiScenarioFiles(readMe: string, tag: string, flag?: string): Promise; export declare function getApiVersionFromFilePath(filePath: string): string; /** * Gets provider namespace from the given path. In case of multiple, last one will be returned. * @param {string} pathStr The path of the operation. * Example "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/ * providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/ * {resourceName}/providers/Microsoft.Authorization/roleAssignments" * will return "Microsoft.Authorization". * * @returns {string} result - provider namespace from the given path. */ export declare function getProviderFromPathTemplate(pathStr?: string | null): string | undefined; /** * Gets provider resource type from the given path. * @param {string} pathStr The path of the operation. * Example "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/ * providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/ * {resourceName}/providers/Microsoft.Authorization/roleAssignments" * will return "roleAssignments". * * @returns {string} result - provider resource type from the given path. */ export declare function getResourceType(pathStr: string, provider?: string): string; /** * Gets last child resouce url to match. * @param {string} requestUrl The request url. * Example "/subscriptions/randomSub/resourceGroups/randomRG/providers/providers/Microsoft.Storage/ * storageAccounts/storageoy6qv/blobServices/default/containers/ * privatecontainer/providers/Microsoft.Authorization/roleAssignments/3fa73e4b-d60d-43b2-a248-fb776fd0bf60" * will return "roleAssignments". * * @returns {string} last child resource url. */ export declare function getLastResourceUrlToMatch(requestUrl: string): string; /** /* * Clones a github repository in the given directory. * @param {string} directory to where to clone the repository. * * @param {string} url of the repository to be cloned. * Example "https://github.com/Azure/azure-rest-api-specs.git" or * "git@github.com:Azure/azure-rest-api-specs.git". * * @param {string} [branch] to be cloned instead of the default branch. */ export declare function gitClone(directory: string, url: string, branch: string | undefined): void; export declare function removeDirSync(dir: string): void; export declare function getJsonContentType(consumesOrProduces: string[]): string | undefined; /** * Determines whether the given string is url encoded * @param {string} str - The input string to be verified. * @returns {boolean} result - true if str is url encoded; false otherwise. */ export declare function isUrlEncoded(str: string): boolean; export declare function kvPairsToObject(entries: any): any; /** * Sanitizes the file name by replacing special characters with * empty string and by replacing space(s) with _. * @param {string} str - The string to be sanitized. * @returns {string} result - The sanitized string. */ export declare const sanitizeFileName: (str: string) => string; /** * Contains the reverse mapping of http.STATUS_CODES */ export declare const statusCodeStringToStatusCode: lodash.Dictionary; export type Writable = { -readonly [P in keyof T]: T[P]; }; export declare const waitUntilLowLoad: () => Promise; export declare const shuffleArray: (a: any[]) => any[]; export declare const usePseudoRandom: { seed: number; }; export declare const resetPseudoRandomSeed: (seed?: number) => void; export declare const getRandomString: (length?: number) => any; export declare const findPathsToKey: (options: { key: string; obj: any; pathToKey?: string; }) => string[]; export declare const findPathToValue: (arr: string[], obj: any, value: string) => string[]; //# sourceMappingURL=utils.d.ts.map