@auxcode/auxta 1.3.19-beta.9 → 1.3.19
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 +23 -3
- package/build/cjs/macros/helpers/AuxGoogleAuth.js +0 -1
- package/build/cjs/macros/helpers/code.helper.d.ts +2 -0
- package/build/cjs/macros/helpers/code.helper.js +44 -0
- package/build/esm/macros/helpers/AuxGoogleAuth.js +0 -1
- package/build/esm/macros/helpers/code.helper.d.ts +2 -0
- package/build/esm/macros/helpers/code.helper.js +44 -0
- package/build/tsconfig-cjs.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/build/cjs/macros/helpers/google.code.helper.d.ts +0 -7
- package/build/cjs/macros/helpers/google.code.helper.js +0 -58
- package/build/esm/macros/helpers/google.code.helper.d.ts +0 -7
- package/build/esm/macros/helpers/google.code.helper.js +0 -54
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FunctionHelper } from "./code.helper";
|
|
2
|
-
export declare class GoogleCodeHelper extends FunctionHelper {
|
|
3
|
-
clickInMail(from_email: string): Promise<boolean | undefined>;
|
|
4
|
-
private getHeader;
|
|
5
|
-
}
|
|
6
|
-
declare const _default: GoogleCodeHelper;
|
|
7
|
-
export default _default;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.GoogleCodeHelper = void 0;
|
|
13
|
-
const AuxGoogleAuth_1 = require("./AuxGoogleAuth");
|
|
14
|
-
const config_1 = require("../../auxta/configs/config");
|
|
15
|
-
const code_helper_1 = require("./code.helper");
|
|
16
|
-
class GoogleCodeHelper extends code_helper_1.FunctionHelper {
|
|
17
|
-
clickInMail(from_email) {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const res = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.list({
|
|
20
|
-
userId: config_1.config.googleEmail,
|
|
21
|
-
maxResults: 3
|
|
22
|
-
});
|
|
23
|
-
const messagesIds = res.data.messages;
|
|
24
|
-
if (!messagesIds || messagesIds.length === 0) {
|
|
25
|
-
console.log('No messagesIds found.');
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
let timeoutCount = 12000;
|
|
29
|
-
yield this.timeout(12000);
|
|
30
|
-
while (timeoutCount <= 60000) {
|
|
31
|
-
for (const messageId of messagesIds) {
|
|
32
|
-
if (messageId.id) {
|
|
33
|
-
const message = yield AuxGoogleAuth_1.AuxGoogleAuth.gmailClient.users.messages.get({ userId: config_1.config.googleEmail, id: messageId.id.toString(), format: 'FULL' });
|
|
34
|
-
if (message.data.payload) {
|
|
35
|
-
const sender = this.getHeader('sender', message.data.payload.headers);
|
|
36
|
-
if (sender.toLocaleLowerCase().includes(from_email.toLocaleLowerCase())) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
yield this.timeout(12000);
|
|
44
|
-
timeoutCount += 12000;
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
getHeader(value, headers) {
|
|
50
|
-
for (const header of headers) {
|
|
51
|
-
if (header.name.toLocaleLowerCase() === value.toLocaleLowerCase()) {
|
|
52
|
-
return header.value;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.GoogleCodeHelper = GoogleCodeHelper;
|
|
58
|
-
exports.default = new GoogleCodeHelper();
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FunctionHelper } from "./code.helper";
|
|
2
|
-
export declare class GoogleCodeHelper extends FunctionHelper {
|
|
3
|
-
clickInMail(from_email: string): Promise<boolean | undefined>;
|
|
4
|
-
private getHeader;
|
|
5
|
-
}
|
|
6
|
-
declare const _default: GoogleCodeHelper;
|
|
7
|
-
export default _default;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { AuxGoogleAuth } from "./AuxGoogleAuth";
|
|
11
|
-
import { config } from "../../auxta/configs/config";
|
|
12
|
-
import { FunctionHelper } from "./code.helper";
|
|
13
|
-
export class GoogleCodeHelper extends FunctionHelper {
|
|
14
|
-
clickInMail(from_email) {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const res = yield AuxGoogleAuth.gmailClient.users.messages.list({
|
|
17
|
-
userId: config.googleEmail,
|
|
18
|
-
maxResults: 3
|
|
19
|
-
});
|
|
20
|
-
const messagesIds = res.data.messages;
|
|
21
|
-
if (!messagesIds || messagesIds.length === 0) {
|
|
22
|
-
console.log('No messagesIds found.');
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
let timeoutCount = 12000;
|
|
26
|
-
yield this.timeout(12000);
|
|
27
|
-
while (timeoutCount <= 60000) {
|
|
28
|
-
for (const messageId of messagesIds) {
|
|
29
|
-
if (messageId.id) {
|
|
30
|
-
const message = yield AuxGoogleAuth.gmailClient.users.messages.get({ userId: config.googleEmail, id: messageId.id.toString(), format: 'FULL' });
|
|
31
|
-
if (message.data.payload) {
|
|
32
|
-
const sender = this.getHeader('sender', message.data.payload.headers);
|
|
33
|
-
if (sender.toLocaleLowerCase().includes(from_email.toLocaleLowerCase())) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
yield this.timeout(12000);
|
|
41
|
-
timeoutCount += 12000;
|
|
42
|
-
}
|
|
43
|
-
return false;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
getHeader(value, headers) {
|
|
47
|
-
for (const header of headers) {
|
|
48
|
-
if (header.name.toLocaleLowerCase() === value.toLocaleLowerCase()) {
|
|
49
|
-
return header.value;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
export default new GoogleCodeHelper();
|