@open-wa/wa-automate 4.76.0 → 5.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +14 -165
  2. package/dist/cli-runtime-B7_3MM0c.cjs +798 -0
  3. package/dist/cli-runtime-B7_3MM0c.cjs.map +1 -0
  4. package/dist/cli-runtime-CmpYxFCk.d.cts +31 -0
  5. package/dist/cli-runtime-CmpYxFCk.d.cts.map +1 -0
  6. package/dist/cli.cjs +17 -0
  7. package/dist/cli.cjs.map +1 -0
  8. package/dist/cli.d.cts +2 -0
  9. package/dist/index.cjs +224 -0
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/index.d.cts +81 -0
  12. package/dist/index.d.cts.map +1 -0
  13. package/package.json +34 -177
  14. package/CNAME +0 -1
  15. package/_tsconfig.docs.json +0 -140
  16. package/bin/config-schema.json +0 -1
  17. package/bin/oas-type-schemas.json +0 -1
  18. package/bin/server.js +0 -45
  19. package/build/build-config-json-for-bin.ts +0 -56
  20. package/build/generate-oas-types.ts +0 -31
  21. package/dist/api/Client.d.ts +0 -2255
  22. package/dist/api/Client.js +0 -4358
  23. package/dist/api/functions/exposed.enum.d.ts +0 -7
  24. package/dist/api/functions/exposed.enum.js +0 -11
  25. package/dist/api/model/aliases.d.ts +0 -110
  26. package/dist/api/model/aliases.js +0 -3
  27. package/dist/api/model/button.d.ts +0 -24
  28. package/dist/api/model/button.js +0 -2
  29. package/dist/api/model/call.d.ts +0 -51
  30. package/dist/api/model/call.js +0 -18
  31. package/dist/api/model/chat.d.ts +0 -221
  32. package/dist/api/model/chat.js +0 -52
  33. package/dist/api/model/config.d.ts +0 -836
  34. package/dist/api/model/config.js +0 -111
  35. package/dist/api/model/contact.d.ts +0 -143
  36. package/dist/api/model/contact.js +0 -2
  37. package/dist/api/model/errors.d.ts +0 -90
  38. package/dist/api/model/errors.js +0 -117
  39. package/dist/api/model/events.d.ts +0 -120
  40. package/dist/api/model/events.js +0 -127
  41. package/dist/api/model/group-metadata.d.ts +0 -124
  42. package/dist/api/model/group-metadata.js +0 -25
  43. package/dist/api/model/id.d.ts +0 -5
  44. package/dist/api/model/id.js +0 -2
  45. package/dist/api/model/index.d.ts +0 -110
  46. package/dist/api/model/index.js +0 -128
  47. package/dist/api/model/label.d.ts +0 -24
  48. package/dist/api/model/label.js +0 -2
  49. package/dist/api/model/media.d.ts +0 -93
  50. package/dist/api/model/media.js +0 -12
  51. package/dist/api/model/message.d.ts +0 -422
  52. package/dist/api/model/message.js +0 -40
  53. package/dist/api/model/product.d.ts +0 -141
  54. package/dist/api/model/product.js +0 -2
  55. package/dist/api/model/reactions.d.ts +0 -76
  56. package/dist/api/model/reactions.js +0 -2
  57. package/dist/api/model/sessionInfo.d.ts +0 -77
  58. package/dist/api/model/sessionInfo.js +0 -2
  59. package/dist/build/build-postman.d.ts +0 -1
  60. package/dist/build/build-postman.js +0 -262
  61. package/dist/cli/cli-options.d.ts +0 -9
  62. package/dist/cli/cli-options.js +0 -289
  63. package/dist/cli/collections.d.ts +0 -2
  64. package/dist/cli/collections.js +0 -251
  65. package/dist/cli/file-utils.d.ts +0 -1
  66. package/dist/cli/file-utils.js +0 -71
  67. package/dist/cli/index.d.ts +0 -1
  68. package/dist/cli/index.js +0 -231
  69. package/dist/cli/integrations/chatwoot.d.ts +0 -49
  70. package/dist/cli/integrations/chatwoot.js +0 -672
  71. package/dist/cli/integrations/cloudflare.d.ts +0 -6
  72. package/dist/cli/integrations/cloudflare.js +0 -76
  73. package/dist/cli/logo.d.ts +0 -1
  74. package/dist/cli/logo.js +0 -49
  75. package/dist/cli/server.d.ts +0 -24
  76. package/dist/cli/server.js +0 -540
  77. package/dist/cli/setup.d.ts +0 -30
  78. package/dist/cli/setup.js +0 -308
  79. package/dist/config/puppeteer.config.d.ts +0 -11
  80. package/dist/config/puppeteer.config.js +0 -65
  81. package/dist/controllers/auth.d.ts +0 -36
  82. package/dist/controllers/auth.js +0 -322
  83. package/dist/controllers/browser.d.ts +0 -17
  84. package/dist/controllers/browser.js +0 -603
  85. package/dist/controllers/events.d.ts +0 -82
  86. package/dist/controllers/events.js +0 -173
  87. package/dist/controllers/init_patch.d.ts +0 -13
  88. package/dist/controllers/init_patch.js +0 -42
  89. package/dist/controllers/initializer.d.ts +0 -22
  90. package/dist/controllers/initializer.js +0 -511
  91. package/dist/controllers/launch_checks.d.ts +0 -8
  92. package/dist/controllers/launch_checks.js +0 -130
  93. package/dist/controllers/patch_manager.d.ts +0 -37
  94. package/dist/controllers/patch_manager.js +0 -231
  95. package/dist/controllers/popup/index.d.ts +0 -3
  96. package/dist/controllers/popup/index.html +0 -168
  97. package/dist/controllers/popup/index.js +0 -148
  98. package/dist/controllers/script_preloader.d.ts +0 -17
  99. package/dist/controllers/script_preloader.js +0 -88
  100. package/dist/index.d.ts +0 -13
  101. package/dist/index.js +0 -36
  102. package/dist/lib/README.md +0 -5
  103. package/dist/lib/base64.js +0 -1
  104. package/dist/lib/hash.js +0 -1
  105. package/dist/lib/jsSha.min.js +0 -1
  106. package/dist/lib/launch.js +0 -1
  107. package/dist/lib/qr.min.js +0 -1
  108. package/dist/lib/wapi.js +0 -2163
  109. package/dist/logging/custom_transport.d.ts +0 -9
  110. package/dist/logging/custom_transport.js +0 -35
  111. package/dist/logging/logging.d.ts +0 -50
  112. package/dist/logging/logging.js +0 -196
  113. package/dist/structures/Collector.d.ts +0 -202
  114. package/dist/structures/Collector.js +0 -391
  115. package/dist/structures/Dialog.d.ts +0 -55
  116. package/dist/structures/Dialog.js +0 -21
  117. package/dist/structures/MessageCollector.d.ts +0 -78
  118. package/dist/structures/MessageCollector.js +0 -145
  119. package/dist/structures/preProcessors.d.ts +0 -58
  120. package/dist/structures/preProcessors.js +0 -181
  121. package/dist/utils/pid_utils.d.ts +0 -1
  122. package/dist/utils/pid_utils.js +0 -26
  123. package/dist/utils/tools.d.ts +0 -152
  124. package/dist/utils/tools.js +0 -494
  125. package/tos.md +0 -77
