The Batch interface holds methods used for the batch operation of MegaEdit. Note that in order for this to work, a batch plugin has to be configured against the product in admin. The batch plugin will then control the format and functionality of the batch operation.

Hierarchy

  • Batch

Methods

  • This method will clear and delete the batch data stored against the job. This call will also update the pricing.

    Parameters

    • callback: (() => void)

      The callback will be triggered once the clear operation is complete.

        • (): void
        • Returns void

    Returns void

  • Load the mapping data from the job.

    Parameters

    • Optional callback: ((mappedData) => void)

      The callback is triggered once the mapping is loaded. The callback result will be passed a BatchMappingElement array.

    Returns void

  • Load the currently stored batch data. The method can load only the info of the batch data (aka the headers) or the full data.

    If you request only the info, the method will return a BatchLoadInfoResponse object. Otherwise we will load the full data as a BatchLoadFullResponse object (note, this can be potentially quite large).

    Note: the format of the data set is controlled by the batch plugin applied against the product.

    You can control via the separate parameter getPreviouslyLoaded if you want to load the data from the server or return the previously loaded data. Note: this will only work if you request the info only.

    Parameters

    • infoOnly: boolean

      Boolean flag to control if only the info object or the full data set should be loaded.

    • callback: ((response) => void)

      The callback is triggered once the data is loaded. The callback result will be passed a BatchLoadInfoResponse or BatchLoadFullResponse object, depending on the infoOnly flag.

    • Optional getPreviouslyLoaded: boolean

      Boolean flag to control if the data should be loaded from the server or the previously loaded data should be returned. This will only work if you request the info only.

    Returns void

  • Loads a preview of the batch data for the first numRecords records. Note that we will not return more as the Infigo Settings value of BatchNumPreviewRecords, no matter the parameter value. But we can return less. However the system will generate at least 1 record.

    The call will load then the first n records. This is controlled by the batch plugin and for some types it may be not actual data. The CSV plugin will return the first n rows.

    Then the data will be mapped and a mapped result will be returned

    Parameters

    • numRecords: number

      The maximum number of records to load. Note that we will not return more as the Infigo Settings value of BatchNumPreviewRecords, no matter the parameter value. But we can return less.

    • callback: ((mappedData) => void)

      The callback with the mapped data object. The keys are the mapping keys (or variable items), and the values the already mapped values.

        • (mappedData): void
        • Parameters

          • mappedData: {
                [key: string]: string;
            }
            • [key: string]: string

          Returns void

    Returns void

  • Saves the batch data. The batch data format is controlled by the batch plugin applied against the product.

    E.g. for the CSV batch plugin, the data is a string of comma separated values following the CSV specification.

    This call will also update the pricing.

    Parameters

    • data: string

      The data to save in the correct format based on the batch plugin applied against the product.

    • Optional callback: ((shortInfo) => void)

      The function will be triggered when the save operation is complete. The callback result will be passed a BatchSaveResult object.

    Returns void

  • Saves the defined mapping against the job. The mapping is important to control how the batch data will be used. You can use the Editor's UI helper to generate a mapping dialog easily.

    Parameters

    • mapping: Record<string, BatchMappingItem>

      The mapping object is a dictionary where the key is the mapping key (or variable item) and the value is the BatchMappingElement object.

    • Optional callback: ((result) => void)

      The callback is triggered once the mapping is saved.

        • (result): void
        • Parameters

          • result: boolean

          Returns void

    Returns void

Generated using TypeDoc