import CacheConf from 'cache-conf'; import Conf from 'conf'; import { FetchOptions, ScriptFilterItem, OutputOptions } from './types'; import ConfMock from './external/confMock'; /** Create Arvis extensions with ease @example ``` const arvish = require('arvish'); (async () => { const data = await arvish.fetch('https://jsonplaceholder.typicode.com/posts'); const items = arvish .inputMatches(data, 'title') .map(element => ({ title: element.title, subtitle: element.body, arg: element.id })); arvish.output(items); }) (); ``` */ declare const arvish: { /** Return output to arvis. @param items @param options @example ``` arvish.output([ { title: 'Unicorn' }, { title: 'Rainbow' } ]); ``` */ output: (items: ScriptFilterItem[], options?: OutputOptions | undefined) => Record; /** Returns an string[] of items in list that case-insensitively contains input. @param input @param list @param target @returns Items in list that case-insensitively contains input. @example ``` arvish.matches('Corn', ['foo', 'unicorn']); //=> ['unicorn'] ``` */ matches: (input: string, list: T, target?: string | ((item: string | ScriptFilterItem, input: string) => boolean) | undefined) => T; /** Same as matches(), but with `arvish.input` as input. @param list @param target @returns Items in list that case-insensitively contains `arvish.input`. */ inputMatches: (list: T_1, target?: string | ((item: string | ScriptFilterItem, input: string) => boolean) | undefined) => T_1; /** Log value to the arvis workflow debugger. @param text */ log: (text: string) => void; /** Display an error or error message in Arvis. **Note:** You don't need to `.catch()` top-level promises. Arvish handles that for you. @param error */ error: (error: Error | string) => void; /** Returns a Promise that returns the body of the response. @param url @param options @returns Body of the response. @example ``` await arvish.fetch('https://api.foo.com', { transform: body => { body.foo = 'bar'; return body; } }) ``` */ fetch: (url: string, options?: FetchOptions | undefined) => Promise; /** @example ``` { name: 'Emoj', version: '0.2.5', uid: 'user.workflow.B0AC54EC-601C-479A-9428-01F9FD732959', bundleId: 'com.sindresorhus.emoj' } ``` */ meta: { name: string | undefined; version: string | undefined; bundleId: string | undefined; type: string | undefined; }; env: { get: (type: 'number' | 'json' | 'string', key: string) => any; data: string | undefined; cache: string | undefined; history: string | undefined; platform: { home: string | undefined; desktop: string | undefined; documents: string | undefined; downloads: string | undefined; music: string | undefined; pictures: string | undefined; temp: string | undefined; userData: string | undefined; appData: string | undefined; vidios: string | undefined; crashDumps: string | undefined; currentExe: string | undefined; }; }; /** Input from Arvis. What the user wrote in the input box. */ input: string; /** Persist config data. Exports a [`conf` instance](https://github.com/sindresorhus/conf#instance) with the correct config path set. @example ``` arvish.config.set('unicorn', '🦄'); arvish.config.get('unicorn'); //=> '🦄' ``` */ config: Conf | ConfMock; /** Persist cache data. Exports a modified [`conf` instance](https://github.com/sindresorhus/conf#instance) with the correct cache path set. @example ``` arvish.cache.set('unicorn', '🦄'); arvish.cache.get('unicorn'); //=> '🦄' ``` */ cache: ConfMock | CacheConf; /** Get various useful icons. */ icon: { info: string; warning: string; error: string; alert: string; like: string; delete: string; }; }; export = arvish;