@wppconnect-team/wppconnect 2.0.0 → 2.0.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/CHANGELOG.md +12 -0
- package/dist/api/helpers/base64-mimetype.js +2 -2
- package/dist/api/helpers/decrypt.js +65 -72
- package/dist/api/helpers/download-file.js +31 -81
- package/dist/api/helpers/evaluate-and-return.js +98 -93
- package/dist/api/helpers/file-to-base64.js +30 -81
- package/dist/api/helpers/filename-from-mimetype.js +4 -4
- package/dist/api/helpers/scrape-img-qr.js +37 -86
- package/dist/api/helpers/scrape-login.js +12 -57
- package/dist/api/helpers/select-sticker.js +35 -100
- package/dist/api/layers/business.layer.js +29 -134
- package/dist/api/layers/catalog.layer.js +59 -210
- package/dist/api/layers/community.layer.js +29 -120
- package/dist/api/layers/controls.layer.js +62 -262
- package/dist/api/layers/group.layer.js +126 -391
- package/dist/api/layers/host.layer.js +348 -702
- package/dist/api/layers/labels.layer.js +35 -131
- package/dist/api/layers/listener.layer.js +386 -504
- package/dist/api/layers/newsletter.layer.js +20 -89
- package/dist/api/layers/profile.layer.js +73 -184
- package/dist/api/layers/retriever.layer.js +161 -468
- package/dist/api/layers/sender.layer.js +554 -1094
- package/dist/api/layers/status.layer.js +80 -179
- package/dist/api/layers/ui.layer.js +32 -129
- package/dist/api/model/enum/definitions.js +1 -1
- package/dist/api/whatsapp.js +200 -437
- package/dist/config/WAuserAgente.js +1 -1
- package/dist/config/create-config.js +1 -1
- package/dist/config/puppeteer.config.js +1 -1
- package/dist/controllers/auth.js +42 -110
- package/dist/controllers/browser.js +251 -411
- package/dist/controllers/initializer.js +171 -265
- package/dist/controllers/websocket.js +29 -28
- package/dist/controllers/welcome.js +38 -88
- package/dist/token-store/fileTokenStore.js +83 -173
- package/dist/token-store/isValidSessionToken.js +2 -2
- package/dist/token-store/isValidTokenStore.js +2 -2
- package/dist/token-store/memoryTokenStore.js +11 -14
- package/dist/utils/ffmpeg.js +75 -131
- package/dist/utils/logger.js +5 -5
- package/dist/utils/semver.js +6 -6
- package/dist/utils/sleep.js +1 -1
- package/package.json +8 -8
|
@@ -15,67 +15,15 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Lesser General Public License
|
|
16
16
|
* along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
var __extends = (this && this.__extends) || (function () {
|
|
19
|
-
var extendStatics = function (d, b) {
|
|
20
|
-
extendStatics = Object.setPrototypeOf ||
|
|
21
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
22
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
23
|
-
return extendStatics(d, b);
|
|
24
|
-
};
|
|
25
|
-
return function (d, b) {
|
|
26
|
-
if (typeof b !== "function" && b !== null)
|
|
27
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
28
|
-
extendStatics(d, b);
|
|
29
|
-
function __() { this.constructor = d; }
|
|
30
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
31
|
-
};
|
|
32
|
-
})();
|
|
33
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
34
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
35
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
36
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
37
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
38
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
39
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
43
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
44
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
45
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
|
-
function step(op) {
|
|
47
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
|
-
switch (op[0]) {
|
|
52
|
-
case 0: case 1: t = op; break;
|
|
53
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
54
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
55
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
56
|
-
default:
|
|
57
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
58
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
59
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
60
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
61
|
-
if (t[2]) _.ops.pop();
|
|
62
|
-
_.trys.pop(); continue;
|
|
63
|
-
}
|
|
64
|
-
op = body.call(thisArg, _);
|
|
65
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
66
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
19
|
exports.LabelsLayer = void 0;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return _this;
|
|
20
|
+
const helpers_1 = require("../helpers");
|
|
21
|
+
const catalog_layer_1 = require("./catalog.layer");
|
|
22
|
+
class LabelsLayer extends catalog_layer_1.CatalogLayer {
|
|
23
|
+
page;
|
|
24
|
+
constructor(page, session, options) {
|
|
25
|
+
super(page, session, options);
|
|
26
|
+
this.page = page;
|
|
79
27
|
}
|
|
80
28
|
/**
|
|
81
29
|
* Create New Label
|
|
@@ -92,19 +40,11 @@ var LabelsLayer = /** @class */ (function (_super) {
|
|
|
92
40
|
* @param name Name of label
|
|
93
41
|
* @param options options of label
|
|
94
42
|
*/
|
|
95
|
-
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var name = _a.name, options = _a.options;
|
|
101
|
-
WPP.labels.addNewLabel(name, options);
|
|
102
|
-
}, { name: name, options: options })];
|
|
103
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
};
|
|
43
|
+
async addNewLabel(name, options) {
|
|
44
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ name, options }) => {
|
|
45
|
+
WPP.labels.addNewLabel(name, options);
|
|
46
|
+
}, { name, options });
|
|
47
|
+
}
|
|
108
48
|
/**
|
|
109
49
|
* Add or delete label of chatId
|
|
110
50
|
* @category Labels
|
|
@@ -121,19 +61,11 @@ var LabelsLayer = /** @class */ (function (_super) {
|
|
|
121
61
|
* @param chatIds ChatIds
|
|
122
62
|
* @param options options to remove or add
|
|
123
63
|
*/
|
|
124
|
-
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var chatIds = _a.chatIds, options = _a.options;
|
|
130
|
-
WPP.labels.addOrRemoveLabels(chatIds, options);
|
|
131
|
-
}, { chatIds: chatIds, options: options })];
|
|
132
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
};
|
|
64
|
+
async addOrRemoveLabels(chatIds, options) {
|
|
65
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ chatIds, options }) => {
|
|
66
|
+
WPP.labels.addOrRemoveLabels(chatIds, options);
|
|
67
|
+
}, { chatIds, options });
|
|
68
|
+
}
|
|
137
69
|
/**
|
|
138
70
|
* Get all Labels
|
|
139
71
|
*
|
|
@@ -142,13 +74,9 @@ var LabelsLayer = /** @class */ (function (_super) {
|
|
|
142
74
|
* client.getAllLabels();
|
|
143
75
|
* ```
|
|
144
76
|
*/
|
|
145
|
-
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.labels.getAllLabels(); })];
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
};
|
|
77
|
+
async getAllLabels() {
|
|
78
|
+
return (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.labels.getAllLabels());
|
|
79
|
+
}
|
|
152
80
|
/**
|
|
153
81
|
* Get Label by id
|
|
154
82
|
* @category Labels
|
|
@@ -159,19 +87,11 @@ var LabelsLayer = /** @class */ (function (_super) {
|
|
|
159
87
|
* client.getLabelById('1');
|
|
160
88
|
* ```
|
|
161
89
|
*/
|
|
162
|
-
|
|
163
|
-
return
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var id = _a.id;
|
|
168
|
-
WPP.labels.getLabelById(id);
|
|
169
|
-
}, { id: id })];
|
|
170
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
};
|
|
90
|
+
async getLabelById(id) {
|
|
91
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ id }) => {
|
|
92
|
+
WPP.labels.getLabelById(id);
|
|
93
|
+
}, { id });
|
|
94
|
+
}
|
|
175
95
|
/**
|
|
176
96
|
* Delete all Labels
|
|
177
97
|
* @category Labels
|
|
@@ -181,18 +101,11 @@ var LabelsLayer = /** @class */ (function (_super) {
|
|
|
181
101
|
* client.deleteAllLabels();
|
|
182
102
|
* ```
|
|
183
103
|
*/
|
|
184
|
-
|
|
185
|
-
return
|
|
186
|
-
|
|
187
|
-
switch (_a.label) {
|
|
188
|
-
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () {
|
|
189
|
-
WPP.labels.deleteAllLabels();
|
|
190
|
-
})];
|
|
191
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
192
|
-
}
|
|
193
|
-
});
|
|
104
|
+
async deleteAllLabels() {
|
|
105
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, () => {
|
|
106
|
+
WPP.labels.deleteAllLabels();
|
|
194
107
|
});
|
|
195
|
-
}
|
|
108
|
+
}
|
|
196
109
|
/**
|
|
197
110
|
* Add or delete label of chatId
|
|
198
111
|
* @category Labels
|
|
@@ -203,19 +116,10 @@ var LabelsLayer = /** @class */ (function (_super) {
|
|
|
203
116
|
* ```
|
|
204
117
|
* @param id Id or string to labels to delete
|
|
205
118
|
*/
|
|
206
|
-
|
|
207
|
-
return
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
WPP.labels.deleteLabel(id);
|
|
213
|
-
}, { id: id })];
|
|
214
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
};
|
|
219
|
-
return LabelsLayer;
|
|
220
|
-
}(catalog_layer_1.CatalogLayer));
|
|
119
|
+
async deleteLabel(id) {
|
|
120
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ id }) => {
|
|
121
|
+
WPP.labels.deleteLabel(id);
|
|
122
|
+
}, { id });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
221
125
|
exports.LabelsLayer = LabelsLayer;
|