|
| 1 | +/** |
| 2 | + * Emits a key-value pair for further processing by CouchDB after the map function is done. |
| 3 | + * @param {string} key - The view key |
| 4 | + * @param {any} value - The key’s associated value |
| 5 | + * @returns {void} |
| 6 | + */ |
| 7 | +declare function emit(key: string, value: any): void |
| 8 | +/** |
| 9 | + * @deprecated since version 2.0 |
| 10 | + * Extracts the next row from a related view result. |
| 11 | + * @returns {Object} - View result row |
| 12 | + */ |
| 13 | +declare function getRow<T>(): T |
| 14 | + |
| 15 | +/** |
| 16 | + * A helper function to check if the provided value is an Array. |
| 17 | + * @param {Object} obj - Any JavaScript value |
| 18 | + * @returns {boolean} |
| 19 | + */ |
| 20 | +declare function isArray<T>(obj: T): boolean |
| 21 | + |
| 22 | +/** |
| 23 | + * Log a message to the CouchDB log (at the INFO level). |
| 24 | + * @param {string} message - Message to be logged |
| 25 | + * @returns {void} |
| 26 | + */ |
| 27 | +declare function log(message: string): void |
| 28 | + |
| 29 | +/** |
| 30 | + * @deprecated since version 2.0 |
| 31 | + * Registers callable handler for specified MIME key. |
| 32 | + * @param {string} key - MIME key previously defined by registerType() |
| 33 | + * @param {Function} value - MIME type handler |
| 34 | + * @returns {void} |
| 35 | + */ |
| 36 | +declare function provides(key: string, func: Function): void |
| 37 | + |
| 38 | +/** |
| 39 | + * @deprecated since version 2.0 |
| 40 | + * Registers list of MIME types by associated key. |
| 41 | + * @param {string} key - MIME types |
| 42 | + * @param {string[]} mimes - MMIME types enumeration |
| 43 | + * @returns {void} |
| 44 | + */ |
| 45 | +declare function registerType(key: string, mimes: string[]): void |
| 46 | + |
| 47 | +/** |
| 48 | + * @deprecated since version 2.0 |
| 49 | + * Sends a single string chunk in response. |
| 50 | + * @param {string} chunk - Text chunk |
| 51 | + * @returns {void} |
| 52 | + */ |
| 53 | +declare function send(chunk: string): void |
| 54 | + |
| 55 | +interface InitResp { |
| 56 | + code: number |
| 57 | + json: object |
| 58 | + body: string |
| 59 | + base64: string |
| 60 | + headers: any |
| 61 | + stop: boolean |
| 62 | +} |
| 63 | + |
| 64 | +/** |
| 65 | + * @deprecated since version 2.0 |
| 66 | + * Initiates chunked response. As an option, a custom response object may be sent at this point. For list-functions only! |
| 67 | + * @param {Object} init_resp - InitResp object |
| 68 | + * @returns {void} |
| 69 | + */ |
| 70 | +// eslint-disable-next-line |
| 71 | +declare function start(init_resp?: InitResp): void |
| 72 | + |
| 73 | +/** |
| 74 | + * Sum arr’s items. |
| 75 | + * @param {number[]} arr - Array of numbers |
| 76 | + * @returns {number} |
| 77 | + */ |
| 78 | +declare function sum(arr: number[]): number |
| 79 | + |
| 80 | +/** |
| 81 | + * Encodes obj to JSON string. This is an alias for the JSON.stringify method. |
| 82 | + * @param {any} obj - Array of numbers |
| 83 | + * @returns {string} |
| 84 | + */ |
| 85 | +declare function toJSON(obj: any): string |
| 86 | + |
| 87 | +/** |
| 88 | + * Reduce functions take two required arguments of keys and values lists - the result of the related map function - and an optional third value which indicates if rereduce mode is active or not. |
| 89 | + * Rereduce is used for additional reduce values list, so when it is true there is no information about related keys (first argument is null). |
| 90 | + * @param {string[] | null} keys - Array of pairs of docid-key for related map function results. Always null if rereduce is running (has true value). |
| 91 | + * @returns {void} |
| 92 | + */ |
| 93 | +declare type redfun = (keys: [string, string][] | null, values: any[], rereduce?: boolean) => any |
0 commit comments