/** @packageDocumentation * @module Locaters */ import { Schema, SchemaContext, SchemaKey, SchemaMatchType } from "@itwin/ecschema-metadata"; /** * A SchemaKey implementation that aids in identifying Schema files via the * addition of two properties: fileName and schemaText. The fileName contains the * full path to the file on disk and schemaText is the full string representation * of the Schema. * @internal */ export declare class FileSchemaKey extends SchemaKey { fileName: string; schemaText?: string; /** * Initializes a new FileSchemaKey object. * @param key The EC SchemaKey identifying the Schema. * @param fileName The full path to the Schema file. * @param schemaText The string representation of the Schema * loaded from disk. Optional. */ constructor(key: SchemaKey, fileName: string, schemaJson?: string); } /** * Abstract class to hold common/overlapping functionality between SchemaJsonFileLocater and SchemaXmlFileLocater * @public @preview */ export declare abstract class SchemaFileLocater { /** @internal */ searchPaths: string[]; constructor(); /** @internal */ protected readUtf8FileToString(filePath: string): Promise; /** @internal */ protected readUtf8FileToStringSync(filePath: string): string | undefined; /** @internal */ protected fileExists(filePath: string): Promise; /** @internal */ protected fileExistsSync(filePath: string): boolean | undefined; /** * Adds more search paths used by this locator to find the * Schema files. * @param schemaPaths An array of search paths to add */ addSchemaSearchPaths(schemaPaths: string[]): void; /** * Add one search path used by this locator to find the * Schema files. * @param schemaPath A search path to add */ addSchemaSearchPath(schemaPath: string): void; protected abstract getSchemaKey(data: string): SchemaKey; /** * Adds SchemaKeys to the provided foundFiles collection that match the desired SchemaKey. This method * only attempts to find schema files that have no version in the file name. * @param foundFiles The collection of SchemaKeys found in the given directory. * @param schemaPath The directory in which to search for the Schemas. * @param schemaName The short name of the Schema (without version). * @param desiredKey The SchemaKey used to find matching Schema files. * @param matchType The SchemaMatchType to use when comparing the desiredKey and the keys found during the search. * @param format The type of file that the schema key refers to. json or xml */ private addCandidateNoExtSchemaKey; /** * Adds SchemaKeys to the provided foundFiles collection that match the desired SchemaKey * @param foundFiles The collection of SchemaKeys found in the given directory * @param schemaPath The directory in which to search for the Schemas * @param fileFilter The file filter, potentially with wildcards, used to locate the Schema files. * @param desiredKey The schemaKey used to find matching Schema files * @param matchType The SchemaMatchType to use when comparing the desired Key and the keys found during the search. * @param format The type of file that the schema key refers to. json or xml */ private addCandidateSchemaKeys; /** * Attempts to find all Schema files in the configurable search paths that match * the desired SchemaKey. * @param desiredKey The SchemaKey to match. * @param matchType The SchemaMatchType. * @param format The type of file that the schema key refers to. json or xml * @internal */ protected findEligibleSchemaKeys(desiredKey: SchemaKey, matchType: SchemaMatchType, format: string): FileSchemaKey[]; /** * Attempts to retrieve a Schema with the given SchemaKey by using the configured search paths * to locate the XML Schema file from the file system. Returns only Schemas from XML files with * their keys populated. * @param key The SchemaKey of the Schema to retrieve. * @param matchType The SchemaMatchType. * @param context The SchemaContext that will control the lifetime of the schema. */ abstract getSchema(key: SchemaKey, matchType: SchemaMatchType, context: SchemaContext): Promise; /** * Compares two Schema versions. If the left-hand version is greater, 1 is returned. If the * left-hand version is less, -1 us returned. If the versions are an exact match, 0 is returned. * @param lhs The 'left-hand' FileSchemaKey. * @param rhs The 'right-hand' FileSchemaKey. * @internal */ compareSchemaKeyByVersion: (lhs: FileSchemaKey, rhs: FileSchemaKey) => number; } //# sourceMappingURL=SchemaFileLocater.d.ts.map