@mendix/extensions-api - v0.9.0
    Preparing search index...

    Interface IExportMappingModelApi

    API for working with export mapping documents.

    An export mapping defines how Mendix entities are serialized into outgoing XML or JSON. Use this API to programmatically create export mapping documents inside a module or folder, optionally pre-configure them with a JSON structure and selected element paths, and auto-map elements to domain model entities and attributes. Once created, you can also set or clear entity and attribute assignments on the mapping's elements via inherited methods.

    interface IExportMappingModelApi {
        _apiId: "mendix.ExportMappingModelApi";
        addEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): DisposeListener;
        addExportMapping(
            containerId: string,
            options?: AddMappingOptions,
        ): Promise<ExportMapping>;
        addMapping(
            containerId: string,
            options?: AddMappingOptions,
        ): Promise<ExportMapping>;
        applyChanges(operations: Operation[]): Promise<ApplyChangesResult>;
        clearElementMapping(mappingDocumentId: string): Promise<void>;
        createElement<TElement extends ElementBase>(
            type: TElement["$Type"],
            options?: TElement["$CreationOptions"],
        ): Promise<TElement>;
        createUnit(
            type: "ExportMappings$ExportMapping",
            containerId: string,
            options?: ExportMappingCreationOptions,
        ): Promise<ExportMapping>;
        deleteUnit(unitId: string): Promise<void>;
        getElementMetadata(): Promise<ElementMetadataMap>;
        getUnitsInfo(): Promise<UnitInfo[]>;
        load<TElement extends ElementBase>(
            type: TElement["$Type"],
            elementId: string,
        ): Promise<null | TElement>;
        loadUnits(
            type: "ExportMappings$ExportMapping",
            unitIds: string[],
        ): Promise<ExportMapping[]>;
        removeEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): void;
        resolve<TElement extends ElementBase>(
            type: TElement["$Type"],
            qualifiedName: string,
        ): Promise<null | TElement>;
        setElementMapping(
            mappingDocumentId: string,
            mappings: MapObject[],
        ): Promise<void>;
    }

    Hierarchy

    Index

    Properties

    _apiId: "mendix.ExportMappingModelApi"

    Unique identifier that can be used to register or retrieve a specific API.

    Example: mendix.EditorsAPI, mycompany.MyFunkyAPI

    Methods

    • Adds an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to listen for.

      • listener: EventHandler<{}, K>

        The event listener to add.

      Returns DisposeListener

      A function that can be called to remove the event listener.

    • Adds a new export mapping document to the specified container.

      Parameters

      • containerId: string

        The ID of the container where the export mapping will be added. It could be a module or folder.

      • Optionaloptions: AddMappingOptions

        Options for initializing the export mapping, including its name and an optional selectStructure to associate a JSON structure by qualified name, select specific element paths, and optionally auto-map elements.

      Returns Promise<ExportMapping>

      A promise that resolves to the newly created export mapping document.

    • Adds a new mapping document to the specified container.

      Parameters

      • containerId: string

        The ID of the container where the mapping will be added. It could be a module or folder.

      • Optionaloptions: AddMappingOptions

        Options that specify how the mapping will be initialized. Includes a name and an optional selectStructure configuration to associate a JSON structure by qualified name, select specific element paths, and optionally auto-map elements.

      Returns Promise<ExportMapping>

      A promise that resolves to the newly created mapping document.

    • Parameters

      • operations: Operation[]

      Returns Promise<ApplyChangesResult>

    • Clears all entity and attribute mappings from the specified mapping document.

      Parameters

      • mappingDocumentId: string

        The ID of the mapping document to clear.

      Returns Promise<void>

      A promise that resolves when all element mappings have been cleared.

    • Parameters

      • unitId: string

      Returns Promise<void>

    • Returns Promise<ElementMetadataMap>

    • Returns Promise<UnitInfo[]>

    • Parameters

      • type: "ExportMappings$ExportMapping"
      • unitIds: string[]

      Returns Promise<ExportMapping[]>

    • Removes an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to remove the listener from.

      • listener: EventHandler<{}, K>

        The event listener to remove.

      Returns void

    • Sets entity and attribute mappings on the specified mapping document's elements.

      Parameters

      • mappingDocumentId: string

        The ID of the mapping document to update.

      • mappings: MapObject[]

        The mapping objects that define entity and attribute assignments for each element path.

      Returns Promise<void>

      A promise that resolves when the element mappings have been applied.