1 | export interface PromisifyAllOptions extends PromisifyOptions {
|
2 | /**
|
3 | * Array of methods to ignore when promisifying.
|
4 | */
|
5 | exclude?: string[];
|
6 | }
|
7 | export interface PromisifyOptions {
|
8 | /**
|
9 | * Resolve the promise with single arg instead of an array.
|
10 | */
|
11 | singular?: boolean;
|
12 | }
|
13 | export interface PromiseMethod extends Function {
|
14 | promisified_?: boolean;
|
15 | }
|
16 | export interface WithPromise {
|
17 | Promise?: PromiseConstructor;
|
18 | }
|
19 | export interface CallbackifyAllOptions {
|
20 | /**
|
21 | * Array of methods to ignore when callbackifying.
|
22 | */
|
23 | exclude?: string[];
|
24 | }
|
25 | export interface CallbackMethod extends Function {
|
26 | callbackified_?: boolean;
|
27 | }
|
28 | /**
|
29 | * Wraps a callback style function to conditionally return a promise.
|
30 | *
|
31 | * @param {function} originalMethod - The method to promisify.
|
32 | * @param {object=} options - Promise options.
|
33 | * @param {boolean} options.singular - Resolve the promise with single arg instead of an array.
|
34 | * @return {function} wrapped
|
35 | */
|
36 | export declare function promisify(originalMethod: PromiseMethod, options?: PromisifyOptions): any;
|
37 | /**
|
38 | * Promisifies certain Class methods. This will not promisify private or
|
39 | * streaming methods.
|
40 | *
|
41 | * @param {module:common/service} Class - Service class.
|
42 | * @param {object=} options - Configuration object.
|
43 | */
|
44 | export declare function promisifyAll(Class: Function, options?: PromisifyAllOptions): void;
|
45 | /**
|
46 | * Wraps a promisy type function to conditionally call a callback function.
|
47 | *
|
48 | * @param {function} originalMethod - The method to callbackify.
|
49 | * @param {object=} options - Callback options.
|
50 | * @param {boolean} options.singular - Pass to the callback a single arg instead of an array.
|
51 | * @return {function} wrapped
|
52 | */
|
53 | export declare function callbackify(originalMethod: CallbackMethod): CallbackMethod;
|
54 | /**
|
55 | * Callbackifies certain Class methods. This will not callbackify private or
|
56 | * streaming methods.
|
57 | *
|
58 | * @param {module:common/service} Class - Service class.
|
59 | * @param {object=} options - Configuration object.
|
60 | */
|
61 | export declare function callbackifyAll(Class: Function, options?: CallbackifyAllOptions): void;
|