@craftercms/studio-ui
Version:
Services, components, models & utils to build CrafterCMS authoring extensions.
83 lines (81 loc) • 3.6 kB
TypeScript
/*
* Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { LookupTable } from '../models/LookupTable';
import { MutableRefObject } from 'react';
import { EntityState } from '../models/EntityState';
import { StringifyOptions } from 'query-string';
export declare function pluckProps<T extends object, K extends keyof T>(
source: T,
omitNull: boolean,
...props: K[]
): Pick<T, K>;
export declare function pluckProps<T extends object, K extends keyof T>(source: T, ...props: K[]): Pick<T, K>;
export declare function reversePluckProps<T, K extends keyof T = any>(source: T, ...props: K[]): Omit<T, K>;
export declare function camelizeProps(obj: { [prop: string]: any }): object;
export declare function createLookupTable<T>(list: T[], idProp?: string): LookupTable<T>;
export declare function flattenHierarchical<T>(root: T | T[], childrenProp?: string): T[];
export declare function hierarchicalToLookupTable<T>(
root: T | T[],
childrenProp?: string,
idProp?: string
): LookupTable<T>;
export declare function normalizeProp<T>(list: T[], idProp?: string, normalizeTargetProp?: string): T[];
export declare function retrieveProperty(object: object, prop: string): any;
export declare function deleteProperty<T, P extends keyof T>(object: T, prop: P): Omit<T, P>;
export declare function setProperty<T extends object = {}, K extends string = string, V extends any = any>(
object: T,
prop: K,
value: V
): T;
export declare function nnou(object: any): boolean;
export declare const notNullOrUndefined: typeof nnou;
export declare function nou(object: any): boolean;
export declare const nullOrUndefined: typeof nou;
export declare function createEntityState(merge?: {}): EntityState;
export declare function resolveEntityCollectionFetch<T = any>(collection: Array<T>): EntityState<T>;
export declare function ref<T = any>(ref: MutableRefObject<T>): T;
export declare function isPlainObject<T extends any>(obj: T): boolean;
/** @deprecated Use extend(target, source) */
export declare function extendDeep(target: any, source: any): object;
/** @deprecated Use extend(target, source, { existingOnly: true }) */
export declare function extendDeepExistingProps(target: any, source: any): object;
export declare function extend(
target: object,
source: object,
options?: {
deep?: boolean;
existingOnly?: boolean;
}
): object;
export declare function toQueryString<T extends {} = {}>(
args: T,
options?: StringifyOptions & {
prefix?: string;
}
): string;
export declare function applyDeserializedXMLTransforms<T extends object = {}>(
target: T,
options: {
arrays?: string[];
lookupTables?: string[];
renameTable?: LookupTable<string>;
}
): T;
export declare function deepCopy<T extends object = any>(target: T): T;
export declare const foo: {};
export declare const fooFn: () => any;
export declare function isApiResponse(source: object): boolean;
export declare function isAjaxError(source: object): boolean;