import { FormTypes, SubmissionTypes } from '@oneblink/types'; /** Filter for a single property in a Form Store Record */ export type FormStoreFilter = { $regex?: string; $options?: string; $eq?: T; $gte?: T; $gt?: T; $lt?: T; $lte?: T; $in?: string[]; $elemMatch?: { $in?: string[]; }; }; /** Filters available for filter Form Store Records */ export type FormStoreFilters = { /** Filter results by the date/time they were completed */ dateTimeCompleted?: FormStoreFilter; /** Filter results by the date/time they were submitted */ dateTimeSubmitted?: FormStoreFilter; /** Filter results by the user that submitted */ submittedBy?: FormStoreFilter; /** Filter results by the submissionId, must be a valid GUID */ submissionId?: FormStoreFilter; /** Filter results by the externalId */ externalId?: FormStoreFilter; /** Filter results by the submission data */ submission?: Record | undefined>; /** Filter results by the task that was completed by submitting a form */ task?: { /** Filter results by the task name */ name?: FormStoreFilter; }; /** Filter results by the task action that was used to complete a task */ taskAction?: { /** Filter results by the task action label */ label?: FormStoreFilter; }; /** Filter results by the task group that included the task */ taskGroup?: { /** Filter results by the task group name */ name?: FormStoreFilter; }; /** Filter results by the task group instance that included the task */ taskGroupInstance?: { /** Filter results by the task group instance label */ label?: FormStoreFilter; }; /** Filter results by the forms app used to submit */ formsAppId?: { $in: (number | null)[]; }; }; export type FormStoreParameters = { /** Filters available for filter Form Store Records */ filters?: FormStoreFilters; /** * Unwind repeatable set entries to denormalise data, this makes data cleaner * for tabular data purposes */ unwindRepeatableSets?: boolean; /** Sort the results by multiple properties */ sorting?: Array<{ /** Property to sort by */ property: string; /** Sorting direction */ direction: 'ascending' | 'descending'; }>; }; /** * Get the available form elements for a form to display form store records * * #### Example * * ```js * const formId = 1 * const { formElements } = * await formStoreService.getFormStoreDefinition(formId) * ``` * * @param formId The identified of the form you want to get the definition of * @param abortSignal An AbortSignal to abort the request * @returns */ export declare function getFormStoreDefinition(formId: number, abortSignal?: AbortSignal): Promise<{ formElements: FormTypes.FormElementWithName[]; }>; /** * Search for Form Store Records * * #### Example * * ```js * const { formStoreRecords } = * await formStoreService.searchFormStoreRecords({ * formId: 1, * paging: { * limit: 50, * offset: 0, * }, * }) * ``` * * @param searchParameters Search parameters for filtering, sorting, and paging * @param abortSignal An AbortSignal to abort the request * @returns */ export declare function searchFormStoreRecords(searchParameters: { formId: number; paging: { limit: number; offset: number; }; } & FormStoreParameters, abortSignal: AbortSignal): Promise<{ formStoreRecords: SubmissionTypes.FormStoreRecord[]; meta: { limit: number; offset: number; nextOffset?: number; }; }>; /** * Export Form Store Records as a CSV file. This function will download the file * automatically. * * #### Example * * ```js * await formStoreService.exportFormStoreRecords({ * formId: 1, * }) * ``` * * @param fileName Name of the file to download. ".csv" will be added to the end * of the file name if not passed * @param searchParameters Search parameters for filtering, sorting, and * including columns * @param abortSignal An AbortSignal to abort the request * @returns */ export declare function exportFormStoreRecords(fileName: string, searchParameters: { formId: number; includeColumns?: string[]; } & FormStoreParameters, abortSignal?: AbortSignal): Promise;