UNPKG

@commercetools/sync-actions

Version:

Build API update actions for the commercetools platform.

16 lines (15 loc) 807 B
import { Delta, UpdateAction } from './types'; export declare const ADD_ACTIONS = "create"; export declare const REMOVE_ACTIONS = "remove"; export declare const CHANGE_ACTIONS = "change"; /** * Generate + configure a function to build actions for nested objects * @param {string} key key of the attribute containing the array of * nested objects * @param {object} config configuration object that can contain the keys * [ADD_ACTIONS, REMOVE_ACTIONS, CHANGE_ACTIONS], each of * which is a function. The function should accept the old + new arrays and * return an action object. * @return {Array} The generated array of actions */ export default function createBuildArrayActions(key: string, config: object): <S, T extends UpdateAction>(diff: Delta, oldObj: S, newObj: S) => T[];