UNPKG

@cobuildlab/8base-utils

Version:

This is package to deal with common scenarios working with 8base platform

48 lines (47 loc) 2.17 kB
/** * Helper to change non null keys to 8base 'create' reference for files. * If the value of the key is undefined or null, the property gets deleted from the object. * WARNING: This function mutates the data. * WARNING: This functions assumes that all 8base keys are strings. * * @param {object} data - The Object to be Mutated. * @param {string} key - The key in the Object. */ export declare const normalize8baseDocumentCreate: (data: Record<string, any>, key: string) => void; /** * Helper to change non null keys to 8base 'create' reference for files. * WARNING: This function mutates the data. * WARNING: This functions assumes that all 8base keys are strings. * * @param {object} data - The Object to be Mutated. * @param {string} key - The key in the Object. */ export declare const normalize8baseDocumentsCreate: (data: Record<string, any>, key: string) => void; /** * Helper to change non null keys to 8base 'create' reference for files. * // USE this for { items: [] } models. * WARNING: This function mutates the data. * WARNING: This functions assumes that all 8base keys are strings. * * @param {object} data - The Object to be Mutated. * @param {string} key - The key in the Object. */ export declare const normalize8baseDocumentsCreateItems: (data: Record<string, any>, key: string) => void; /** * Helper to update or delete one document key from an Object. * WARNING: This function mutates the data. * * @param {object}data - Data for mutation. * @param {string}key - Key object. * @param {object}originalData - Original object. */ export declare const normalize8baseDocumentDeleteAndUpdate: (data: Record<string, any>, key: string, originalData: Record<string, any>) => void; /** * Helper to change non null keys to 8base 'delete & create' reference for Documents Lists * WARNING: This function mutates the data. * * @param {object} data - To mutate. * @param {string} key - The key of the property to mutate. * @param {Array} originalData - The documents originals. */ export declare const normalize8baseDocumentsDeleteAndUpdate: (data: Record<string, any>, key: string, originalData: Record<string, any>) => void;