import { Enum, Interface, IntrinsicType, Model, ModelProperty, Namespace, Numeric, Operation, Program, Scalar, Type, Union } from "@typespec/compiler"; import { HttpVerb } from "@typespec/http"; import { DeltaProperties } from "./entities/model.js"; import { MsGraphOperation } from "./entities/operation.js"; import { PathTree } from "./path-tree.js"; export interface GraphOperation { theOperation: Operation; verb: HttpVerb | undefined; graphRoute: string; } export interface MsGraphInterface { theInterface: Interface; operations: GraphOperation[]; path: string; } export declare function hasSchemaNamespace(program: Program, namespace: Namespace): boolean; export declare function getSchemaNamespaceName(program: Program, namespace: Namespace): string | undefined; /** * Returns the effective namespace alias for `namespace`, combining explicit and conventional aliases. * An explicit alias set by `@namespaceAlias` always takes precedence. * If `@namespaceAlias("")` is used (the opt-out sentinel), `undefined` is returned, suppressing * the conventional alias that would otherwise be derived from the schema namespace name. * If no decorator is set, a conventional alias is derived from the schema namespace name * when it follows the `microsoft.graph.` pattern. */ export declare function getEffectiveNamespaceAlias(program: Program, namespace: Namespace): string | undefined; /** Returns `true` when an effective alias exists (either explicit or conventional). */ export declare function hasEffectiveNamespaceAlias(program: Program, namespace: Namespace): boolean; export declare function getNameForType(program: Program, type: Type): string; export declare function getNameForModelType(program: Program, type: Model | Scalar | IntrinsicType, currentNamespace?: Namespace): string; export declare function getCSDLPrimitiveType(typespecType: string): string; export declare function isDictionaryType(program: Program, type: Type): boolean; export declare function generateDictionaryBaseType(program: Program, model: Model): string | undefined; export declare function getIdForType(program: Program, type: Type, currentNamespace?: Namespace): string; /** * Gets the ID for a type, using the namespace alias when referencing types * within the same namespace as the current context. */ export declare function getIdForTypeWithAlias(program: Program, type: Type, currentNamespace: Namespace): string; export declare function getNavigationTypeId(program: Program, getOperation: Operation): string; export declare function getInterfacesOfKinds(program: Program, navigationSources: Map, kinds: string[]): Map; export declare function isRouteIndexOfACollection(theInterface: Interface | undefined, graphRoute: string): boolean; export declare function getComposableFunctionSegmentFromGraphRoute(graphRoutePath: string): string | undefined; export declare function getCollectionIndexInterfaces(program: Program, navigationSources: Map): Map; export declare function getPropertyTypeName(program: Program, type: Type, currentNamespace?: Namespace): string; export declare function removeReferencePrefixFromType(typeName: string): string; export declare function isTypeNullable(program: Program, type: Type, targetTypeCheck?: (t: Type) => boolean): boolean; export declare function isNullType(type: Type): boolean; export declare function extractTypesFromUnion(type: Union): Type[]; export declare function getSingletonTypeId(program: Program, singletonType: string | null, getOperation: Operation | undefined): string | undefined; /** * Returns whether a type matches Graph's definition of a collection * @param program * @param type */ export declare function isTypeCollection(Program: Program, type: Type): boolean; /** * Returns whether a type is a collection whose element type is an entity. * * Per CE-1 (priority rule in the OData CSDL compliance skill), a collection of * entities is semantically a navigation-property URL segment, so `Nullable` * MUST NOT be emitted on it — regardless of the declaring element * (navigation property, bound parameter, etc.). Collections of * primitive/complex/enum values are unaffected. */ export declare function isEntityCollection(program: Program, type: Type): boolean; /** * Imported from typespec-azure * Returns the full namespace name for the given type, if available. * @param program the TypeSpec program * @param type the type to query * @returns The name of the namespace the type belongs in. */ export declare function getNamespaceName(program: Program, type: Model | Scalar | Operation | ModelProperty | Interface | Namespace | Enum | undefined): string; /** * Imported from typespec-azure * Returns true if the type is defined in a namespace that is excluded from linting. * @param program the TypeSpec program * @param type the type to query * @returns true if the type is defined in a namespace that is excluded from linting. */ export declare function isExcludedCoreType(program: Program, type: Model | Scalar | Operation | ModelProperty | Interface | Namespace | Enum): boolean; export declare function isExcludedLibraryType(program: Program, type: Model | Scalar | Operation | ModelProperty | Interface | Namespace | Enum): boolean; export declare function isNavigationProperty(program: Program, property: ModelProperty): boolean; export declare function isNavigationSource(theInterface: Interface): boolean; export declare function isTopLevelNavigationSource(theInterface: MsGraphInterface): boolean; export declare function getInterfaceNavigationSourceType(program: Program, theInterface: Interface): Model | undefined; export declare function getNavigationSourceType(program: Program, operation: Operation): Model | undefined; /** * Removes route path params from a route path * * Examples: * - user/{id}/manager -> user/manager * - user/{id}/friends/{friendId}/hobbies -> user/friends/hobbies * - user/{user-id}/friends/{friend-id}/hobbies -> user/friends/hobbies */ export declare function removeRoutePathParams(routePath: string): string; export declare function isSameNamespace(program: Program, model: Model, baseModel?: Model): boolean; export declare function isTypeDefinedInExternalLibrary(program: Program, type: Type): boolean; export declare function isTypeDefinedInLocalProject(program: Program, type: Type): boolean; export declare function isExcludedFromGraphStudioRules(program: Program, type: Model | Scalar | Operation | ModelProperty | Interface | Namespace | Enum): boolean; /** * Recursively get all source interfaces of an interface * @param theInterface * @returns an array of all source interfaces */ export declare function getSourceInterfaces(theInterface: Interface): Interface[]; export declare function getModelStructuralPropertyNames(program: Program, model: Model): string[]; export declare function getAllModelPropertyNames(program: Program, model: Model): string[]; export declare function getModelProperties(program: Program, model: Model, structuralPropertiesOnly?: boolean): ModelProperty[]; export declare function isInterfaceBindingTypeOwned(program: Program, $interface: Interface): boolean; export declare function getNestedComplexTypes(program: Program, model: Model, nestedModels?: Set): Set; export declare function generateDeltaPropertiesForNavigationProperties(program: Program, navigationProperty: ModelProperty): DeltaProperties | undefined; export declare function getInterfacesTargetingModel(program: Program, type: Type): Interface[]; export declare function getDeltaProperties(program: Program, entity: Interface): DeltaProperties | undefined; export declare function isCollection(theInterfaces: Interface[]): boolean; export declare function isUnion(type: Type): boolean; export declare function filterMapByIdenticalValues(inputMap: Map): Map; export declare function getAllNestedNavigationPaths(program: Program, model: Model): string[]; export declare function removeTrailingSlash(path: string): string; /** * * @param obj1 Function that checks for equality of two objects * @param obj2 * @returns */ export declare function isEqual(obj1: T, obj2: T): boolean; export declare function checkFunctionOverloadsWithReturnType(operation1: MsGraphOperation, operation2: MsGraphOperation): boolean; export declare function checkFunctionOverloads(operation1: MsGraphOperation, operation2: MsGraphOperation): boolean; /** * @returns a Model type if the underlying type is a model, undefined otherwise */ export declare function getTypeModel(program: Program, type: Type, structuralPropertiesOnly?: boolean): Model | undefined; export declare function getActualType(program: Program, type: Type, structuralPropertiesOnly?: boolean): Type | undefined; export declare function cleanGraphRoutePath(path: string): string; export declare function buildPathTree(program: Program): PathTree; export declare function getParentModelForPropertyFromGraphRoute(pathTree: PathTree, graphRoutePath: string): Model | undefined; export declare function isParentSharedEntity(program: Program, model: Model): boolean; export declare function splitWords(name: string): string[]; export declare function findOneOfWordsIC(value: string, targetWords: Array): string | null; export declare function toSameFirstCharCasingAs(value: string, other: string): string; export declare function toCamelCase(str: string): string; export declare function getDefaultPropertyValue(property: ModelProperty): string | boolean | Numeric | undefined; export declare function isPlural(word: string): boolean; export declare function isSingular(word: string): boolean; /** * Cleans up documentation strings by removing backticks around @ symbols. * TypeSpec uses backticks to escape @ in doc comments, but we don't want them in CSDL output. * Converts: username`@`tenant.com -> username@tenant.com */ export declare function cleanDescription(description: string | undefined): string | undefined; /** * Checks if a string starts with another string (case-insensitive) * Matches C# StartsWithVariantIC logic: splits value into words and compares * the first word against the prefix and its singular/plural forms */ export declare function startsWithVariantIC(value: string, prefix: string): boolean; //# sourceMappingURL=utils.d.ts.map