UNPKG

@azure-tools/typespec-java

Version:

TypeSpec library for emitting Java client from the TypeSpec REST protocol binding

50 lines 3.22 kB
import { SdkBodyModelPropertyType, SdkDurationType, SdkModelType, SdkType } from "@azure-tools/typespec-client-generator-core"; import { IntrinsicScalarName, Model, Namespace, Program, Scalar, TemplatedTypeBase, Type, TypeNameOptions, Union, Value } from "@typespec/compiler"; import { DurationSchema } from "./common/schemas/time.js"; import { SchemaContext } from "./common/schemas/usage.js"; export declare const DURATION_KNOWN_ENCODING: string[]; export declare const DATETIME_KNOWN_ENCODING: string[]; export declare const BYTES_KNOWN_ENCODING: string[]; /** Acts as a cache for processing inputs. * * If the input is undefined, the output is always undefined. * for a given input, the process is only ever called once. */ export declare class ProcessingCache<In, Out> { private transform; private results; constructor(transform: (orig: In, ...args: Array<any>) => Out); has(original: In | undefined): boolean; set(original: In, result: Out): Out; get(original: In): Out | undefined; process(original: In | undefined, ...args: Array<any>): Out | undefined; } /** adds only if the item is not in the collection already * * @note While this isn't very efficient, it doesn't disturb the original * collection, so you won't get inadvertent side effects from using Set, etc. */ export declare function pushDistinct<T>(targetArray: Array<T>, ...items: Array<T>): Array<T>; export declare function modelContainsDerivedModel(model: Model): boolean; export declare function isModelReferredInTemplate(template: TemplatedTypeBase, target: Model): boolean; export declare function isNullableType(type: Type): boolean; export declare function getNonNullSdkType(type: SdkType): SdkType; export declare function getDefaultValue(value: Value | undefined): any; export declare function getDurationFormat(type: SdkDurationType): DurationSchema["format"]; export declare function hasScalarAsBase(type: Scalar, scalarName: IntrinsicScalarName): boolean; export declare function unionReferredByType(program: Program, type: Type, cache: Map<Type, Union | null | undefined>): Union | null; export declare function getUnionDescription(union: Union, typeNameOptions: TypeNameOptions): string; export declare function modelIs(model: SdkModelType, name: string, namespace: string): boolean; export declare function getAccess(type: Type | undefined, accessCache: Map<Namespace, string | undefined>): string | undefined; export declare function isAllValueInteger(values: number[]): boolean; export declare function getUsage(type: Type | undefined, usageCache: Map<Namespace, SchemaContext[] | undefined>): SchemaContext[] | undefined; /** * Check if a given model or model property is an ARM common type. * This is copied from typespec-azure-resource-manager. We don't want to depend on this package since it now has weird dependency on typespec-autorest. * * @param {Type} entity - The entity to be checked. * @return {boolean} - A boolean value indicating whether an entity is an ARM common type. */ export declare function isArmCommonType(entity: Type): boolean; export declare function getPropertySerializedName(property: SdkBodyModelPropertyType): string; //# sourceMappingURL=type-utils.d.ts.map