@auxcode/auxta 1.3.23-beta.4 → 1.3.23-beta.5

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.
@@ -25,7 +25,7 @@ declare class AuxTA extends FunctionHelper {
25
25
  password: string;
26
26
  };
27
27
  };
28
- emailHelper: import("./macros/helpers/emailHelper").EmailHelper;
28
+ email: import("./macros/helpers/emailHelper").EmailHelper;
29
29
  private readonly uploadModel;
30
30
  constructor();
31
31
  run(event: any, overrideConfig?: any): Promise<{
@@ -57,7 +57,7 @@ class AuxTA extends code_helper_1.FunctionHelper {
57
57
  this.aux2fa = Aux2faAuth_1.default;
58
58
  this.google = AuxGoogleAuth_1.AuxGoogleAuth;
59
59
  this.config = config_1.config;
60
- this.emailHelper = emailHelper_1.default;
60
+ this.email = emailHelper_1.default;
61
61
  let file;
62
62
  if (!process.env.RPA) {
63
63
  try {
@@ -5,9 +5,14 @@ export declare class AuxGoogleAuth {
5
5
  static get oAuth2Client(): googleType.Auth.OAuth2Client;
6
6
  static get googleClient(): googleType.GoogleApis;
7
7
  static get gmailClient(): googleType.gmail_v1.Gmail;
8
+ static get currentUser(): currentUser;
8
9
  static setup(): Promise<void>;
9
10
  private static authorize;
10
11
  private static getNewToken;
11
12
  }
12
13
  declare const _default: AuxGoogleAuth;
13
14
  export default _default;
15
+ export interface currentUser {
16
+ name: string;
17
+ email: string;
18
+ }
@@ -37,6 +37,11 @@ class AuxGoogleAuth {
37
37
  static get gmailClient() {
38
38
  return google.gmail({ version: 'v1', auth: this._oAuth2Client });
39
39
  }
40
+ static get currentUser() {
41
+ const auth2 = google.auth2.getAuthInstance();
42
+ const profile = auth2.currentUser.get().getBasicProfile();
43
+ return { name: profile.getName(), email: profile.profile.getEmail() };
44
+ }
40
45
  static setup() {
41
46
  return __awaiter(this, void 0, void 0, function* () {
42
47
  yield this.authorize(this.credentialsJson);
@@ -75,13 +75,12 @@ class EmailHelper {
75
75
  format: 'FULL'
76
76
  });
77
77
  if (gmailResponse.data.payload) {
78
- const from = this.getHeader('from', gmailResponse.data.payload.headers);
79
78
  const message_subject = this.getHeader('subject', gmailResponse.data.payload.headers);
80
79
  const message_messageID = this.getHeader('Message-ID', gmailResponse.data.payload.headers);
81
- const to = this.getHeader('to', gmailResponse.data.payload.headers);
80
+ const reply_to = this.getHeader('reply-to', gmailResponse.data.payload.headers);
82
81
  const options = {
83
- "to": from,
84
- "from": to,
82
+ "to": reply_to,
83
+ "from": AuxGoogleAuth_1.AuxGoogleAuth.currentUser.email,
85
84
  "subject": `Re: ${message_subject}`,
86
85
  "References": message_messageID,
87
86
  "In-Reply-To": message_messageID,
@@ -1,5 +1,5 @@
1
1
  export declare class ExtendDefaultPage {
2
- readonly defaultTimeout: number;
2
+ defaultTimeout: number;
3
3
  extend_page_functions(page: any, time?: number): Promise<any>;
4
4
  }
5
5
  declare const _default: ExtendDefaultPage;
@@ -22,6 +22,7 @@ class ExtendDefaultPage {
22
22
  }
23
23
  extend_page_functions(page, time = this.defaultTimeout) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
+ this.defaultTimeout = config_1.config.timeout;
25
26
  const { goto: original_goto, click: original_click, type: original_type, waitForNetworkIdle: original_waitForNetworkIdle } = page;
26
27
  page.goto = function goto(url, options) {
27
28
  log_service_1.default.push('Then', `I go to the '${url}' page`, status_of_step_1.StatusOfStep.PASSED);
@@ -25,7 +25,7 @@ declare class AuxTA extends FunctionHelper {
25
25
  password: string;
26
26
  };
27
27
  };
28
- emailHelper: import("./macros/helpers/emailHelper").EmailHelper;
28
+ email: import("./macros/helpers/emailHelper").EmailHelper;
29
29
  private readonly uploadModel;
30
30
  constructor();
31
31
  run(event: any, overrideConfig?: any): Promise<{
@@ -28,7 +28,7 @@ class AuxTA extends FunctionHelper {
28
28
  this.aux2fa = Aux2faAuth;
29
29
  this.google = AuxGoogleAuth;
30
30
  this.config = c;
31
- this.emailHelper = emailHelper;
31
+ this.email = emailHelper;
32
32
  let file;
33
33
  if (!process.env.RPA) {
34
34
  try {
@@ -5,9 +5,14 @@ export declare class AuxGoogleAuth {
5
5
  static get oAuth2Client(): googleType.Auth.OAuth2Client;
6
6
  static get googleClient(): googleType.GoogleApis;
7
7
  static get gmailClient(): googleType.gmail_v1.Gmail;
8
+ static get currentUser(): currentUser;
8
9
  static setup(): Promise<void>;
9
10
  private static authorize;
10
11
  private static getNewToken;
11
12
  }
12
13
  declare const _default: AuxGoogleAuth;
13
14
  export default _default;
15
+ export interface currentUser {
16
+ name: string;
17
+ email: string;
18
+ }
@@ -34,6 +34,11 @@ export class AuxGoogleAuth {
34
34
  static get gmailClient() {
35
35
  return google.gmail({ version: 'v1', auth: this._oAuth2Client });
36
36
  }
37
+ static get currentUser() {
38
+ const auth2 = google.auth2.getAuthInstance();
39
+ const profile = auth2.currentUser.get().getBasicProfile();
40
+ return { name: profile.getName(), email: profile.profile.getEmail() };
41
+ }
37
42
  static setup() {
38
43
  return __awaiter(this, void 0, void 0, function* () {
39
44
  yield this.authorize(this.credentialsJson);
@@ -69,13 +69,12 @@ export class EmailHelper {
69
69
  format: 'FULL'
70
70
  });
71
71
  if (gmailResponse.data.payload) {
72
- const from = this.getHeader('from', gmailResponse.data.payload.headers);
73
72
  const message_subject = this.getHeader('subject', gmailResponse.data.payload.headers);
74
73
  const message_messageID = this.getHeader('Message-ID', gmailResponse.data.payload.headers);
75
- const to = this.getHeader('to', gmailResponse.data.payload.headers);
74
+ const reply_to = this.getHeader('reply-to', gmailResponse.data.payload.headers);
76
75
  const options = {
77
- "to": from,
78
- "from": to,
76
+ "to": reply_to,
77
+ "from": AuxGoogleAuth.currentUser.email,
79
78
  "subject": `Re: ${message_subject}`,
80
79
  "References": message_messageID,
81
80
  "In-Reply-To": message_messageID,
@@ -1,5 +1,5 @@
1
1
  export declare class ExtendDefaultPage {
2
- readonly defaultTimeout: number;
2
+ defaultTimeout: number;
3
3
  extend_page_functions(page: any, time?: number): Promise<any>;
4
4
  }
5
5
  declare const _default: ExtendDefaultPage;
@@ -16,6 +16,7 @@ export class ExtendDefaultPage {
16
16
  }
17
17
  extend_page_functions(page, time = this.defaultTimeout) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
+ this.defaultTimeout = config.timeout;
19
20
  const { goto: original_goto, click: original_click, type: original_type, waitForNetworkIdle: original_waitForNetworkIdle } = page;
20
21
  page.goto = function goto(url, options) {
21
22
  log.push('Then', `I go to the '${url}' page`, StatusOfStep.PASSED);