UNPKG

haystack-nclient

Version:

Project Haystack Network Client

85 lines (84 loc) 2.45 kB
import { HaysonDict, HDict, HGrid, HMarker, HRef, HStr } from 'haystack-core'; import { ClientServiceConfig } from '../ClientServiceConfig'; /** * Options for reading functions. */ interface ReadOptions { /** * If defined, Gets the functions filtered by a Haystack filter */ filter?: string; /** * If defined, specifies the name of the tag/prop by which the returned function records are sorted in ascending order. */ sort?: string[]; /** * If defined, specifies the max number of function records that will be returned by the read */ limit?: number; /** * If defined, limit the number of columns sent back in the response. */ columns?: string[]; } /** * A function record */ export interface FinFunction extends HDict { finFunc: HMarker; name: HStr; src: HStr; id?: HRef; lang?: HStr; appSpace?: string; allowedApps?: string[]; allowedRoles?: string[]; } /** * An implementation of the FIN Function service. */ export declare class FunctionService<FunctionType extends FinFunction = FinFunction> { #private; /** * Constructs a new function service object. * * @param serviceConfig Service configuration. */ constructor(serviceConfig: ClientServiceConfig); /** * Query all functions. * * @param options Optional options for read operation. * @returns The result of the read operation. */ readAll(options?: ReadOptions): Promise<FunctionType[]>; /** * Read a function record via its id. * * @param id The id of the function to read. * @returns The function record. * @throws An error if the function can't be found. */ readById(id: string | HRef): Promise<FunctionType>; /** * Create function record(s). * * @param functions HGrid<FunctionType> The functions to create. * @returns A grid of functions. */ create(functions: FunctionType[] | HaysonDict[] | HGrid<FunctionType>): Promise<HGrid<FunctionType>>; /** * Update a function record. * * @param function The function record to update. * @returns The updated record. */ update(finFunction: FunctionType | HaysonDict): Promise<FunctionType>; /** * Delete a function record via its id. * * @param id The id of the record to delete. */ deleteById(id: string | HRef): Promise<void>; } export {};