@app-connect/core 0.0.3 → 1.6.4
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/.env.test +5 -5
- package/README.md +434 -425
- package/adapter/mock.js +76 -76
- package/adapter/registry.js +247 -247
- package/handlers/admin.js +62 -60
- package/handlers/auth.js +205 -156
- package/handlers/contact.js +274 -274
- package/handlers/disposition.js +193 -193
- package/handlers/log.js +612 -586
- package/handlers/user.js +101 -101
- package/index.js +1302 -1202
- package/jest.config.js +56 -56
- package/lib/analytics.js +52 -52
- package/lib/callLogComposer.js +550 -451
- package/lib/constants.js +9 -0
- package/lib/encode.js +30 -30
- package/lib/generalErrorMessage.js +41 -41
- package/lib/jwt.js +16 -16
- package/lib/oauth.js +79 -29
- package/lib/util.js +43 -40
- package/models/adminConfigModel.js +17 -17
- package/models/cacheModel.js +23 -23
- package/models/callLogModel.js +27 -27
- package/models/dynamo/lockSchema.js +24 -24
- package/models/dynamo/noteCacheSchema.js +30 -0
- package/models/messageLogModel.js +25 -25
- package/models/sequelize.js +16 -16
- package/models/userModel.js +38 -38
- package/package.json +67 -64
- package/releaseNotes.json +701 -577
- package/test/adapter/registry.test.js +270 -270
- package/test/handlers/auth.test.js +230 -230
- package/test/lib/jwt.test.js +161 -161
- package/test/setup.js +176 -176
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const Sequelize = require('sequelize');
|
|
2
|
-
const { sequelize } = require('./sequelize');
|
|
3
|
-
|
|
4
|
-
// Model for User data
|
|
5
|
-
exports.MessageLogModel = sequelize.define('messageLogs', {
|
|
6
|
-
id: {
|
|
7
|
-
type: Sequelize.STRING,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
platform: {
|
|
11
|
-
type: Sequelize.STRING,
|
|
12
|
-
},
|
|
13
|
-
conversationId: {
|
|
14
|
-
type: Sequelize.STRING,
|
|
15
|
-
},
|
|
16
|
-
conversationLogId:{
|
|
17
|
-
type: Sequelize.STRING,
|
|
18
|
-
},
|
|
19
|
-
thirdPartyLogId: {
|
|
20
|
-
type: Sequelize.STRING,
|
|
21
|
-
},
|
|
22
|
-
userId: {
|
|
23
|
-
type: Sequelize.STRING,
|
|
24
|
-
}
|
|
25
|
-
});
|
|
1
|
+
const Sequelize = require('sequelize');
|
|
2
|
+
const { sequelize } = require('./sequelize');
|
|
3
|
+
|
|
4
|
+
// Model for User data
|
|
5
|
+
exports.MessageLogModel = sequelize.define('messageLogs', {
|
|
6
|
+
id: {
|
|
7
|
+
type: Sequelize.STRING,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
platform: {
|
|
11
|
+
type: Sequelize.STRING,
|
|
12
|
+
},
|
|
13
|
+
conversationId: {
|
|
14
|
+
type: Sequelize.STRING,
|
|
15
|
+
},
|
|
16
|
+
conversationLogId:{
|
|
17
|
+
type: Sequelize.STRING,
|
|
18
|
+
},
|
|
19
|
+
thirdPartyLogId: {
|
|
20
|
+
type: Sequelize.STRING,
|
|
21
|
+
},
|
|
22
|
+
userId: {
|
|
23
|
+
type: Sequelize.STRING,
|
|
24
|
+
}
|
|
25
|
+
});
|
package/models/sequelize.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const { Sequelize } = require('sequelize');
|
|
2
|
-
|
|
3
|
-
const sequelize = new Sequelize(process.env.DATABASE_URL,
|
|
4
|
-
{
|
|
5
|
-
dialect: 'postgres',
|
|
6
|
-
protocol: 'postgres',
|
|
7
|
-
dialectOptions:{
|
|
8
|
-
ssl: {
|
|
9
|
-
rejectUnauthorized: false
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
logging: false
|
|
13
|
-
}
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
const { Sequelize } = require('sequelize');
|
|
2
|
+
|
|
3
|
+
const sequelize = new Sequelize(process.env.DATABASE_URL,
|
|
4
|
+
{
|
|
5
|
+
dialect: 'postgres',
|
|
6
|
+
protocol: 'postgres',
|
|
7
|
+
dialectOptions:{
|
|
8
|
+
ssl: {
|
|
9
|
+
rejectUnauthorized: false
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
logging: false
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
|
|
17
17
|
exports.sequelize = sequelize;
|
package/models/userModel.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const Sequelize = require('sequelize');
|
|
2
|
-
const { sequelize } = require('./sequelize');
|
|
3
|
-
|
|
4
|
-
// Model for User data
|
|
5
|
-
exports.UserModel = sequelize.define('users', {
|
|
6
|
-
id: {
|
|
7
|
-
type: Sequelize.STRING,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
hostname: {
|
|
11
|
-
type: Sequelize.STRING,
|
|
12
|
-
},
|
|
13
|
-
timezoneName: {
|
|
14
|
-
type: Sequelize.STRING,
|
|
15
|
-
},
|
|
16
|
-
timezoneOffset: {
|
|
17
|
-
type: Sequelize.STRING,
|
|
18
|
-
},
|
|
19
|
-
platform: {
|
|
20
|
-
type: Sequelize.STRING,
|
|
21
|
-
},
|
|
22
|
-
// in apiKey auth, accessToken will be API key
|
|
23
|
-
accessToken: {
|
|
24
|
-
type: Sequelize.STRING(2000),
|
|
25
|
-
},
|
|
26
|
-
refreshToken: {
|
|
27
|
-
type: Sequelize.STRING(2000),
|
|
28
|
-
},
|
|
29
|
-
tokenExpiry: {
|
|
30
|
-
type: Sequelize.DATE
|
|
31
|
-
},
|
|
32
|
-
platformAdditionalInfo: {
|
|
33
|
-
type: Sequelize.JSON
|
|
34
|
-
},
|
|
35
|
-
userSettings: {
|
|
36
|
-
type: Sequelize.JSON
|
|
37
|
-
}
|
|
38
|
-
});
|
|
1
|
+
const Sequelize = require('sequelize');
|
|
2
|
+
const { sequelize } = require('./sequelize');
|
|
3
|
+
|
|
4
|
+
// Model for User data
|
|
5
|
+
exports.UserModel = sequelize.define('users', {
|
|
6
|
+
id: {
|
|
7
|
+
type: Sequelize.STRING,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
hostname: {
|
|
11
|
+
type: Sequelize.STRING,
|
|
12
|
+
},
|
|
13
|
+
timezoneName: {
|
|
14
|
+
type: Sequelize.STRING,
|
|
15
|
+
},
|
|
16
|
+
timezoneOffset: {
|
|
17
|
+
type: Sequelize.STRING,
|
|
18
|
+
},
|
|
19
|
+
platform: {
|
|
20
|
+
type: Sequelize.STRING,
|
|
21
|
+
},
|
|
22
|
+
// in apiKey auth, accessToken will be API key
|
|
23
|
+
accessToken: {
|
|
24
|
+
type: Sequelize.STRING(2000),
|
|
25
|
+
},
|
|
26
|
+
refreshToken: {
|
|
27
|
+
type: Sequelize.STRING(2000),
|
|
28
|
+
},
|
|
29
|
+
tokenExpiry: {
|
|
30
|
+
type: Sequelize.DATE
|
|
31
|
+
},
|
|
32
|
+
platformAdditionalInfo: {
|
|
33
|
+
type: Sequelize.JSON
|
|
34
|
+
},
|
|
35
|
+
userSettings: {
|
|
36
|
+
type: Sequelize.JSON
|
|
37
|
+
}
|
|
38
|
+
});
|
package/package.json
CHANGED
|
@@ -1,64 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@app-connect/core",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "RingCentral App Connect Core",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/ringcentral/rc-unified-crm-extension.git"
|
|
9
|
-
},
|
|
10
|
-
"keywords": [
|
|
11
|
-
"RingCentral",
|
|
12
|
-
"App Connect"
|
|
13
|
-
],
|
|
14
|
-
"author": "RingCentral Labs",
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"peerDependencies": {
|
|
17
|
-
"axios": "^1.1.2",
|
|
18
|
-
"express": "^4.
|
|
19
|
-
"pg": "^8.8.0",
|
|
20
|
-
"sequelize": "^6.
|
|
21
|
-
"moment": "^2.29.4",
|
|
22
|
-
"moment-timezone": "^0.5.39"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@aws-sdk/client-dynamodb": "^3.751.0",
|
|
26
|
-
"body-parser": "^1.20.
|
|
27
|
-
"client-oauth2": "^4.3.3",
|
|
28
|
-
"cors": "^2.8.5",
|
|
29
|
-
"country-state-city": "^3.2.1",
|
|
30
|
-
"dotenv": "^16.0.3",
|
|
31
|
-
"dynamoose": "^4.0.3",
|
|
32
|
-
"jsonwebtoken": "^
|
|
33
|
-
"mixpanel": "^0.18.0",
|
|
34
|
-
"shortid": "^2.2.
|
|
35
|
-
"tz-lookup": "^6.1.25",
|
|
36
|
-
"ua-parser-js": "^1.0.38"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"test": "jest",
|
|
40
|
-
"test:watch": "jest --watch",
|
|
41
|
-
"test:coverage": "jest --coverage",
|
|
42
|
-
"test:ci": "jest --ci --coverage --watchAll=false"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@eslint/js": "^9.22.0",
|
|
46
|
-
"@octokit/rest": "^19.0.5",
|
|
47
|
-
"axios": "^1.1.2",
|
|
48
|
-
"express": "^4.
|
|
49
|
-
"eslint": "^9.22.0",
|
|
50
|
-
"globals": "^16.0.0",
|
|
51
|
-
"jest": "^29.3.1",
|
|
52
|
-
"moment": "^2.29.4",
|
|
53
|
-
"moment-timezone": "^0.5.39",
|
|
54
|
-
"nock": "^13.2.9",
|
|
55
|
-
"pg": "^8.8.0",
|
|
56
|
-
"sequelize": "^6.
|
|
57
|
-
"sqlite3": "^5.1.2",
|
|
58
|
-
"supertest": "^6.3.1"
|
|
59
|
-
},
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
},
|
|
63
|
-
"
|
|
64
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@app-connect/core",
|
|
3
|
+
"version": "1.6.4",
|
|
4
|
+
"description": "RingCentral App Connect Core",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/ringcentral/rc-unified-crm-extension.git"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"RingCentral",
|
|
12
|
+
"App Connect"
|
|
13
|
+
],
|
|
14
|
+
"author": "RingCentral Labs",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"axios": "^1.1.2",
|
|
18
|
+
"express": "^4.21.2",
|
|
19
|
+
"pg": "^8.8.0",
|
|
20
|
+
"sequelize": "^6.29.0",
|
|
21
|
+
"moment": "^2.29.4",
|
|
22
|
+
"moment-timezone": "^0.5.39"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@aws-sdk/client-dynamodb": "^3.751.0",
|
|
26
|
+
"body-parser": "^1.20.3",
|
|
27
|
+
"client-oauth2": "^4.3.3",
|
|
28
|
+
"cors": "^2.8.5",
|
|
29
|
+
"country-state-city": "^3.2.1",
|
|
30
|
+
"dotenv": "^16.0.3",
|
|
31
|
+
"dynamoose": "^4.0.3",
|
|
32
|
+
"jsonwebtoken": "^9.0.0",
|
|
33
|
+
"mixpanel": "^0.18.0",
|
|
34
|
+
"shortid": "^2.2.17",
|
|
35
|
+
"tz-lookup": "^6.1.25",
|
|
36
|
+
"ua-parser-js": "^1.0.38"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"test": "jest",
|
|
40
|
+
"test:watch": "jest --watch",
|
|
41
|
+
"test:coverage": "jest --coverage",
|
|
42
|
+
"test:ci": "jest --ci --coverage --watchAll=false"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@eslint/js": "^9.22.0",
|
|
46
|
+
"@octokit/rest": "^19.0.5",
|
|
47
|
+
"axios": "^1.1.2",
|
|
48
|
+
"express": "^4.21.2",
|
|
49
|
+
"eslint": "^9.22.0",
|
|
50
|
+
"globals": "^16.0.0",
|
|
51
|
+
"jest": "^29.3.1",
|
|
52
|
+
"moment": "^2.29.4",
|
|
53
|
+
"moment-timezone": "^0.5.39",
|
|
54
|
+
"nock": "^13.2.9",
|
|
55
|
+
"pg": "^8.8.0",
|
|
56
|
+
"sequelize": "^6.29.0",
|
|
57
|
+
"sqlite3": "^5.1.2",
|
|
58
|
+
"supertest": "^6.3.1"
|
|
59
|
+
},
|
|
60
|
+
"overrides": {
|
|
61
|
+
"js-object-utilities": "2.2.1"
|
|
62
|
+
},
|
|
63
|
+
"bugs": {
|
|
64
|
+
"url": "https://github.com/ringcentral/rc-unified-crm-extension/issues"
|
|
65
|
+
},
|
|
66
|
+
"homepage": "https://github.com/ringcentral/rc-unified-crm-extension#readme"
|
|
67
|
+
}
|