@@ -1,9 +0,0 @@
1
- import TransportStream from 'winston-transport';
2
- export declare class LogToEvTransport extends TransportStream {
3
- constructor(opts?: any);
4
- log(info: any, callback: any): any;
5
- }
6
- export declare class NoOpTransport extends TransportStream {
7
- constructor(opts?: any);
8
- log(info: any, callback: any): any;
9
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NoOpTransport = exports.LogToEvTransport = void 0;
7
- const winston_transport_1 = __importDefault(require("winston-transport"));
8
- const events_1 = require("../controllers/events");
9
- class LogToEvTransport extends winston_transport_1.default {
10
- constructor(opts) {
11
- super(opts);
12
- }
13
- log(info, callback) {
14
- setImmediate(() => {
15
- this.emit('logged', info);
16
- });
17
- events_1.ev.emit(`DEBUG.${info.level}`, Object.keys(info).reduce((p, c) => (p = Object.assign(Object.assign({}, p), { [c]: info[c] })), {}));
18
- if (callback)
19
- return callback(null, true);
20
- }
21
- }
22
- exports.LogToEvTransport = LogToEvTransport;
23
- class NoOpTransport extends winston_transport_1.default {
24
- constructor(opts) {
25
- super(opts);
26
- }
27
- log(info, callback) {
28
- setImmediate(() => {
29
- this.emit('logged', info);
30
- });
31
- if (callback)
32
- return callback(null, true);
33
- }
34
- }
35
- exports.NoOpTransport = NoOpTransport;
@@ -1,50 +0,0 @@
1
- import * as winston from 'winston';
2
- /**
3
- * You can access the log in your code and add your own custom transports
4
- * https://github.com/winstonjs/winston#transports
5
- * see [Logger](https://github.com/winstonjs/winston#transports) for more details.
6
- *
7
- * Here is an example of adding the GCP stackdriver transport:
8
- *
9
- * ```
10
- * import { log } from '@open-wa/wa-automate'
11
- * import { LoggingWinston } from '@google-cloud/logging-winston';
12
- *
13
- * const gcpTransport = new LoggingWinston({
14
- * projectId: 'your-project-id',
15
- * keyFilename: '/path/to/keyfile.json'
16
- * });
17
- *
18
- * ...
19
- * log.add(
20
- * gcpTransport
21
- * )
22
- *
23
- * //Congrats! Now all of your session logs will also go to GCP Stackdriver
24
- * ```
25
- */
26
- export declare const log: winston.Logger;
27
- export declare const addRotateFileLogTransport: (options?: any) => void;
28
- /**
29
- * @private
30
- */
31
- export declare const addSysLogTransport: (options?: any) => void;
32
- export type ConfigLogTransport = {
33
- /**
34
- * The type of winston transport. At the moment only `file`, `console`, `ev` and `syslog` are supported.
35
- */
36
- type: 'syslog' | 'console' | 'file' | 'ev';
37
- /**
38
- * The options for the transport. Generally only required for syslog but you can use this to override default options for other types of transports.
39
- */
40
- options?: any;
41
- /**
42
- * If the transport has already been added to the logger. The logging set up command handles this for you.
43
- * @readonly
44
- */
45
- done?: boolean;
46
- };
47
- /**
48
- * @private
49
- */
50
- export declare const setupLogging: (logging: ConfigLogTransport[], sessionId?: string) => ConfigLogTransport[];
@@ -1,196 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.setupLogging = exports.addSysLogTransport = exports.addRotateFileLogTransport = exports.log = void 0;
30
- const os_1 = __importDefault(require("os"));
31
- const winston = __importStar(require("winston"));
32
- const winston_daily_rotate_file_1 = __importDefault(require("winston-daily-rotate-file"));
33
- const winston_syslog_1 = require("winston-syslog");
34
- const custom_transport_1 = require("./custom_transport");
35
- const { combine, timestamp } = winston.format;
36
- const traverse_1 = __importDefault(require("traverse"));
37
- const full_1 = require("klona/full");
38
- const truncateLength = 200;
39
- let _evSet = false, _consoleSet = false, d = Date.now();
40
- const sensitiveKeys = [
41
- /cookie/i,
42
- /sessionData/i,
43
- /passw(or)?d/i,
44
- /^pw$/,
45
- /^pass$/i,
46
- /secret/i,
47
- /token/i,
48
- /api[-._]?key/i,
49
- ];
50
- const getCircularReplacer = () => {
51
- const seen = new WeakSet();
52
- return (_key, value) => {
53
- if (typeof value === "object" && value !== null) {
54
- if (seen.has(value)) {
55
- return "[Circular]";
56
- }
57
- seen.add(value);
58
- }
59
- return value;
60
- };
61
- };
62
- const k = (obj) => {
63
- try {
64
- return (0, full_1.klona)(obj);
65
- }
66
- catch (error) {
67
- return (0, full_1.klona)(JSON.parse(JSON.stringify(obj, getCircularReplacer())));
68
- }
69
- };
70
- function isSensitiveKey(keyStr) {
71
- if (keyStr && typeof keyStr == "string") {
72
- return sensitiveKeys.some(regex => regex.test(keyStr));
73
- }
74
- }
75
- function redactObject(obj) {
76
- (0, traverse_1.default)(obj).forEach(function redactor() {
77
- if (isSensitiveKey(this.key)) {
78
- this.update("[REDACTED]");
79
- }
80
- else if (typeof this.node === 'string' && this.node.length > truncateLength) {
81
- this.update(truncate(this.node, truncateLength));
82
- }
83
- });
84
- }
85
- function redact(obj) {
86
- const copy = k(obj); // Making a deep copy to prevent side effects
87
- redactObject(copy);
88
- const splat = copy[Symbol.for("splat")];
89
- redactObject(splat); // Specifically redact splat Symbol
90
- return copy;
91
- }
92
- function truncate(str, n) {
93
- return str.length > n ? str.substr(0, n - 1) + '...[TRUNCATED]...' : str;
94
- }
95
- const formatRedact = winston.format(redact);
96
- const stringSaver = winston.format((info) => {
97
- const copy = k(info);
98
- const splat = copy[Symbol.for("splat")];
99
- if (splat) {
100
- copy.message = `${copy.message} ${splat.filter((x) => typeof x !== 'object').join(' ')}`;
101
- copy[Symbol.for("splat")] = splat.filter((x) => typeof x == 'object');
102
- return copy;
103
- }
104
- return info;
105
- });
106
- /**
107
- * To prevent "Attempt to write logs with no transports" error
108
- */
109
- const placeholderTransport = new custom_transport_1.NoOpTransport();
110
- const makeLogger = () => winston.createLogger({
111
- format: combine(stringSaver(), timestamp(), winston.format.json(), formatRedact(), winston.format.splat(), winston.format.simple()),
112
- levels: winston.config.syslog.levels,
113
- transports: [placeholderTransport]
114
- });
115
- /**
116
- * You can access the log in your code and add your own custom transports
117
- * https://github.com/winstonjs/winston#transports
118
- * see [Logger](https://github.com/winstonjs/winston#transports) for more details.
119
- *
120
- * Here is an example of adding the GCP stackdriver transport:
121
- *
122
- * ```
123
- * import { log } from '@open-wa/wa-automate'
124
- * import { LoggingWinston } from '@google-cloud/logging-winston';
125
- *
126
- * const gcpTransport = new LoggingWinston({
127
- * projectId: 'your-project-id',
128
- * keyFilename: '/path/to/keyfile.json'
129
- * });
130
- *
131
- * ...
132
- * log.add(
133
- * gcpTransport
134
- * )
135
- *
136
- * //Congrats! Now all of your session logs will also go to GCP Stackdriver
137
- * ```
138
- */
139
- exports.log = makeLogger();
140
- if (exports.log.warning && !exports.log.warn)
141
- exports.log.warn = exports.log.warning;
142
- if (exports.log.alert && !exports.log.help)
143
- exports.log.help = exports.log.alert;
144
- const addRotateFileLogTransport = (options = {}) => {
145
- exports.log.add(new winston_daily_rotate_file_1.default(Object.assign({ filename: 'application-%DATE%.log', datePattern: 'YYYY-MM-DD-HH', zippedArchive: true, maxSize: '2m', maxFiles: '14d' }, options)));
146
- };
147
- exports.addRotateFileLogTransport = addRotateFileLogTransport;
148
- /**
149
- * @private
150
- */
151
- const addSysLogTransport = (options = {}) => {
152
- exports.log.add(new winston_syslog_1.Syslog(Object.assign({ localhost: os_1.default.hostname() }, options)));
153
- };
154
- exports.addSysLogTransport = addSysLogTransport;
155
- const enableConsoleLogger = (options = {}) => {
156
- if (_consoleSet)
157
- return;
158
- exports.log.add(new winston.transports.Console(Object.assign({ level: 'debug', timestamp: timestamp() }, options)));
159
- _consoleSet = true;
160
- };
161
- function enableLogToEv(options = {}) {
162
- if (_evSet)
163
- return;
164
- exports.log.add(new custom_transport_1.LogToEvTransport(Object.assign({ format: winston.format.json() }, options)));
165
- _evSet = true;
166
- }
167
- /**
168
- * @private
169
- */
170
- const setupLogging = (logging, sessionId = "session") => {
171
- const currentlySetup = [];
172
- const _logging = logging.map((l) => {
173
- if (l.done)
174
- return l;
175
- if (l.type === 'console') {
176
- enableConsoleLogger(Object.assign({}, (l.options || {})));
177
- }
178
- else if (l.type === 'ev') {
179
- enableLogToEv(Object.assign({}, (l.options || {})));
180
- }
181
- else if (l.type === 'file') {
182
- (0, exports.addRotateFileLogTransport)(Object.assign({}, (l.options || {})));
183
- }
184
- else if (l.type === 'syslog') {
185
- (0, exports.addSysLogTransport)(Object.assign(Object.assign({}, (l.options || {})), { appName: `owa-${sessionId}-${d}` }));
186
- }
187
- currentlySetup.push(l);
188
- return Object.assign(Object.assign({}, l), { done: true });
189
- });
190
- currentlySetup.map((l) => {
191
- exports.log.info(`Set up logging for ${l.type}`, l.options);
192
- return l;
193
- });
194
- return _logging;
195
- };
196
- exports.setupLogging = setupLogging;
@@ -1,202 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /**
4
- * This code is a copy of the Discord Collector: https://github.com/discordjs/discord.js/blob/stable/src/structures/interfaces/Collector.js
5
- *
6
- * Please see: https://discord.js.org/#/docs/main/stable/class/Collector
7
- */
8
- import { Collection as BaseCollection } from '@discordjs/collection';
9
- import { EventEmitter } from 'events';
10
- export declare class Collection<K, V> extends BaseCollection<K, V> {
11
- toJSON(): any[];
12
- }
13
- /**
14
- * Filter to be applied to the collector.
15
- * @typedef {Function} CollectorFilter
16
- * @param {...*} args Any arguments received by the listener
17
- * @param {Collection} collection The items collected by this collector
18
- * @returns {boolean|Promise<boolean>}
19
- */
20
- export type CollectorFilter<T extends any[]> = (...args: T) => boolean | Promise<boolean>;
21
- /**
22
- * Options to be applied to the collector.
23
- */
24
- export interface CollectorOptions {
25
- /**
26
- *The maximum amount of items to process
27
- */
28
- maxProcessed?: number;
29
- /**
30
- * The maximum amount of items to collect
31
- */
32
- max?: number;
33
- /**
34
- * Max time to wait for items in milliseconds
35
- */
36
- time?: number;
37
- /**
38
- * Max time allowed idle
39
- */
40
- idle?: number;
41
- /**
42
- * Whether to dispose data when it's deleted
43
- */
44
- dispose?: boolean;
45
- }
46
- export interface AwaitMessagesOptions extends CollectorOptions {
47
- /**
48
- * An array of "reasons" that would result in the awaitMessages command to throw an error.
49
- */
50
- errors?: string[];
51
- }
52
- /**
53
- * Abstract class for defining a new Collector.
54
- * @abstract
55
- */
56
- export declare class Collector extends EventEmitter {
57
- filter: (...args: any[]) => boolean | Promise<boolean>;
58
- options: CollectorOptions;
59
- collected: Collection<string, any>;
60
- protected _timeout: NodeJS.Timeout;
61
- protected _idletimeout: NodeJS.Timeout;
62
- ended: boolean;
63
- /**
64
- * Timeouts set by {@link BaseClient#setTimeout} that are still active
65
- * @type {Set<Timeout>}
66
- * @private
67
- */
68
- protected _timeouts: Set<NodeJS.Timeout>;
69
- /**
70
- * Intervals set by {@link BaseClient#setInterval} that are still active
71
- * @type {Set<Timeout>}
72
- * @private
73
- */
74
- protected _intervals: Set<NodeJS.Timeout>;
75
- /**
76
- * Intervals set by {@link BaseClient#setImmediate} that are still active
77
- * @type {Set<Immediate>}
78
- * @private
79
- */
80
- protected _immediates: Set<NodeJS.Immediate>;
81
- constructor(filter: CollectorFilter<any>, options?: CollectorOptions);
82
- /**
83
- * Call this to handle an event as a collectable element. Accepts any event data as parameters.
84
- * @param {...*} args The arguments emitted by the listener
85
- * @emits Collector#collect
86
- */
87
- handleCollect(...args: any[]): Promise<void>;
88
- /**
89
- * Call this to remove an element from the collection. Accepts any event data as parameters.
90
- * @param {...*} args The arguments emitted by the listener
91
- * @emits Collector#dispose
92
- */
93
- handleDispose(...args: any[]): Promise<void>;
94
- /**
95
- * Returns a promise that resolves with the next collected element;
96
- * rejects with collected elements if the collector finishes without receiving a next element
97
- * @type {Promise}
98
- * @readonly
99
- */
100
- get next(): Promise<any>;
101
- /**
102
- * Stops this collector and emits the `end` event.
103
- * @param {string} [reason='user'] The reason this collector is ending
104
- * @emits Collector#end
105
- */
106
- stop(reason?: string): void;
107
- /**
108
- * Resets the collectors timeout and idle timer.
109
- * @param {Object} [options] Options
110
- * @param {number} [options.time] How long to run the collector for in milliseconds
111
- * @param {number} [options.idle] How long to stop the collector after inactivity in milliseconds
112
- */
113
- resetTimer({ time, idle }?: {
114
- time: any;
115
- idle: any;
116
- }): void;
117
- /**
118
- * Checks whether the collector should end, and if so, ends it.
119
- */
120
- checkEnd(): void;
121
- /**
122
- * Allows collectors to be consumed with for-await-of loops
123
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of}
124
- */
125
- [Symbol.asyncIterator](): any;
126
- /**
127
- * Handles incoming events from the `handleCollect` function. Returns null if the event should not
128
- * be collected, or returns an object describing the data that should be stored.
129
- * @see Collector#handleCollect
130
- * @param {...*} _args Any args the event listener emits
131
- * @returns the id if the object should be collected, if it shouldnt be collected then it will return null or false.
132
- * @abstract
133
- */
134
- collect(...args: any[]): string | null | false;
135
- /**
136
- * Handles incoming events from the `handleDispose`. Returns null if the event should not
137
- * be disposed, or returns the key that should be removed.
138
- * @see Collector#handleDispose
139
- * @param {...*} args Any args the event listener emits
140
- * @returns {?*} Key to remove from the collection, if any
141
- * @abstract
142
- */
143
- dispose(...args: any[]): string | null;
144
- /**
145
- * The reason this collector has ended or will end with.
146
- * @returns {?string} Reason to end the collector, if any
147
- * @abstract
148
- */
149
- endReason(...args: any[]): string | null;
150
- /**
151
- * Clears a timeout.
152
- * @param {Timeout} timeout Timeout to cancel
153
- */
154
- clearTimeout(timeout: NodeJS.Timeout): void;
155
- /**
156
- * Sets an interval that will be automatically cancelled if the client is destroyed.
157
- * @param {Function} fn Function to execute
158
- * @param {number} delay Time to wait between executions (in milliseconds)
159
- * @param {...*} args Arguments for the function
160
- * @returns {Timeout}
161
- */
162
- setInterval(fn: (...args: any[]) => any, delay: number, ...args: any[]): NodeJS.Timeout;
163
- /**
164
- * Clears an interval.
165
- * @param {Timeout} interval Interval to cancel
166
- */
167
- clearInterval(interval: NodeJS.Timeout): void;
168
- /**
169
- * Sets an immediate that will be automatically cancelled if the client is destroyed.
170
- * @param {Function} fn Function to execute
171
- * @param {...*} args Arguments for the function
172
- * @returns {Immediate}
173
- */
174
- setImmediate(fn: (...args: any[]) => any, ...args: any[]): NodeJS.Immediate;
175
- /**
176
- * Clears an immediate.
177
- * @param {Immediate} immediate Immediate to cancel
178
- */
179
- clearImmediate(immediate: NodeJS.Immediate): void;
180
- /**
181
- * Increments max listeners by one, if they are not zero.
182
- * @private
183
- */
184
- protected incrementMaxListeners(): void;
185
- /**
186
- * Decrements max listeners by one, if they are not zero.
187
- * @private
188
- */
189
- protected decrementMaxListeners(): void;
190
- /**
191
- * Sets a timeout that will be automatically cancelled if the client is destroyed.
192
- * @param {Function} fn Function to execute
193
- * @param {number} delay Time to wait before executing (in milliseconds)
194
- * @param {...*} args Arguments for the function
195
- * @returns {Timeout}
196
- */
197
- setTimeout(fn: (...args: any[]) => any, delay: number, ...args: any[]): NodeJS.Timeout;
198
- /**
199
- * Destroys all assets used by the base client.
200
- */
201
- destroy(): void;
202
- }