import { BaseApi } from "../base-api"; import { CompanyInfoApi } from "../company-info"; import type { ApiRecords, Config } from "../types"; import type { CachedMapping, CreateMapping, Mapping, MappingDefinition, MappingExpressionDependencies, MappingTestResult, MappingTestResults, ObjectMapping, PropertyMapping, RawCachedMapping, RawMappingDefinition, RawObjectMapping, RawPropertyMapping, RawValueMapping, ValueMapping } from "./types"; interface GetMappingsParameters extends Record { /** Filter by attribute id. Can be repeated to match multiple attributes. */ attribute_id?: number | number[]; /** Filter by dataset id. Can be repeated to match multiple datasets. */ dataset_id?: number | number[]; } /** * Class representing the Mappings API. * Extends the BaseApi to provide functionalities specific to mappings. * @extends BaseApi */ declare class MappingsApi extends BaseApi { private readonly companyInfoApi?; constructor(config: Config, companyInfoApi?: CompanyInfoApi | undefined); /** * Retrieves all mappings owned by the caller's company, optionally filtered by attribute and/or dataset. * * @param {GetMappingsParameters} [parameters] - Optional attribute/dataset filters. * @returns {Promise>} A promise that resolves to a collection of Mapping records. * @public * @async */ getMappings(parameters?: GetMappingsParameters): Promise>; /** * Creates a new mapping specific to a company. * * @param {CreateMapping} mapping - The mapping configuration to be created. * @param {number} [companyId] - Optional company ID. If not provided, it will be fetched from the API. * @returns {Promise} A promise that resolves to the created mapping. * @public * @async * @throws {Error} Throws an error if the company ID is undefined and cannot be fetched. */ createPrivateMapping(mapping: CreateMapping, companyId?: number): Promise; /** * Tests a mapping configuration and returns the results. * * @param {CreateMapping} mapping - The mapping configuration to test. * @returns {Promise} A promise that resolves to the test results of the mapping. * @public * @async */ testMapping(mapping: CreateMapping): Promise; /** * Previews a sample of the mapping results. * * @param {string} mappingId - The ID of the mapping to preview. * @returns {Promise} A promise that resolves to the sample test results of the mapping. * @public * @async */ previewMapping(mappingId: string): Promise; /** * Deletes a mapping. * * @param {string} mappingId - The ID of the mapping to delete. * @returns {Promise} A promise that resolves when the mapping is successfully deleted. * @public * @async */ deleteMapping(mappingId: string): Promise; /** * Retrieves the company ID from the API. * * @returns {Promise} - A promise that resolves to the company ID. * @private * @async */ private getCompanyId; /** * Accepts a mapping. * * @param {string} mappingId - The ID of the mapping to accept. * @returns {Promise} A promise that resolves when the mapping is accepted. * @public * @async */ acceptMapping(mappingId: string): Promise; /** * Rejects a mapping. * * @param {string} mappingId - The ID of the mapping to reject. * @returns {Promise} A promise that resolves when the mapping is rejected. * @public * @async */ rejectMapping(mappingId: string): Promise; /** * Promotes a mapping to global scope. * * @param {string} mappingId - The ID of the mapping to promote. * @returns {Promise} A promise that resolves when the mapping is succesfully promoted. * @public * @async * @deprecated No corresponding `POST /mappings/{id}/promote` route was found in the backend * (narrative-marketplace-backend @ 6f3819c). Calling this will likely 404 — flagged for * review rather than removed, since callers may already depend on this signature. */ promoteMapping(mappingId: string): Promise; /** * Updates a mapping. * * @param {string} mappingId - The ID of the mapping to update. * @param {Pick} mapping - The mapping definition (required) and tags (optional) to update. * @returns {Promise} A promise that resolves to the updated mapping. * @public * @async */ updateMapping(mappingId: string, mapping: Pick): Promise; /** * Retrieves a mapping. * * @param {string} mappingId - The ID of the mapping to retrieve. * @returns {Promise} A promise that resolves to the retrieved mapping. * @public * @async */ getMapping(mappingId: string): Promise; } export { type CachedMapping, type CreateMapping, type GetMappingsParameters, type Mapping, type MappingDefinition, type MappingExpressionDependencies, MappingsApi, type MappingTestResult, type MappingTestResults, type ObjectMapping, type PropertyMapping, type RawCachedMapping, type RawMappingDefinition, type RawObjectMapping, type RawPropertyMapping, type RawValueMapping, type ValueMapping, };