UNPKG

haystack-nclient

Version:

Project Haystack Network Client

114 lines (113 loc) 3.83 kB
import { HGrid, HDict, HaysonDict, HList } from 'haystack-core'; import { ClientServiceConfig } from './ClientServiceConfig'; /** * The commit op type. */ export declare enum CommitType { Add = "add", Update = "update", Remove = "remove" } /** * Extended non-standard Haystack ops. */ export declare class ExtOpsService { #private; /** * Constructs a service object. * * @param serviceConfig Service configuration. */ constructor(serviceConfig: ClientServiceConfig); /** * Asynchronously load the defs library using this service. * * Please note, this will overwrite any existing defs loaded. * * @returns A promise that's resolved once the defs have been loaded. */ loadDefs(): Promise<void>; /** * @returns True if the defs have been loaded using this service. */ isDefsLoaded(): boolean; /** * @returns A promise that resolves to the service's defs. */ private requestDefs; /** * Commit changes to the database. The caller must have 'admin' permissions * in order to use this op. * * The commit type can be one of the following... * * - add: adds new records into the database and returns a grid with the newly minted * record identifiers. As a general rule you should not have an id column in your commit grid. * However if you wish to predefine the id of the records, you can specify an id column in the commit grid. * - update: modified existing records, the records must have both an id and mod column * - remove: removes existing records, the records should have only an id and mod column * * https://skyfoundry.com/doc/docSkySpark/Ops#commit * * @param type The commit operation type (add, update or remove). * @param data The data to commit. */ commit(type: CommitType, data: HDict | HaysonDict | HDict[] | HaysonDict[] | HGrid | HList<HDict>): Promise<HGrid>; /** * Evalulate a haystack filter request and return the result. * * This operation will automatically attempt to batch network calls * together to optimize client network requests. * * @param filter The haystack filter. * @returns The result of the filter query. */ read(filter: string): Promise<HGrid>; /** * Used when evaluating batched eval requests. * * @param exprs The expressions to evaluate. * @returns The evalulated expression responses. */ private batchEval; /** * Evaluate some code server side and return the response. * * This operation will automatically attempt to batch network calls * together to optimize client network requests. * * https://skyfoundry.com/doc/docSkySpark/Ops#eval * * @param expr The expression to evaluate. * @returns The evaluated expression response. */ eval(expr: string): Promise<HGrid>; /** * Evaluate some code server side and return the response. * * https://skyfoundry.com/doc/docSkySpark/Ops#eval * * @param expr The expression to evaluate. * @returns The evaluated expression response. */ private doEval; /** * Evalulate all the expressions and return the grids. * * https://skyfoundry.com/doc/docSkySpark/Ops#evalAll * * @param exprs The expressions to evaluate. * @returns The evalulated expression responses. * @throws Any fetch or grid responses. */ evalAll(exprs: string[]): Promise<HGrid[]>; /** * Evalulate all the expressions and return the grids. * * https://skyfoundry.com/doc/docSkySpark/Ops#evalAll * * @param exprs The expressions to evaluate. * @returns The evalulated expression responses. */ private doEvalAll; }