@auxcode/auxta 1.3.26-beta.7 → 1.3.27

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.
@@ -128,12 +128,18 @@ class EmailHelper {
128
128
  }
129
129
  }
130
130
  getBody(subject, gmailResponse) {
131
- const body = gmailResponse.data.payload.parts[0].body.data;
132
- if (body) {
133
- return (0, buffer_1.atob)(body);
131
+ try {
132
+ const body = gmailResponse.data.payload.parts[0].body.data;
133
+ if (body) {
134
+ return (0, buffer_1.atob)(body);
135
+ }
136
+ else {
137
+ return '';
138
+ }
134
139
  }
135
- else {
136
- throw new Error(`Email with subject: ${subject} body is empty`);
140
+ catch (e) {
141
+ console.log(e);
142
+ throw new Error(`Email with subject: ${subject} body ${gmailResponse.data.payload.parts[0].body.data} is empty`);
137
143
  }
138
144
  }
139
145
  getCurrentUserEmail() {
@@ -146,7 +152,7 @@ class EmailHelper {
146
152
  getUrl(body) {
147
153
  return __awaiter(this, void 0, void 0, function* () {
148
154
  const links = [];
149
- const split = body.split('\r\n');
155
+ const split = body.split('\r\n\r\n');
150
156
  for (const splitElement of split) {
151
157
  if (splitElement.toString().startsWith('https')) {
152
158
  links.push(splitElement);
@@ -122,12 +122,18 @@ export class EmailHelper {
122
122
  }
123
123
  }
124
124
  getBody(subject, gmailResponse) {
125
- const body = gmailResponse.data.payload.parts[0].body.data;
126
- if (body) {
127
- return atob(body);
125
+ try {
126
+ const body = gmailResponse.data.payload.parts[0].body.data;
127
+ if (body) {
128
+ return atob(body);
129
+ }
130
+ else {
131
+ return '';
132
+ }
128
133
  }
129
- else {
130
- throw new Error(`Email with subject: ${subject} body is empty`);
134
+ catch (e) {
135
+ console.log(e);
136
+ throw new Error(`Email with subject: ${subject} body ${gmailResponse.data.payload.parts[0].body.data} is empty`);
131
137
  }
132
138
  }
133
139
  getCurrentUserEmail() {
@@ -140,7 +146,7 @@ export class EmailHelper {
140
146
  getUrl(body) {
141
147
  return __awaiter(this, void 0, void 0, function* () {
142
148
  const links = [];
143
- const split = body.split('\r\n');
149
+ const split = body.split('\r\n\r\n');
144
150
  for (const splitElement of split) {
145
151
  if (splitElement.toString().startsWith('https')) {
146
152
  links.push(splitElement);