@app-connect/core 1.7.0-beta.1 → 1.7.0-beta.3

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/handlers/user.js CHANGED
@@ -20,7 +20,6 @@ async function getUserSettingsByAdmin({ rcAccessToken, rcAccountId }) {
20
20
  }
21
21
  const adminConfig = await AdminConfigModel.findByPk(hashedRcAccountId);
22
22
  return {
23
- customManifestUrl: adminConfig?.customAdapter,
24
23
  userSettings: adminConfig?.userSettings
25
24
  };
26
25
  }
package/index.js CHANGED
@@ -87,6 +87,7 @@ function createCoreRouter() {
87
87
  res.json(mergedReleaseNotes);
88
88
  });
89
89
 
90
+ // Obsolete
90
91
  router.get('/crmManifest', (req, res) => {
91
92
  try {
92
93
  const platformName = req.query.platformName || 'default';
@@ -235,6 +236,7 @@ function createCoreRouter() {
235
236
  });
236
237
  });
237
238
 
239
+ // Obsolete
238
240
  router.get('/serverVersionInfo', (req, res) => {
239
241
  const defaultCrmManifest = adapterRegistry.getManifest('default');
240
242
  res.send({ version: defaultCrmManifest?.version ?? 'unknown' });
@@ -1500,6 +1502,23 @@ function createCoreRouter() {
1500
1502
  });
1501
1503
  });
1502
1504
 
1505
+ router.get('/ringcentral/oauth/callback', async function (req, res) {
1506
+ const jwtToken = req.query.jwtToken;
1507
+ if (jwtToken) {
1508
+ const unAuthData = jwt.decodeJwt(jwtToken);
1509
+ const { code } = req.query;
1510
+ const user = await UserModel.findByPk(unAuthData?.id);
1511
+ if (!user) {
1512
+ res.status(400).send('User not found');
1513
+ return;
1514
+ }
1515
+ await authCore.onRingcentralOAuthCallback({ code, rcAccountId: user.rcAccountId });
1516
+ res.status(200).send('OK');
1517
+ return;
1518
+ }
1519
+ res.status(400).send('Invalid request');
1520
+ });
1521
+
1503
1522
  if (process.env.IS_PROD === 'false') {
1504
1523
  router.post('/registerMockUser', async function (req, res) {
1505
1524
  const secretKey = req.query.secretKey;
@@ -621,9 +621,16 @@ function upsertLegs({ body, legs, logFormat }) {
621
621
  * @returns {string} Format type
622
622
  */
623
623
  function getLogFormatType(platform) {
624
- const manifest = adapterRegistry.getManifest(platform, true);
625
- const platformConfig = manifest.platforms?.[platform];
626
- return platformConfig?.logFormat;
624
+ if(process.env.LOG_FORMAT_PLAIN_TEXT_PLATFORMS.split(',').includes(platform)){
625
+ return LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT;
626
+ }
627
+ if(process.env.LOG_FORMAT_HTML_PLATFORMS.split(',').includes(platform)){
628
+ return LOG_DETAILS_FORMAT_TYPE.HTML;
629
+ }
630
+ if(process.env.LOG_FORMAT_MARKDOWN_PLATFORMS.split(',').includes(platform)){
631
+ return LOG_DETAILS_FORMAT_TYPE.MARKDOWN;
632
+ }
633
+ return LOG_DETAILS_FORMAT_TYPE.PLAIN_TEXT;
627
634
  }
628
635
 
629
636
  module.exports = {
package/lib/oauth.js CHANGED
@@ -33,7 +33,7 @@ async function checkAndRefreshAccessToken(oauthApp, user, tokenLockTimeout = 20)
33
33
  // Other CRMs - check if token will expire within the buffer time
34
34
  if (user && user.accessToken && user.refreshToken && tokenExpiry.isBefore(now.clone().add(expiryBuffer, 'minutes'))) {
35
35
  // case: use dynamoDB to manage token refresh lock
36
- if (adapterRegistry.getManifest('default')?.platforms?.[user.platform]?.auth?.useTokenRefreshLock) {
36
+ if (process.env.USE_TOKEN_REFRESH_LOCK_PLATFORMS.split(',').includes(user.platform)) {
37
37
  let newLock;
38
38
  const { Lock } = require('../models/dynamo/lockSchema');
39
39
  // Try to atomically create lock only if it doesn't exist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-connect/core",
3
- "version": "1.7.0-beta.1",
3
+ "version": "1.7.0-beta.3",
4
4
  "description": "RingCentral App Connect Core",
5
5
  "main": "index.js",
6
6
  "repository": {
package/releaseNotes.json CHANGED
@@ -1,4 +1,28 @@
1
1
  {
2
+ "1.6.9": {
3
+ "global": [
4
+ {
5
+ "type": "New",
6
+ "description": "- Server-side logging now supports multiple RingCentral users to be mapped under one CRM user"
7
+ },
8
+ {
9
+ "type": "Fix",
10
+ "description": "- Server-side logging user mapping not working properly when running under multi-site scenarios"
11
+ }
12
+ ]
13
+ },
14
+ "1.6.8": {
15
+ "global": [
16
+ {
17
+ "type": "Fix",
18
+ "description": "- Server-side logging, if it's created by one admin, the other admin will be able to see its status"
19
+ },
20
+ {
21
+ "type": "Fix",
22
+ "description": "- Conference calls show wrong warning message"
23
+ }
24
+ ]
25
+ },
2
26
  "1.6.7": {
3
27
  "global": [
4
28
  {