@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.
- package/README.md +14 -165
- package/dist/cli-runtime-B7_3MM0c.cjs +798 -0
- package/dist/cli-runtime-B7_3MM0c.cjs.map +1 -0
- package/dist/cli-runtime-CmpYxFCk.d.cts +31 -0
- package/dist/cli-runtime-CmpYxFCk.d.cts.map +1 -0
- package/dist/cli.cjs +17 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +2 -0
- package/dist/index.cjs +224 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +81 -0
- package/dist/index.d.cts.map +1 -0
- package/package.json +34 -177
- package/CNAME +0 -1
- package/_tsconfig.docs.json +0 -140
- package/bin/config-schema.json +0 -1
- package/bin/oas-type-schemas.json +0 -1
- package/bin/server.js +0 -45
- package/build/build-config-json-for-bin.ts +0 -56
- package/build/generate-oas-types.ts +0 -31
- package/dist/api/Client.d.ts +0 -2255
- package/dist/api/Client.js +0 -4358
- package/dist/api/functions/exposed.enum.d.ts +0 -7
- package/dist/api/functions/exposed.enum.js +0 -11
- package/dist/api/model/aliases.d.ts +0 -110
- package/dist/api/model/aliases.js +0 -3
- package/dist/api/model/button.d.ts +0 -24
- package/dist/api/model/button.js +0 -2
- package/dist/api/model/call.d.ts +0 -51
- package/dist/api/model/call.js +0 -18
- package/dist/api/model/chat.d.ts +0 -221
- package/dist/api/model/chat.js +0 -52
- package/dist/api/model/config.d.ts +0 -836
- package/dist/api/model/config.js +0 -111
- package/dist/api/model/contact.d.ts +0 -143
- package/dist/api/model/contact.js +0 -2
- package/dist/api/model/errors.d.ts +0 -90
- package/dist/api/model/errors.js +0 -117
- package/dist/api/model/events.d.ts +0 -120
- package/dist/api/model/events.js +0 -127
- package/dist/api/model/group-metadata.d.ts +0 -124
- package/dist/api/model/group-metadata.js +0 -25
- package/dist/api/model/id.d.ts +0 -5
- package/dist/api/model/id.js +0 -2
- package/dist/api/model/index.d.ts +0 -110
- package/dist/api/model/index.js +0 -128
- package/dist/api/model/label.d.ts +0 -24
- package/dist/api/model/label.js +0 -2
- package/dist/api/model/media.d.ts +0 -93
- package/dist/api/model/media.js +0 -12
- package/dist/api/model/message.d.ts +0 -422
- package/dist/api/model/message.js +0 -40
- package/dist/api/model/product.d.ts +0 -141
- package/dist/api/model/product.js +0 -2
- package/dist/api/model/reactions.d.ts +0 -76
- package/dist/api/model/reactions.js +0 -2
- package/dist/api/model/sessionInfo.d.ts +0 -77
- package/dist/api/model/sessionInfo.js +0 -2
- package/dist/build/build-postman.d.ts +0 -1
- package/dist/build/build-postman.js +0 -262
- package/dist/cli/cli-options.d.ts +0 -9
- package/dist/cli/cli-options.js +0 -289
- package/dist/cli/collections.d.ts +0 -2
- package/dist/cli/collections.js +0 -251
- package/dist/cli/file-utils.d.ts +0 -1
- package/dist/cli/file-utils.js +0 -71
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +0 -231
- package/dist/cli/integrations/chatwoot.d.ts +0 -49
- package/dist/cli/integrations/chatwoot.js +0 -672
- package/dist/cli/integrations/cloudflare.d.ts +0 -6
- package/dist/cli/integrations/cloudflare.js +0 -76
- package/dist/cli/logo.d.ts +0 -1
- package/dist/cli/logo.js +0 -49
- package/dist/cli/server.d.ts +0 -24
- package/dist/cli/server.js +0 -540
- package/dist/cli/setup.d.ts +0 -30
- package/dist/cli/setup.js +0 -308
- package/dist/config/puppeteer.config.d.ts +0 -11
- package/dist/config/puppeteer.config.js +0 -65
- package/dist/controllers/auth.d.ts +0 -36
- package/dist/controllers/auth.js +0 -322
- package/dist/controllers/browser.d.ts +0 -17
- package/dist/controllers/browser.js +0 -603
- package/dist/controllers/events.d.ts +0 -82
- package/dist/controllers/events.js +0 -173
- package/dist/controllers/init_patch.d.ts +0 -13
- package/dist/controllers/init_patch.js +0 -42
- package/dist/controllers/initializer.d.ts +0 -22
- package/dist/controllers/initializer.js +0 -511
- package/dist/controllers/launch_checks.d.ts +0 -8
- package/dist/controllers/launch_checks.js +0 -130
- package/dist/controllers/patch_manager.d.ts +0 -37
- package/dist/controllers/patch_manager.js +0 -231
- package/dist/controllers/popup/index.d.ts +0 -3
- package/dist/controllers/popup/index.html +0 -168
- package/dist/controllers/popup/index.js +0 -148
- package/dist/controllers/script_preloader.d.ts +0 -17
- package/dist/controllers/script_preloader.js +0 -88
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -36
- package/dist/lib/README.md +0 -5
- package/dist/lib/base64.js +0 -1
- package/dist/lib/hash.js +0 -1
- package/dist/lib/jsSha.min.js +0 -1
- package/dist/lib/launch.js +0 -1
- package/dist/lib/qr.min.js +0 -1
- package/dist/lib/wapi.js +0 -2163
- package/dist/logging/custom_transport.d.ts +0 -9
- package/dist/logging/custom_transport.js +0 -35
- package/dist/logging/logging.d.ts +0 -50
- package/dist/logging/logging.js +0 -196
- package/dist/structures/Collector.d.ts +0 -202
- package/dist/structures/Collector.js +0 -391
- package/dist/structures/Dialog.d.ts +0 -55
- package/dist/structures/Dialog.js +0 -21
- package/dist/structures/MessageCollector.d.ts +0 -78
- package/dist/structures/MessageCollector.js +0 -145
- package/dist/structures/preProcessors.d.ts +0 -58
- package/dist/structures/preProcessors.js +0 -181
- package/dist/utils/pid_utils.d.ts +0 -1
- package/dist/utils/pid_utils.js +0 -26
- package/dist/utils/tools.d.ts +0 -152
- package/dist/utils/tools.js +0 -494
- package/tos.md +0 -77
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { EventEmitter2 } from 'eventemitter2';
|
|
2
|
-
import Spinnies from "spinnies";
|
|
3
|
-
/**
|
|
4
|
-
* This is the library's event emitter. Use this to listen to internal events of the library like so:
|
|
5
|
-
* ```javascript
|
|
6
|
-
* ev.on('event', callback)
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* The event you want to listen to is in the format of [namespace].[sessionId]
|
|
10
|
-
*
|
|
11
|
-
* The event can include wildcards.
|
|
12
|
-
*
|
|
13
|
-
* For example, to listen to all qr code events, the event will be `qr.**`. e.g:
|
|
14
|
-
*
|
|
15
|
-
* ```javascript
|
|
16
|
-
* ev.on('qr.**',...
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* Listen to all sessionData events
|
|
20
|
-
*
|
|
21
|
-
* ```javascript
|
|
22
|
-
* ev.on('sessionData.**',...
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* Listen to all events from session1
|
|
26
|
-
*
|
|
27
|
-
* ```javascript
|
|
28
|
-
* ev.on('**.session1',...
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* Listen to all events
|
|
32
|
-
*
|
|
33
|
-
* ```javascript
|
|
34
|
-
* ev.on('**.**',...
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* ev always emits data, sessionId and the namespace which is helpful to know if there are multiple sessions or you're listening to events from all namespaces
|
|
38
|
-
*
|
|
39
|
-
* ```javascript
|
|
40
|
-
* ev.on('**.**', (data, sessionId, namespace) => {
|
|
41
|
-
*
|
|
42
|
-
* console.log(`${namespace} event detected for session ${sessionId}`, data)
|
|
43
|
-
*
|
|
44
|
-
* });
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*/
|
|
50
|
-
export declare const ev: EventEmitter2;
|
|
51
|
-
/**
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
export declare class EvEmitter {
|
|
55
|
-
sessionId: string;
|
|
56
|
-
eventNamespace: string;
|
|
57
|
-
bannedTransports: string[];
|
|
58
|
-
constructor(sessionId: string, eventNamespace: string);
|
|
59
|
-
emit(data: unknown, eventNamespaceOverride?: string): void;
|
|
60
|
-
emitAsync(data: unknown, eventNamespaceOverride?: string): Promise<any>;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
export declare class Spin extends EvEmitter {
|
|
66
|
-
_spinner: Spinnies.Spinner;
|
|
67
|
-
_shouldEmit: boolean;
|
|
68
|
-
_spinId: string;
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
* @param sessionId The session id of the session. @default `session`
|
|
72
|
-
* @param eventNamespace The namespace of the event
|
|
73
|
-
* @param disableSpins If the spinnies should be animated @default `false`
|
|
74
|
-
* @param shouldEmit If the changes in the spinner should emit an event on the event emitter at `${eventNamesapce}.${sessionId}`
|
|
75
|
-
*/
|
|
76
|
-
constructor(sessionId: string, eventNamespace: string, disableSpins?: boolean, shouldEmit?: boolean);
|
|
77
|
-
start(eventMessage: string, indent?: number): void;
|
|
78
|
-
info(eventMessage: string): void;
|
|
79
|
-
fail(eventMessage: string): void;
|
|
80
|
-
succeed(eventMessage?: string): void;
|
|
81
|
-
remove(): void;
|
|
82
|
-
}
|
|
@@ -1,173 +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.Spin = exports.EvEmitter = exports.ev = void 0;
|
|
7
|
-
const eventemitter2_1 = require("eventemitter2");
|
|
8
|
-
const spinnies_1 = __importDefault(require("spinnies"));
|
|
9
|
-
const logging_1 = require("../logging/logging");
|
|
10
|
-
const spinner = {
|
|
11
|
-
"interval": 80,
|
|
12
|
-
"frames": [
|
|
13
|
-
"🌑 ",
|
|
14
|
-
"🌒 ",
|
|
15
|
-
"🌓 ",
|
|
16
|
-
"🌔 ",
|
|
17
|
-
"🌕 ",
|
|
18
|
-
"🌖 ",
|
|
19
|
-
"🌗 ",
|
|
20
|
-
"🌘 "
|
|
21
|
-
]
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* This is the library's event emitter. Use this to listen to internal events of the library like so:
|
|
25
|
-
* ```javascript
|
|
26
|
-
* ev.on('event', callback)
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* The event you want to listen to is in the format of [namespace].[sessionId]
|
|
30
|
-
*
|
|
31
|
-
* The event can include wildcards.
|
|
32
|
-
*
|
|
33
|
-
* For example, to listen to all qr code events, the event will be `qr.**`. e.g:
|
|
34
|
-
*
|
|
35
|
-
* ```javascript
|
|
36
|
-
* ev.on('qr.**',...
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* Listen to all sessionData events
|
|
40
|
-
*
|
|
41
|
-
* ```javascript
|
|
42
|
-
* ev.on('sessionData.**',...
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* Listen to all events from session1
|
|
46
|
-
*
|
|
47
|
-
* ```javascript
|
|
48
|
-
* ev.on('**.session1',...
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* Listen to all events
|
|
52
|
-
*
|
|
53
|
-
* ```javascript
|
|
54
|
-
* ev.on('**.**',...
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* ev always emits data, sessionId and the namespace which is helpful to know if there are multiple sessions or you're listening to events from all namespaces
|
|
58
|
-
*
|
|
59
|
-
* ```javascript
|
|
60
|
-
* ev.on('**.**', (data, sessionId, namespace) => {
|
|
61
|
-
*
|
|
62
|
-
* console.log(`${namespace} event detected for session ${sessionId}`, data)
|
|
63
|
-
*
|
|
64
|
-
* });
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*/
|
|
70
|
-
exports.ev = new eventemitter2_1.EventEmitter2({
|
|
71
|
-
wildcard: true,
|
|
72
|
-
});
|
|
73
|
-
/** @internal */
|
|
74
|
-
let globalSpinner;
|
|
75
|
-
const getGlobalSpinner = (disableSpins = false) => {
|
|
76
|
-
if (!globalSpinner)
|
|
77
|
-
globalSpinner = new spinnies_1.default({ color: 'blue', succeedColor: 'green', spinner, disableSpins });
|
|
78
|
-
return globalSpinner;
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* @internal
|
|
82
|
-
*/
|
|
83
|
-
class EvEmitter {
|
|
84
|
-
constructor(sessionId, eventNamespace) {
|
|
85
|
-
this.bannedTransports = [
|
|
86
|
-
//DO NOT ALLOW THESE NAMESPACES ON TRANSPORTS!!
|
|
87
|
-
"sessionData",
|
|
88
|
-
"sessionDataBase64",
|
|
89
|
-
"qr",
|
|
90
|
-
];
|
|
91
|
-
this.sessionId = sessionId;
|
|
92
|
-
this.eventNamespace = eventNamespace;
|
|
93
|
-
}
|
|
94
|
-
emit(data, eventNamespaceOverride) {
|
|
95
|
-
const eventName = `${eventNamespaceOverride || this.eventNamespace}.${this.sessionId}`;
|
|
96
|
-
const sessionId = this.sessionId;
|
|
97
|
-
const eventNamespace = eventNamespaceOverride || this.eventNamespace;
|
|
98
|
-
exports.ev.emit(eventName, data, sessionId, eventNamespace);
|
|
99
|
-
if (!this.bannedTransports.find(x => eventNamespace == x))
|
|
100
|
-
logging_1.log.info(typeof data === 'string' ? data : eventName, {
|
|
101
|
-
eventName,
|
|
102
|
-
data,
|
|
103
|
-
sessionId,
|
|
104
|
-
eventNamespace
|
|
105
|
-
});
|
|
106
|
-
// ev.emit(`${this.sessionId}.${this.eventNamespace}`,data,this.sessionId,this.eventNamespace);
|
|
107
|
-
}
|
|
108
|
-
emitAsync(data, eventNamespaceOverride) {
|
|
109
|
-
const eventName = `${eventNamespaceOverride || this.eventNamespace}.${this.sessionId}`;
|
|
110
|
-
const sessionId = this.sessionId;
|
|
111
|
-
const eventNamespace = eventNamespaceOverride || this.eventNamespace;
|
|
112
|
-
if (!this.bannedTransports.find(x => eventNamespace == x))
|
|
113
|
-
logging_1.log.info(typeof data === 'string' ? data : eventName, {
|
|
114
|
-
eventName,
|
|
115
|
-
data,
|
|
116
|
-
sessionId,
|
|
117
|
-
eventNamespace
|
|
118
|
-
});
|
|
119
|
-
return exports.ev.emitAsync(eventName, data, sessionId, eventNamespace);
|
|
120
|
-
// ev.emit(`${this.sessionId}.${this.eventNamespace}`,data,this.sessionId,this.eventNamespace);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
exports.EvEmitter = EvEmitter;
|
|
124
|
-
/**
|
|
125
|
-
* @internal
|
|
126
|
-
*/
|
|
127
|
-
class Spin extends EvEmitter {
|
|
128
|
-
/**
|
|
129
|
-
*
|
|
130
|
-
* @param sessionId The session id of the session. @default `session`
|
|
131
|
-
* @param eventNamespace The namespace of the event
|
|
132
|
-
* @param disableSpins If the spinnies should be animated @default `false`
|
|
133
|
-
* @param shouldEmit If the changes in the spinner should emit an event on the event emitter at `${eventNamesapce}.${sessionId}`
|
|
134
|
-
*/
|
|
135
|
-
constructor(sessionId = 'session', eventNamespace, disableSpins = false, shouldEmit = true) {
|
|
136
|
-
super(sessionId, eventNamespace);
|
|
137
|
-
if (!sessionId)
|
|
138
|
-
sessionId = 'session';
|
|
139
|
-
this._spinId = sessionId + "_" + eventNamespace;
|
|
140
|
-
this._spinner = getGlobalSpinner(disableSpins);
|
|
141
|
-
this._shouldEmit = shouldEmit;
|
|
142
|
-
}
|
|
143
|
-
start(eventMessage, indent) {
|
|
144
|
-
this._spinner.add(this._spinId, { text: eventMessage, indent });
|
|
145
|
-
if (this._shouldEmit)
|
|
146
|
-
this.emit(eventMessage);
|
|
147
|
-
}
|
|
148
|
-
info(eventMessage) {
|
|
149
|
-
if (!this._spinner.pick(this._spinId))
|
|
150
|
-
this.start('');
|
|
151
|
-
this._spinner.update(this._spinId, { text: eventMessage });
|
|
152
|
-
if (this._shouldEmit)
|
|
153
|
-
this.emit(eventMessage);
|
|
154
|
-
}
|
|
155
|
-
fail(eventMessage) {
|
|
156
|
-
if (!this._spinner.pick(this._spinId))
|
|
157
|
-
this.start('');
|
|
158
|
-
this._spinner.fail(this._spinId, { text: eventMessage });
|
|
159
|
-
if (this._shouldEmit)
|
|
160
|
-
this.emit(eventMessage);
|
|
161
|
-
}
|
|
162
|
-
succeed(eventMessage) {
|
|
163
|
-
if (!this._spinner.pick(this._spinId))
|
|
164
|
-
this.start('');
|
|
165
|
-
this._spinner.succeed(this._spinId, { text: eventMessage });
|
|
166
|
-
if (this._shouldEmit)
|
|
167
|
-
this.emit(eventMessage || 'SUCCESS');
|
|
168
|
-
}
|
|
169
|
-
remove() {
|
|
170
|
-
this._spinner.remove(this._spinId);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
exports.Spin = Spin;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Page } from 'puppeteer';
|
|
2
|
-
/**
|
|
3
|
-
* @private
|
|
4
|
-
*/
|
|
5
|
-
export declare function injectInitPatch(page: Page): Promise<void>;
|
|
6
|
-
/**
|
|
7
|
-
* @private
|
|
8
|
-
*/
|
|
9
|
-
export declare function injectProgObserver(page: Page): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* @private
|
|
12
|
-
*/
|
|
13
|
-
export declare function injectInternalEventHandler(page: Page): Promise<void>;
|