import { ElementType } from '../../interfaces'; import { AttributeData, AttributeValueTypeElement, CloneConfig, ElementData, ElementDataWrapper, ElementRaw, ElementSchemaVersion, ElementTemplateV1, ElementTypeDefinition, ElementTypePrivilegesList, GetElementV1Response, GetElementV2Response, GoUrlsResponse, MembraneGetError, Operation, RestApiLink, StartChecklistData, StartChecklistResponse } from '../../interfaces/element.interface'; import type { Api, ApiResponse } from '../api'; export interface ElementPrivileges { type: string[]; attributes: { [attribute: string]: string[]; }; } interface ElementPrivilegesResponse { 'element-type': { id: string; }; organization: { id: string; }; privileges: ElementPrivileges; user: { id: string; }; } export interface MetadataResponse { elements: { [hash: string]: { element: ElementData; }; }; } export interface ElementSearchHit extends AttributeValueTypeElement { 'hits-by-attributes': HitsByAttributes[]; /** * Attributes projected onto the result card, keyed by attribute name and * rendered in the same shape as a normal element load. Present only when the * request carried a `projection` map with entries for this element's type. */ 'projected-attributes'?: Record; /** * Attributes whose value matched the search term but that are not already * projected, rendered in the same shape as a normal element load. Present only * when the request set `matched: true`; the card shows and highlights these * below the projected attributes. */ 'matched-attributes'?: Record; } interface HitsByAttributes { [attributeKey: string]: string[]; } export interface ElementTypeCount { type: string; count: number; } export interface GetElementSearch { all_count: number; from: number; to: number; 'hits-by-attributes': HitsByAttributes; data: ElementSearchHit[]; /** * Present only when the request was made with `categorize: true`. * Full list of matching element types with per-type counts, sorted by * count desc — drives the result tabs. */ 'element-types'?: ElementTypeCount[]; /** * Present only when the request was made with `categorize: true`. * The element type id used to populate `data`; `all_count` reflects this * type's total. Absent when there are no matches. */ 'selected-type'?: string; } export interface GetElementSearchMembrane extends GetElementSearch { encounteredVisibilityExceptions?: boolean; } export interface ElementFulltextSearchBody { query: string; page?: number; archived?: boolean; per_page?: number; /** Opt-in: when omitted/false the response is the legacy flat shape. */ categorize?: boolean; /** * Ordered list of preferred element type ids. Present types lead the tabs in * this order; absent ones are ignored. Ignored unless `categorize` is true. */ type?: string[]; /** Restrict the search (and its type tabs) to elements owned by this organization. */ organization?: string; /** * Per-type map of attribute keys to project onto result cards * (`{ [typeId]: string[] }`). Each hit is projected using only its own type's * list. Ignored unless `categorize` is true. */ projection?: Record; /** * Opt-in: also return the attributes whose value matched the search term (and * aren't already projected) as `matched-attributes`, so the card can highlight * where the term was found. Absent/false leaves the response unchanged. */ matched?: boolean; } export interface ElementSearchOptions { page: number; archived: boolean; per_page?: number; /** Restrict the search to elements owned by this organization. */ organization?: string; } export interface CategorizedSearchOptions { page?: number; archived?: boolean; per_page?: number; /** * Ordered list of preferred element type ids. Present types lead the tabs in * this order and the first present one becomes the active tab; absent ones are * ignored (falls back to the most-popular type). */ type?: string[]; /** Restrict the search (and its type tabs) to elements owned by this organization. */ organization?: string; /** * Per-type map of attribute keys to project onto result cards * (`{ [typeId]: string[] }`). Each hit is projected using only its own type's * list. */ projection?: Record; /** * Opt-in: also return the attributes whose value matched the search term (and * aren't already projected) as `matched-attributes`, for highlighting on the * result cards. */ matched?: boolean; } export interface CategorizedSearchResult { /** Full tab list: every matching element type with its count badge. */ tabs: ElementTypeCount[]; /** Element type id used to populate `data`; undefined when there are no matches. */ selectedType?: string; /** Results of `selectedType` only. */ data: ElementSearchHit[]; /** Total count for `selectedType` — use for the active tab's pagination. */ allCount: number; from: number; to: number; } type MultipartFile = { filename?: string; contentType?: string; content: Buffer | string; }; type MultipartImportPayload = { author: string; organization: string; just_validate: string | boolean; testing?: string | boolean; file: MultipartFile | string; }; export declare const FILES_API = "/service/files"; export declare const EDITORS_V1_API = "/service/editors/api/v1"; export declare const ELEMENTS_API = "/service/elements-api"; export declare const ELEMENT_PRIVILEGES = "/service/nugeta/user-privileges/element-types"; export declare const INVENTORY_PROCCESS_API = "/service/inventory-process"; export declare const GO_URLS_API = "/service/go-urls"; export declare const IMAGE_FILE_EXTENSIONS: string[]; export declare const VIDEO_FILE_EXTENSIONS: string[]; export declare const AUDIO_FILE_EXTENSIONS: string[]; export declare const TYPE_LIST_PER_PAGE = 100; type ElementScopes = 'predecessors' | 'element' | 'children' | 'references' | 'parent' | 'workRecords'; export interface ElementGetQueryParams extends Record { childrenAtt?: string[]; scope?: ElementScopes[]; templateId?: string; relsAtt?: string[]; elementRelAtt?: string[]; forceVersion?: ElementSchemaVersion; children?: { page?: number; 'per-page'?: number; }; predecessors?: { page?: number; 'per-page'?: number; }; predecessorsAtt?: string[]; q?: string; } export interface ElementTypeWrapper { id: ElementType; } export declare class Elements { api: Api; constructor(api: Api); get(hash: string, type?: string, useCache?: boolean, queryParams?: ElementGetQueryParams): Promise>; getRaw(hash: string, type?: string, useCache?: boolean, params?: Record): Promise; getTypeDataV1(type: string): Promise>; getTemplateV1(type: string, organization: string): Promise>; getElementTypes(organizationId: string, page?: number): Promise; getPrivileges(organization: string, type: string): Promise>; pairQr(elementHash: string, organizationId: string, url?: string): Promise>; generateGoUrls(count: number): Promise>; patch(type: string, hash: string, operations: Operation[], organization: string, queryParams?: Record): Promise>; search(query: string, options?: ElementSearchOptions): Promise; searchCategorized(query: string, options?: CategorizedSearchOptions): Promise; create(type: string, operations: Operation[], organization: string, parent?: string, queryParams?: Record): Promise>; getUserElement(organization: string, type: string): Promise>; startChecklist(data: StartChecklistData): Promise>; setParent(type: string, hash: string, parentHash: string): Promise>; copyElement(newParentType: string, newParentHash: string, copiedHash: string): Promise>; cloneElementTree(root: string, organization: string, newParent?: string, cloneConfig?: CloneConfig, maxDepth?: number): Promise>; archive(type: string, hash: string): Promise; unarchive(type: string, hash: string): Promise; getElementHashFromQR(url: string): Promise; getElementTypeList(organization: string, right?: string, page?: number): Promise; importElements(data: MultipartImportPayload): Promise>; } export declare const serializer: (queryParams: Record) => string; export {};