declare enum Aggregator { AVERAGE = "Average", COUNT = "Count", MAX = "Max", MEDIAN = "Median", MIN = "Min", MODE = "Mode", SUM = "Sum", BASICGROUPEDMEDIAN = "BasicGroupedMedian", CALCULATEDMOE = "CalculatedMoe", QUANTILE = "Quantile", REPLICATEWEIGHTMOE = "ReplicateWeightMoe", WEIGHTEDAVERAGE = "WeightedAverage", WEIGHTEDAVERAGEMOE = "WeightedAverageMoe", WEIGHTEDSUM = "WeightedSum", DISTINCTCOUNT = "DistinctCount" } declare enum DataType { BOOLEAN = "bool", DATE = "date", TIME = "time", DATETIME = "dttm", TIMESTAMP = "stmp", FLOAT32 = "f32", FLOAT64 = "f64", INT8 = "i8", INT16 = "i16", INT32 = "i32", INT64 = "i64", INT128 = "i128", UINT8 = "u8", UINT16 = "u16", UINT32 = "u32", UINT64 = "u64", UINT128 = "u128", STRING = "str" } declare enum RelationalOperator { EQ = "eq", GT = "gt", GTE = "gte", LT = "lt", LTE = "lte", NEQ = "neq" } declare enum DimensionType { GEO = "geo", STANDARD = "standard", TIME = "time" } declare enum Format { csv = "csv", csvbom = "csvbom", jsonarrays = "jsonarrays", jsonrecords = "jsonrecords", parquet = "parquet", tsv = "tsv", tsvbom = "tsvbom", xlsx = "xlsx" } declare enum Order { ASC = "asc", DESC = "desc" } declare enum TimeScale { YEAR = "year", QUARTER = "quarter", MONTH = "month", WEEK = "week", DAY = "day" } declare enum GeoScale { ADM0 = "adm0", ADM1 = "adm1", ADM2 = "adm2", PORT = "port" } declare enum MembershipOperator { IN = "in", NOT_IN = "nin" } declare enum NullityOperator { IS_NULL = "isnull", IS_NOT_NULL = "isnotnull" } declare enum LogicOperator { AND = "and", OR = "or", XOR = "xor" } declare enum Restriction { COMPLETE = "complete", TRAILING = "trailing", LEADING = "leading", LATEST = "latest", OLDEST = "oldest" } /** * Finds a member of an enum by its key or value, with special handling for symbol-like tokens. * * This function attempts to match a string value against a TypeScript enum in several ways: * 1. It checks for special symbol mappings (e.g., "!=" -> "neq"). * 2. It checks for a case-insensitive match against the enum's keys. * 3. It checks for a case-sensitive match against the enum's values. * * This allows for more flexible parsing of enum values from various sources. * * @param dict The enum object to search within. * @param value The string value to match. * @returns The corresponding enum member. * @throws If the value does not correspond to any key, value, or symbol in the enum. */ declare function matchEnumProperty(dict: T, value: string): T[keyof T]; type MaybeTrailing = T | [...T, U]; type StringSuggests = T | (string & {}); type MappingSet = `${string}:${string}`[]; type MappingMap = { [k: string]: T; }; type FilterSet = `${string}.${ConditionString}`[]; type FilterMap = { [k: string]: AnyCondition | string; }; type SingleConditionString = `${RelationalOperator}.${string}` | `${MembershipOperator}.${string}` | `${NullityOperator}`; type ConditionString = SingleConditionString | `${SingleConditionString}.${LogicOperator}.${SingleConditionString}`; type ConditionTypeMap = { relational: ConditionRelational; membership: ConditionMembership; nullity: ConditionNullity; composite: ConditionComposite; }; type AnyCondition = ConditionTypeMap[keyof ConditionTypeMap]; interface ConditionRelational { type: "relational"; operator: RelationalOperator | `${RelationalOperator}`; value: string | number; } interface ConditionMembership { type: "membership"; operator: MembershipOperator | `${MembershipOperator}`; values: string[] | number[]; } interface ConditionNullity { type: "nullity"; operator: NullityOperator | `${NullityOperator}`; } interface ConditionComposite { type: "composite"; operator: LogicOperator | `${LogicOperator}`; conditions: AnyCondition[]; } type LimitString = `${number}` | `${number},${number}`; type LimitTuple = [number] | [number, number]; type RankingMap = { [k: string]: Order | `${Order}`; }; type SortString = `${string}.${Order}`; type SortTuple = [string, Order | `${Order}`]; type TimeTuple = MaybeTrailing<[string, Restriction | `${Restriction}`], number> | [string, ConditionString]; interface TimeObject { level: string | `${TimeScale}`; constraint: [Restriction.COMPLETE] | [Restriction.LATEST | Restriction.OLDEST, number] | [Restriction.LEADING | Restriction.TRAILING, number] | AnyCondition; } type TopkTuple = [number, string | string[], string, Order | `${Order}`]; interface TopkObject { levels: string[]; measure: string; order: Order | `${Order}`; amount: number; } type GrowthTuple = MaybeTrailing<["cagr", string, string], boolean> | MaybeTrailing<["fixed", string, string, string], boolean> | MaybeTrailing<["period", string, string, number], boolean>; interface GrowthObject { method: "cagr" | "period" | "fixed"; level: string; measure: string; param?: string; filter: boolean; } interface Annotations { [k: string]: string | undefined; } interface SchemaAnnotations extends Annotations { } interface CubeAnnotations extends Annotations { } interface MeasureAnnotations extends Annotations { } interface DimensionAnnotations extends Annotations { } interface HierarchyAnnotations extends Annotations { } interface LevelAnnotations extends Annotations { } interface PropertyAnnotations extends Annotations { } interface TesseractErrorResponse { /** Indicates if an error occurred */ error: true; /** Detailed error message */ detail: string; /** Whether debug mode is enabled */ debug_mode?: boolean; /** Type of error that occurred */ type?: string; /** Stack trace for debugging */ traceback?: string[]; } interface TesseractStatusResponse { /** Name of the module */ module: string; /** Version of the module */ version: string; /** Whether debug mode is enabled */ debug: boolean; /** Current status of the module */ status: "ok" | "error"; } interface TesseractSchemaRequest { /** Locale for localized responses */ locale?: string; /** * Include all entities in the schema, even non-visible ones. * When false (default), only visible entities are included. * When true, includes all entities. */ show_all?: boolean; } interface TesseractSchemaResponse { /** Name of the schema */ name: string; /** Available locales for this schema */ locales: string[]; /** Default locale for this schema */ default_locale: string; /** Additional metadata annotations */ annotations: SchemaAnnotations; /** Available cubes in this schema */ cubes: TesseractCube[]; } interface TesseractCubeRequest { /** Name of the cube to retrieve */ cube: string; /** Locale for localized responses */ locale?: string; /** * Include all entities in the schema, even non-visible ones. * When false (default), only visible entities are included. * When true, includes all entities. */ show_all?: boolean; } interface TesseractDataRequest { /** The name of the cube to work with */ cube: string; /** * A list of the level names to slice the bulk of the aggregated data * @example LevelName,LevelName,LevelName */ drilldowns: string | string[]; /** * A list of the measure names to retrieve from the aggregated data * @example Measure,Measure,Measure */ measures: string | string[]; /** * A list of pairs of drilldown name and aliased name. * Both terms are separated by colon, and multiple pairs by semicolon. * @example Exporter Continent:Continent;Exporter Country:Country */ alias?: string | MappingSet | MappingMap; /** * Excludes specific members from the results * @example Level:key,key,key;Level:key,key,key */ exclude?: string | MappingSet | MappingMap; /** * Filters the data based on measure conditions * @example Measure.gt.10000.and.lt.60000,Measure.lt.100000 */ filters?: string | FilterSet | FilterMap; /** * Includes only specific members in the results * @example Level:key,key,key;Level:key,key,key */ include?: string | MappingSet | MappingMap; /** * Specifies pagination on the results. The shape is one integer (limit) or * two integers separated by comma (limit,offset) * @example 2,5 */ limit?: LimitString | LimitTuple; /** * Locale for localized responses * @example es */ locale?: string; /** * Specifies if the request should include the labels for the parent levels * of the selected drilldowns. * A boolean enables parents for all levels, or you can specify specific levels. * @example true * @example Level,Level */ parents?: string | string[] | boolean; /** * Additional properties to include in the response * @example Property,Property */ properties?: string | string[]; /** * Adds a Ranking column to the specified measures. * A boolean sets rankings for all measures in descending order. * If setting measure names, order can be set with or without a leading minus. * @example true * @example Measure,-Measure */ ranking?: string | string[] | RankingMap | boolean; /** * Specifies the sorting order for the results * @example Measure.asc * @example Property.desc */ sort?: SortString | SortTuple; /** * Determines if the request should return the full cardinality of available * options, even if their associated value is null. * @default true */ sparse?: StringSuggests<`${boolean}`> | boolean; /** * Time-based filtering for the data * @example month.latest.6 * @example Level.oldest */ time?: string | TimeTuple | TimeObject; /** * Slices the resulting items to only the highest/lowest N items by the value * of Measure, for all the subgroups signaled by the Level parameters. * @example 10.Level.Measure.asc * @example 3.Level,Level.Measure.desc */ top?: string | TopkTuple | TopkObject; /** * Calculates the growth in Measure for each Level using one of these methods: * - cagr: Calculates the Compound Annual Growth Rate for the whole request * - fixed: Calculates growth against a fixed member key from Level * - period: Calculates growth comparing a time point with its previous N point * The last param is a boolean that indicates if the result should keep or discard * the rows whose calculated growth is null by not having a previous period. * @example cagr.Level.Measure.true * @example fixed.Level.Measure.201804.true * @example period.Level.Measure.3 */ growth?: string | GrowthTuple | GrowthObject; } interface TesseractDataResponse { /** Indicates if an error occurred */ error?: true; /** Detailed error message */ detail?: string; /** Column names in the response */ columns: string[]; /** The actual data rows */ data: Record[]; /** Pagination information */ page: { /** Maximum number of items per page */ limit: number; /** Offset from the beginning of the result set */ offset: number; /** Total number of items available */ total: number; }; } interface TesseractMembersRequest { /** Name of the cube to query */ cube: string; /** Locale for localized responses */ locale?: string; /** Name of the level to get members for */ level: string; /** Name of additional Properties from the specified Level to include */ properties?: string | string[]; /** Pagination limit */ limit?: LimitString | LimitTuple; /** Whether to include parent members */ parents?: boolean; /** Search term to filter members */ search?: string; } interface TesseractMembersResponse { /** Name of the relevant level */ name: string; /** Public localized name of the relevant level */ caption: string; /** Depth of the level in the hierarchy */ depth: number; /** Additional metadata annotations */ annotations: LevelAnnotations; /** Determines the scale of data this level represents. */ scale: `${TimeScale}` | `${GeoScale}` | null; /** Properties available for this level */ properties: TesseractProperty[]; /** Data types for each property */ dtypes: { [K: string]: `${DataType}`; }; /** List of members at this level */ members: TesseractMember[]; } interface TesseractCube { /** Name of the cube */ name: string; /** Public localized name of the cube */ caption: string; /** Additional metadata annotations */ annotations: CubeAnnotations; /** Dimensions available in this cube */ dimensions: TesseractDimension[]; /** Measures available in this cube */ measures: TesseractMeasure[]; } interface TesseractMeasure { /** Name of the measure */ name: string; /** Public localized name of the measure */ caption: string; /** Additional metadata annotations */ annotations: MeasureAnnotations; /** Aggregation function used for this measure */ aggregator: Aggregator; /** Attached measures (for calculated measures) */ attached: TesseractMeasure[]; } interface TesseractDimension { /** Name of the dimension */ name: string; /** Public localized name of the dimension */ caption: string; /** Additional metadata annotations */ annotations: DimensionAnnotations; /** Type of the dimension */ type: `${DimensionType}`; /** Hierarchies available in this dimension */ hierarchies: TesseractHierarchy[]; /** Default hierarchy for this dimension */ default_hierarchy: string; } interface TesseractHierarchy { /** Name of the hierarchy */ name: string; /** Public localized name of the hierarchy */ caption: string; /** Additional metadata annotations */ annotations: HierarchyAnnotations; /** Levels in this hierarchy */ levels: TesseractLevel[]; } interface TesseractLevel { /** Name of the level */ name: string; /** Public localized name of the level */ caption: string; /** Additional metadata annotations */ annotations: LevelAnnotations; /** Depth of this level in the hierarchy */ depth: number; /** Determines the scale of data this level represents. */ scale: `${TimeScale}` | `${GeoScale}` | null; /** Properties available at this level */ properties: TesseractProperty[]; /** Number of members at this level */ count?: number; } interface TesseractProperty { /** Name of the property */ name: string; /** Public localized name of the property */ caption: string; /** Additional metadata annotations */ annotations: PropertyAnnotations; /** Data type of the property */ type: `${DataType}`; } interface TesseractMember { /** The unique ID for this member */ key: string | number; /** The localized label for this member */ caption?: string; /** A list of direct ancestor members, one per level above this one */ ancestor?: TesseractMember[]; /** A mapping of optional properties associated to each member, as requested by the user. */ properties?: Record; } interface ComplexityStatusResponse { /** Name of the module */ module: string; /** Version of the module */ version: string; /** Whether debug mode is enabled */ debug: boolean; /** Current status of the module */ status: "ok" | "error"; /** Status of the World Development Indicators integration */ wdi: "enabled" | "disabled"; } interface CommonRequest { /** Aliases for measure names in the response */ alias?: string | `${string}:${string}`[]; /** Filters to apply to the data */ filter?: string | `${string}:${string}`[]; /** Locale for localized responses */ locale?: string; /** Authentication token for private datasets */ token?: string; } interface CommonRcaRequest extends CommonRequest { /** Name of the cube to query */ cube: string; /** Name of a level representing a economic activity or product to analyze */ activity: string; /** Name of a Level representing a geographic location to analyze */ location: string; /** Measure to use for calculations */ measure: string; /** Additional cuts to apply to the data */ cuts?: string | `${string}:${string}`[]; /** Whether to include parent levels */ parents?: boolean; /** Threshold values for filtering results */ threshold?: string | `${string}:${RelationalOperator}:${number}`[]; } interface RcaRequest extends CommonRcaRequest { type: "rca"; /** Whether to sort results in ascending order */ ascending?: boolean; /** Whether to include ranking information */ rank?: boolean; } interface ComplexityIndexRequest extends CommonRcaRequest { type: "eci" | "pci"; /** Whether to sort results in ascending order */ ascending?: boolean; /** Cutoff value for filtering results */ cutoff?: number; /** Number of iterations for the algorithm */ iterations?: number; /** Whether to include ranking information */ rank?: boolean; } interface RelatednessRequest extends CommonRcaRequest { type: "relatedness"; /** Whether to sort results in ascending order */ ascending?: boolean; /** Cutoff value for filtering results */ cutoff?: number; /** Whether to include ranking information */ rank?: boolean; } interface RelativeRelatednessRequest extends CommonRcaRequest { type: "relative_relatedness"; /** Whether to sort results in ascending order */ ascending?: boolean; /** Cutoff value for filtering results */ cutoff?: number; /** Number of iterations for the algorithm */ iterations?: number; /** Whether to include ranking information */ rank?: boolean; } interface OpportunityRequest extends CommonRcaRequest { type: "opportunity_gain"; /** Whether to sort results in ascending order */ ascending?: boolean; /** Cutoff value for filtering results */ cutoff?: number; /** Whether to include ranking information */ rank?: boolean; } interface GiniRequest extends CommonRcaRequest { type: "pgi"; /** Name of the cube containing Gini coefficient data */ gini_cube: string; /** Geographic location for Gini coefficient calculation */ gini_location: string; /** Measure to use for Gini coefficient calculation */ gini_measure: string; /** Whether to sort results in ascending order */ ascending?: boolean; /** Cutoff value for filtering results */ cutoff?: number; /** Whether to include ranking information */ rank?: boolean; } interface EmissionsRequest extends CommonRcaRequest { type: "peii"; /** Name of the cube containing emissions data */ emissions_cube: string; /** Geographic location for emissions calculation */ emissions_location: string; /** Measure to use for emissions calculation */ emissions_measure: string; /** Whether to sort results in ascending order */ ascending?: boolean; /** Cutoff value for filtering results */ cutoff?: number; /** Whether to include ranking information */ rank?: boolean; } type ComplexityRequestMap = { rca: RcaRequest; eci: ComplexityIndexRequest; pci: ComplexityIndexRequest; relatedness: RelatednessRequest; relative_relatedness: RelativeRelatednessRequest; opportunity_gain: OpportunityRequest; pgi: GiniRequest; peii: EmissionsRequest; }; type AnyComplexityRequest = ComplexityRequestMap[keyof ComplexityRequestMap]; declare class ComplexityModuleClient { baseURL: string; requestConfig: RequestInit; constructor(baseURL?: string | URL, config?: RequestInit); getStatusURL(): URL; fetchStatus(init?: RequestInit): Promise; getSchemaURL(params: TesseractSchemaRequest): URL; fetchSchema(params: TesseractSchemaRequest, init?: RequestInit): Promise; getCubeURL(params: TesseractCubeRequest): URL; fetchCube(params: TesseractCubeRequest, init?: RequestInit): Promise; getDataURL(params: AnyComplexityRequest, format?: `${Format}`): URL; fetchData(params: AnyComplexityRequest, format?: `${Format}`, init?: RequestInit): Promise; } declare function isMappedString(value: string): value is `${string}:${string}`; declare class TesseractModuleClient { baseURL: string; requestConfig: RequestInit; constructor(baseURL?: string | URL, config?: RequestInit); static Alias: { serialize(obj: string | MappingSet | MappingMap | undefined): string; serializeSet(obj: MappingSet): string; serializeMap(obj: MappingMap): string; deserialize(str: string): { [k: string]: string; }; }; static Bool: { serialize(obj: string | boolean | undefined): string; deserialize(str: string): boolean; }; static Condition: { serialize(obj: AnyCondition | string): string; serializeComposite(obj: ConditionComposite): string; serializeRelational(obj: ConditionRelational): string; serializeMembership(obj: ConditionMembership): string; serializeNullity(obj: ConditionNullity): string; deserialize(str: string): AnyCondition; deserializeComposite(str: string): ConditionComposite; deserializeComparison(str: string): ConditionRelational; deserializeMembership(str: string): ConditionMembership; deserializeNullity(str: string): ConditionNullity; "new"(type: T, params: Omit): ConditionTypeMap[T]; join(left: AnyCondition, operator: LogicOperator, right: AnyCondition): ConditionComposite; }; static Cuts: { serialize(obj: string | MappingSet | MappingMap | undefined): string; serializeSet(obj: MappingSet): string; serializeMap(obj: MappingMap): string; serializeToken(obj: [string, string[]]): string; deserialize(str: string): { [k: string]: string[]; }; deserializeToken(str: string): [string, string[]]; }; static Filters: { serialize(obj: string | FilterSet | FilterMap | undefined): string; serializeSet(obj: FilterSet): string; serializeMap(obj: FilterMap): string; deserialize(str: string): { [k: string]: AnyCondition; }; }; static Growth: { serialize(obj: string | GrowthTuple | GrowthObject | undefined): string; serializeTuple(obj: GrowthTuple): string; serializeObject(obj: GrowthObject): string; deserialize(str: string): GrowthObject | undefined; }; static Limit: { serialize(obj: string | string[] | number[] | undefined): LimitString; deserialize(str: string): LimitTuple; }; static Parents: { serialize(obj: string | boolean | string[] | undefined): string; deserialize(str: string): boolean | string[]; }; static Ranking: { serialize(obj: string | boolean | string[] | RankingMap | undefined): string; serializeSet(obj: string[]): string; serializeMap(obj: RankingMap): string; deserialize(str: string): boolean | RankingMap; }; static Sort: { serialize(obj: string | SortTuple | undefined): SortString; deserialize(str: string): SortTuple; }; static Time: { serialize(obj: string | TimeTuple | TimeObject | undefined): string; serializeTuple(obj: TimeTuple): string; serializeObject(obj: TimeObject): string; deserialize(str: string): TimeObject | undefined; }; static Topk: { serialize(obj: string | TopkTuple | TopkObject | undefined): string; serializeTuple(obj: TopkTuple): string; serializeObject(obj: TopkObject): string; deserialize(str: string): TopkObject | undefined; }; static isMappedString: typeof isMappedString; getStatusURL(): URL; fetchStatus(init?: RequestInit): Promise; getSchemaURL(params: TesseractSchemaRequest): URL; fetchSchema(params: TesseractSchemaRequest, init?: RequestInit): Promise; getCubeURL(params: TesseractCubeRequest): URL; fetchCube(params: TesseractCubeRequest, init?: RequestInit): Promise; static serializeDataURLSearchParams(params: TesseractDataRequest): URLSearchParams; static deserializeDataURLSearchParams(search: string | URLSearchParams): TesseractDataRequest; getDataURL(params: TesseractDataRequest, format?: `${Format}`): URL; fetchData(params: TesseractDataRequest, format?: `${Format}`, init?: RequestInit): Promise; static serializeMembersURLSearchParams(params: TesseractMembersRequest): URLSearchParams; static deserializeMembersURLSearchParams(search: string | URLSearchParams): TesseractMembersRequest; getMembersURL(params: TesseractMembersRequest): URL; fetchMembers(params: TesseractMembersRequest, init?: RequestInit): Promise; } /** * Merges multiple HeadersInit values into a single Headers object. * Later sources override earlier ones when the same header key appears. * * @param sources - One or more HeadersInit values to merge * @returns A new Headers object with all headers combined */ declare function mergeHeaders(...sources: (HeadersInit | undefined)[]): Headers; /** * Merges two RequestInit objects, combining headers at the header level * rather than replacing them. Override properties take precedence over base * for all non-header properties. * * @param base - The base RequestInit configuration * @param override - Optional per-request overrides to merge on top * @returns A new RequestInit with combined properties */ declare function mergeRequestInit(base: RequestInit, override?: RequestInit): RequestInit; export { Aggregator, type Annotations, type ComplexityIndexRequest, ComplexityModuleClient, type ComplexityStatusResponse, type CubeAnnotations, DataType, type DimensionAnnotations, DimensionType, type EmissionsRequest, Format, GeoScale, type GiniRequest, type HierarchyAnnotations, type LevelAnnotations, LogicOperator, type MeasureAnnotations, MembershipOperator, NullityOperator, type OpportunityRequest, Order, type PropertyAnnotations, type RcaRequest, type RelatednessRequest, RelationalOperator, type RelativeRelatednessRequest, Restriction, type SchemaAnnotations, type TesseractCube, type TesseractCubeRequest, type TesseractDataRequest, type TesseractDataResponse, type TesseractDimension, type TesseractErrorResponse, type TesseractHierarchy, type TesseractLevel, type TesseractMeasure, type TesseractMember, type TesseractMembersRequest, type TesseractMembersResponse, TesseractModuleClient, type TesseractProperty, type TesseractSchemaRequest, type TesseractSchemaResponse, type TesseractStatusResponse, TimeScale, matchEnumProperty, mergeHeaders, mergeRequestInit };