@itleanchatbot/shared-models-js-postgres 2.3.0 → 2.5.0
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/package.json +1 -1
- package/src/seeders/test/20210224163857-create-ibmprovider-framework.js +37 -0
- package/src/seeders/test/20210224165819-create-skill-framework.js +41 -0
- package/src/seeders/test/20210224165821-seed-channel-framework.js +62 -0
- package/src/seeders/test/20210224171409-create-apiResource-framework.js +107 -0
- package/src/seeders/test/20210226115055-create-entity-framework.js +21 -0
- package/src/seeders/test/20210226115540-create-entity-value-framework.js +21 -0
- package/src/seeders/test/20210226115720-create-intention-framework.js +22 -0
- package/src/seeders/test/20210226115935-create-intention-values-framework.js +21 -0
- package/src/seeders/test/20210226121222-create-synonyms-framework.js +24 -0
- package/src/seeders/test/20210301174809-create-dialog-node-framework.js +43 -0
- package/src/seeders/test/20210607124530-create-tranship-framework.js +428 -0
- package/src/seeders/test/20210608103730-create-transhipConversation-framework.js +368 -0
- package/src/seeders/test/20210608140230-test-transfer-framework.js +415 -0
- package/src/seeders/test/20210813143730-tests-botIterables-framework.js +400 -0
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
const ibmIntelligenceId = await queryInterface.rawSelect(
|
|
6
|
+
'Intelligences',
|
|
7
|
+
{
|
|
8
|
+
where: {
|
|
9
|
+
providerType: 'ibm',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
['id']
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
if (ibmIntelligenceId) {
|
|
16
|
+
await queryInterface.bulkInsert('IbmProviders', [
|
|
17
|
+
{
|
|
18
|
+
id: '473da11f-79c5-49a9-bce6-2f7d8ec76daf',
|
|
19
|
+
IntelligenceId: ibmIntelligenceId,
|
|
20
|
+
url:
|
|
21
|
+
'https://api.us-east.assistant.watson.cloud.ibm.com/instances/ba1e38a7-e378-4966-9b9a-8915956c8424',
|
|
22
|
+
token: 'qnAHwH_wZ0Mw7Fs1TMbWLKTEggSM21h0xeN6kmLANxcF',
|
|
23
|
+
active: true,
|
|
24
|
+
EnterpriseId: null,
|
|
25
|
+
apiVersion: 'v1',
|
|
26
|
+
version: '2018-09-20',
|
|
27
|
+
createdAt: Sequelize.literal('now()'),
|
|
28
|
+
updatedAt: Sequelize.literal('now()'),
|
|
29
|
+
},
|
|
30
|
+
])
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
down: async (queryInterface, Sequelize) => {
|
|
35
|
+
await queryInterface.bulkDelete('IbmProviders', null, {})
|
|
36
|
+
},
|
|
37
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
const ibmIntelligenceId = await queryInterface.rawSelect(
|
|
6
|
+
'Intelligences',
|
|
7
|
+
{
|
|
8
|
+
where: {
|
|
9
|
+
providerType: 'ibm',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
['id']
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
const ibmProviderId = '473da11f-79c5-49a9-bce6-2f7d8ec76daf'
|
|
16
|
+
|
|
17
|
+
if (ibmIntelligenceId) {
|
|
18
|
+
await queryInterface.bulkInsert('Skills', [
|
|
19
|
+
{
|
|
20
|
+
id: '148d1182-9f28-4b30-8fc3-70b650672f73',
|
|
21
|
+
IntelligenceId: ibmIntelligenceId,
|
|
22
|
+
AwsProviderId: null,
|
|
23
|
+
ItleanProviderId: null,
|
|
24
|
+
IbmProviderId: ibmProviderId,
|
|
25
|
+
name: 'Skill Seed',
|
|
26
|
+
description: 'skill created by seeders',
|
|
27
|
+
lang: 'pt-br',
|
|
28
|
+
externalIbmId: '1c6e2489-6675-4c08-aa89-fdac4bc50de3',
|
|
29
|
+
createdAt: Sequelize.literal('now()'),
|
|
30
|
+
updatedAt: Sequelize.literal('now()'),
|
|
31
|
+
},
|
|
32
|
+
])
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
down: async (queryInterface) => {
|
|
37
|
+
await queryInterface.bulkDelete('Skills', null, {
|
|
38
|
+
id: '148d1182-9f28-4b30-8fc3-70b650672f73',
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
const channelTypeIdWebChat = await queryInterface.rawSelect(
|
|
6
|
+
'ChannelTypes',
|
|
7
|
+
{
|
|
8
|
+
where: {
|
|
9
|
+
channelName: 'webchat',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
['id']
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
const channelTypeIdWhatsapp = await queryInterface.rawSelect(
|
|
16
|
+
'ChannelTypes',
|
|
17
|
+
{
|
|
18
|
+
where: {
|
|
19
|
+
channelName: 'whatsapp_interaxa',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
['id']
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const skillId = '148d1182-9f28-4b30-8fc3-70b650672f73'
|
|
26
|
+
|
|
27
|
+
await queryInterface.bulkInsert(
|
|
28
|
+
'Channels',
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
name: 'webchat',
|
|
32
|
+
SkillId: skillId,
|
|
33
|
+
ChannelTypeId: channelTypeIdWebChat,
|
|
34
|
+
configurations: JSON.stringify({
|
|
35
|
+
serverId: 'd348e005-c280-43fa-a949-657804425d92',
|
|
36
|
+
}),
|
|
37
|
+
createdAt: Sequelize.literal('now()'),
|
|
38
|
+
updatedAt: Sequelize.literal('now()'),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'whatsapp',
|
|
42
|
+
SkillId: skillId,
|
|
43
|
+
ChannelTypeId: channelTypeIdWhatsapp,
|
|
44
|
+
configurations: JSON.stringify({
|
|
45
|
+
serverId: 'd348e005-c280-43fa-a949-657804425d92',
|
|
46
|
+
urlApi: 'https://waap-api.h3rmes.com/api/v2',
|
|
47
|
+
apiUser: 'itlean',
|
|
48
|
+
apiPassword: '1tl3an',
|
|
49
|
+
}),
|
|
50
|
+
createdAt: Sequelize.literal('now()'),
|
|
51
|
+
updatedAt: Sequelize.literal('now()'),
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
{}
|
|
55
|
+
)
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
down: async (queryInterface) => {
|
|
59
|
+
await queryInterface.bulkDelete('Sessions', null, {})
|
|
60
|
+
await queryInterface.bulkDelete('Channels', null, {})
|
|
61
|
+
},
|
|
62
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
const apiId = '36a3e2b0-66d1-491e-aa5b-04bc45465a18'
|
|
6
|
+
|
|
7
|
+
await queryInterface.bulkInsert('Apis', [
|
|
8
|
+
{
|
|
9
|
+
id: apiId,
|
|
10
|
+
baseUrl: JSON.stringify([
|
|
11
|
+
{
|
|
12
|
+
url: 'http://localhost:3000',
|
|
13
|
+
type: 'apiKey',
|
|
14
|
+
environment: 'test',
|
|
15
|
+
auth: {
|
|
16
|
+
key: 'x-api-key',
|
|
17
|
+
value: 'key',
|
|
18
|
+
addTo: 'header',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
]),
|
|
22
|
+
type: 'json',
|
|
23
|
+
name: 'Api Seeder',
|
|
24
|
+
description: 'Api Seeder',
|
|
25
|
+
EnterpriseId: null,
|
|
26
|
+
createdAt: Sequelize.literal('now()'),
|
|
27
|
+
updatedAt: Sequelize.literal('now()'),
|
|
28
|
+
},
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
const apiBodyId = 'e92ad0ec-3acf-4845-80af-d80753580e60'
|
|
32
|
+
|
|
33
|
+
await queryInterface.bulkInsert('ApiResourcesBodies', [
|
|
34
|
+
{
|
|
35
|
+
id: apiBodyId,
|
|
36
|
+
content: JSON.stringify({
|
|
37
|
+
getContext: '$email',
|
|
38
|
+
notInContext: '$notInContext',
|
|
39
|
+
noReplace: 'noReplace',
|
|
40
|
+
}),
|
|
41
|
+
type: 'json',
|
|
42
|
+
createdAt: Sequelize.literal('now()'),
|
|
43
|
+
updatedAt: Sequelize.literal('now()'),
|
|
44
|
+
},
|
|
45
|
+
])
|
|
46
|
+
|
|
47
|
+
const apiResourceId = '7756e862-61bc-41ee-b8ce-0b8a646c7de0'
|
|
48
|
+
const resourcePathParamToReplaceKey = '$lang'
|
|
49
|
+
|
|
50
|
+
await queryInterface.bulkInsert('ApiResources', [
|
|
51
|
+
{
|
|
52
|
+
id: apiResourceId,
|
|
53
|
+
uri: `/api/framework/${resourcePathParamToReplaceKey}`,
|
|
54
|
+
method: 'POST',
|
|
55
|
+
name: 'Api Resource Seeder',
|
|
56
|
+
description: 'Api Resource Seeder',
|
|
57
|
+
ApiId: apiId,
|
|
58
|
+
ApiResourcesBodyId: apiBodyId,
|
|
59
|
+
createdAt: Sequelize.literal('now()'),
|
|
60
|
+
updatedAt: Sequelize.literal('now()'),
|
|
61
|
+
},
|
|
62
|
+
])
|
|
63
|
+
|
|
64
|
+
await queryInterface.bulkInsert('ApiResourcesHeaders', [
|
|
65
|
+
{
|
|
66
|
+
id: '2b06c987-0a53-48f1-bd2c-45130f4aa761',
|
|
67
|
+
ApiResourceId: apiResourceId,
|
|
68
|
+
value: 'en',
|
|
69
|
+
type: 'Accept-Language',
|
|
70
|
+
createdAt: Sequelize.literal('now()'),
|
|
71
|
+
updatedAt: Sequelize.literal('now()'),
|
|
72
|
+
},
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
await queryInterface.bulkInsert('ApiResourcesPathParams', [
|
|
76
|
+
{
|
|
77
|
+
id: 'b0f3e545-2587-4b1b-a6d5-88562413f1b7',
|
|
78
|
+
ApiResourceId: apiResourceId,
|
|
79
|
+
key: resourcePathParamToReplaceKey,
|
|
80
|
+
value: 'en',
|
|
81
|
+
createdAt: Sequelize.literal('now()'),
|
|
82
|
+
updatedAt: Sequelize.literal('now()'),
|
|
83
|
+
},
|
|
84
|
+
])
|
|
85
|
+
|
|
86
|
+
await queryInterface.bulkInsert('ApiResourcesQueryStringParams', [
|
|
87
|
+
{
|
|
88
|
+
id: '1bf235e3-d3e8-49e2-b944-8402cc15ad0f',
|
|
89
|
+
ApiResourceId: apiResourceId,
|
|
90
|
+
key: 'lang',
|
|
91
|
+
type: 'string',
|
|
92
|
+
value: 'en',
|
|
93
|
+
createdAt: Sequelize.literal('now()'),
|
|
94
|
+
updatedAt: Sequelize.literal('now()'),
|
|
95
|
+
},
|
|
96
|
+
])
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
down: async (queryInterface) => {
|
|
100
|
+
await queryInterface.bulkDelete('ApiResourcesQueryStringParams', null, {})
|
|
101
|
+
await queryInterface.bulkDelete('ApiResourcesPathParams', null, {})
|
|
102
|
+
await queryInterface.bulkDelete('ApiResourcesHeaders', null, {})
|
|
103
|
+
await queryInterface.bulkDelete('ApiResources', null, {})
|
|
104
|
+
await queryInterface.bulkDelete('ApiResourcesBodies', null, {})
|
|
105
|
+
await queryInterface.bulkDelete('Apis', null, {})
|
|
106
|
+
},
|
|
107
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
const skillId = '148d1182-9f28-4b30-8fc3-70b650672f73'
|
|
6
|
+
|
|
7
|
+
await queryInterface.bulkInsert('Entities', [
|
|
8
|
+
{
|
|
9
|
+
id: 'a7c39ff2-de36-45fe-851c-19bf3b068b37',
|
|
10
|
+
SkillId: skillId,
|
|
11
|
+
name: 'Seed Entity',
|
|
12
|
+
createdAt: Sequelize.literal('now()'),
|
|
13
|
+
updatedAt: Sequelize.literal('now()'),
|
|
14
|
+
},
|
|
15
|
+
])
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
down: async (queryInterface, Sequelize) => {
|
|
19
|
+
await queryInterface.bulkDelete('Entities', null, {})
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
const entityId = 'a7c39ff2-de36-45fe-851c-19bf3b068b37'
|
|
6
|
+
|
|
7
|
+
await queryInterface.bulkInsert('EntityValues', [
|
|
8
|
+
{
|
|
9
|
+
id: '34e44961-4994-405e-a121-834ed5848eac',
|
|
10
|
+
EntityId: entityId,
|
|
11
|
+
name: 'Seed Entity Value',
|
|
12
|
+
createdAt: Sequelize.literal('now()'),
|
|
13
|
+
updatedAt: Sequelize.literal('now()'),
|
|
14
|
+
},
|
|
15
|
+
])
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
down: async (queryInterface, Sequelize) => {
|
|
19
|
+
await queryInterface.bulkDelete('EntityValues', null, {})
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
const skillId = '148d1182-9f28-4b30-8fc3-70b650672f73'
|
|
6
|
+
|
|
7
|
+
await queryInterface.bulkInsert('Intentions', [
|
|
8
|
+
{
|
|
9
|
+
id: '4b206b12-d4e2-4b65-80d7-a0e8233588a0',
|
|
10
|
+
SkillId: skillId,
|
|
11
|
+
name: 'Seed Intention',
|
|
12
|
+
description: 'Created by seeders',
|
|
13
|
+
createdAt: Sequelize.literal('now()'),
|
|
14
|
+
updatedAt: Sequelize.literal('now()'),
|
|
15
|
+
},
|
|
16
|
+
])
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
down: async (queryInterface, Sequelize) => {
|
|
20
|
+
await queryInterface.bulkDelete('Intentions', null, {})
|
|
21
|
+
},
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
const intentionId = '4b206b12-d4e2-4b65-80d7-a0e8233588a0'
|
|
6
|
+
|
|
7
|
+
await queryInterface.bulkInsert('IntentionValues', [
|
|
8
|
+
{
|
|
9
|
+
id: 'a2dd17df-0480-4616-88ac-41ead918a458',
|
|
10
|
+
IntentionId: intentionId,
|
|
11
|
+
name: 'Seed Intention Value',
|
|
12
|
+
createdAt: Sequelize.literal('now()'),
|
|
13
|
+
updatedAt: Sequelize.literal('now()'),
|
|
14
|
+
},
|
|
15
|
+
])
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
down: async (queryInterface) => {
|
|
19
|
+
await queryInterface.bulkDelete('IntentionValues', null, {})
|
|
20
|
+
},
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
|
5
|
+
const entityValueId = '34e44961-4994-405e-a121-834ed5848eac'
|
|
6
|
+
const entityId = 'a7c39ff2-de36-45fe-851c-19bf3b068b37'
|
|
7
|
+
|
|
8
|
+
await queryInterface.bulkInsert('Synonyms', [
|
|
9
|
+
{
|
|
10
|
+
id: 'a2dd17df-0480-4616-88ac-41ead918a458',
|
|
11
|
+
EntityValueId: entityValueId,
|
|
12
|
+
EntityId: entityId,
|
|
13
|
+
name: 'Seed Synonym',
|
|
14
|
+
type: 'synonyms',
|
|
15
|
+
createdAt: Sequelize.literal('now()'),
|
|
16
|
+
updatedAt: Sequelize.literal('now()'),
|
|
17
|
+
},
|
|
18
|
+
])
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
down: async (queryInterface) => {
|
|
22
|
+
await queryInterface.bulkDelete('Synonyms', null, {})
|
|
23
|
+
},
|
|
24
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const skillId = '148d1182-9f28-4b30-8fc3-70b650672f73'
|
|
4
|
+
const dialogNodeId = '9f023259-fd70-4724-9ab2-e11ce5555d77'
|
|
5
|
+
const apiResourceId = '7756e862-61bc-41ee-b8ce-0b8a646c7de0'
|
|
6
|
+
module.exports = {
|
|
7
|
+
up: async (queryInterface, Sequelize) => {
|
|
8
|
+
await queryInterface.bulkInsert('DialogNodes', [
|
|
9
|
+
{
|
|
10
|
+
id: dialogNodeId,
|
|
11
|
+
contexts: '[]',
|
|
12
|
+
name: 'Seeder Dialog Node',
|
|
13
|
+
condition: 'test || test',
|
|
14
|
+
step: '1',
|
|
15
|
+
replayWait: true,
|
|
16
|
+
type: 'node',
|
|
17
|
+
isMultipleResponse: false,
|
|
18
|
+
SkillId: skillId,
|
|
19
|
+
JumpToDialogNodeId: null,
|
|
20
|
+
JumpToSkillId: null,
|
|
21
|
+
DialogNodeFolderId: null,
|
|
22
|
+
createdAt: Sequelize.literal('now()'),
|
|
23
|
+
updatedAt: Sequelize.literal('now()'),
|
|
24
|
+
},
|
|
25
|
+
])
|
|
26
|
+
|
|
27
|
+
await queryInterface.bulkInsert('DialogNodes_ApiResources', [
|
|
28
|
+
{
|
|
29
|
+
id: '395b05f4-e91f-445a-8be1-2ab199ea4824',
|
|
30
|
+
DialogNodeId: dialogNodeId,
|
|
31
|
+
ApiResourceId: apiResourceId,
|
|
32
|
+
response: 'apiTest',
|
|
33
|
+
createdAt: Sequelize.literal('now()'),
|
|
34
|
+
updatedAt: Sequelize.literal('now()'),
|
|
35
|
+
},
|
|
36
|
+
])
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
down: async (queryInterface) => {
|
|
40
|
+
await queryInterface.bulkDelete('DialogNodes_ApiResources', null, {})
|
|
41
|
+
await queryInterface.bulkDelete('DialogNodes', null, {})
|
|
42
|
+
},
|
|
43
|
+
}
|