rez_core 2.2.229 → 2.2.231
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/dist/module/communication/controller/webhook.controller.d.ts +0 -1
- package/dist/module/communication/controller/webhook.controller.js +0 -15
- package/dist/module/communication/controller/webhook.controller.js.map +1 -1
- package/dist/module/communication/strategies/email/gmail-api.strategy.js +2 -1
- package/dist/module/communication/strategies/email/gmail-api.strategy.js.map +1 -1
- package/dist/module/meta/entity/view-master.entity.d.ts +1 -0
- package/dist/module/meta/entity/view-master.entity.js +4 -0
- package/dist/module/meta/entity/view-master.entity.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/communication/controller/webhook.controller.ts +0 -9
- package/src/module/communication/strategies/email/gmail-api.strategy.ts +8 -17
- package/src/module/meta/entity/view-master.entity.ts +3 -0
package/package.json
CHANGED
|
@@ -11,13 +11,4 @@ export class WebhookController {
|
|
|
11
11
|
console.log(req);
|
|
12
12
|
res.status(200).send('Webhook received');
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
@Post('ozonetel')
|
|
16
|
-
handleOzonetelWebhook(@Req() req: any, @Res() res: Response) {
|
|
17
|
-
const apiKey = req.headers['x-api-key'];
|
|
18
|
-
console.log('API Key:', apiKey);
|
|
19
|
-
console.log('handleOzonetelWebhook: START');
|
|
20
|
-
console.log(req);
|
|
21
|
-
res.status(200).send('Webhook received');
|
|
22
|
-
}
|
|
23
14
|
}
|
|
@@ -90,7 +90,7 @@ export class GmailApiStrategy implements CommunicationStrategy {
|
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
console.log('---- Gmail SDK API Success ----');
|
|
93
|
-
|
|
93
|
+
console.log('Message ID:', result.data.id);
|
|
94
94
|
|
|
95
95
|
// Get fresh access token for database update
|
|
96
96
|
const credentials = oauth2Client.credentials;
|
|
@@ -140,6 +140,7 @@ export class GmailApiStrategy implements CommunicationStrategy {
|
|
|
140
140
|
// Get system OAuth credentials
|
|
141
141
|
const clientId = this.configService.get<string>('CLIENT_ID');
|
|
142
142
|
const clientSecret = this.configService.get<string>('CLIENT_SECRET');
|
|
143
|
+
const callbackurl = this.configService.get<string>('CALLBACK_URL');
|
|
143
144
|
|
|
144
145
|
if (!clientId || !clientSecret) {
|
|
145
146
|
throw new Error('Gmail OAuth system credentials not configured');
|
|
@@ -151,7 +152,7 @@ export class GmailApiStrategy implements CommunicationStrategy {
|
|
|
151
152
|
const oauth2Client = new google.auth.OAuth2(
|
|
152
153
|
clientId,
|
|
153
154
|
clientSecret,
|
|
154
|
-
|
|
155
|
+
callbackurl, // For server-to-server
|
|
155
156
|
);
|
|
156
157
|
|
|
157
158
|
// Set the refresh token
|
|
@@ -165,13 +166,8 @@ export class GmailApiStrategy implements CommunicationStrategy {
|
|
|
165
166
|
console.log('---- OAuth2 client setup completed ----');
|
|
166
167
|
return oauth2Client;
|
|
167
168
|
} catch (error) {
|
|
168
|
-
console.error(
|
|
169
|
-
|
|
170
|
-
error.message,
|
|
171
|
-
);
|
|
172
|
-
throw new Error(
|
|
173
|
-
`Failed to setup Gmail OAuth2 client: ${error.message}`,
|
|
174
|
-
);
|
|
169
|
+
console.error('Failed to setup OAuth2 client:', error.message);
|
|
170
|
+
throw new Error(`Failed to setup Gmail OAuth2 client: ${error.message}`);
|
|
175
171
|
}
|
|
176
172
|
}
|
|
177
173
|
|
|
@@ -179,7 +175,7 @@ export class GmailApiStrategy implements CommunicationStrategy {
|
|
|
179
175
|
try {
|
|
180
176
|
const oauth2Client = await this.setupOAuth2Client(config);
|
|
181
177
|
const { token } = await oauth2Client.getAccessToken();
|
|
182
|
-
|
|
178
|
+
|
|
183
179
|
if (!token) {
|
|
184
180
|
throw new Error('No access token received from OAuth2 client');
|
|
185
181
|
}
|
|
@@ -191,9 +187,7 @@ export class GmailApiStrategy implements CommunicationStrategy {
|
|
|
191
187
|
'Failed to refresh access token via Google SDK:',
|
|
192
188
|
error.message,
|
|
193
189
|
);
|
|
194
|
-
throw new Error(
|
|
195
|
-
`Failed to refresh Gmail access token: ${error.message}`,
|
|
196
|
-
);
|
|
190
|
+
throw new Error(`Failed to refresh Gmail access token: ${error.message}`);
|
|
197
191
|
}
|
|
198
192
|
}
|
|
199
193
|
|
|
@@ -214,10 +208,7 @@ export class GmailApiStrategy implements CommunicationStrategy {
|
|
|
214
208
|
|
|
215
209
|
return !!(profile.data && profile.data.emailAddress);
|
|
216
210
|
} catch (error) {
|
|
217
|
-
console.error(
|
|
218
|
-
'Gmail connection validation failed:',
|
|
219
|
-
error.message,
|
|
220
|
-
);
|
|
211
|
+
console.error('Gmail connection validation failed:', error.message);
|
|
221
212
|
return false;
|
|
222
213
|
}
|
|
223
214
|
}
|
|
@@ -27,6 +27,9 @@ export class ViewMaster extends BaseEntity {
|
|
|
27
27
|
@Column({ type: 'json', nullable: true })
|
|
28
28
|
published_form_fields: string;
|
|
29
29
|
|
|
30
|
+
@Column({ type: 'json', nullable: true })
|
|
31
|
+
published_rules_json: string;
|
|
32
|
+
|
|
30
33
|
@Column({ type: 'json', nullable: true })
|
|
31
34
|
meta_json: string;
|
|
32
35
|
|