@itleanchatbot/shared-models-js-postgres 2.4.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.
Files changed (16) hide show
  1. package/package.json +1 -1
  2. package/src/seeders/test/20210224171409-create-apiResource-framework.js +107 -0
  3. package/src/seeders/test/20210224171409-create-apiResource.js +24 -19
  4. package/src/seeders/test/{20210226115935-create-intention-values.js → 20210226115935-create-intention-values-framework.js} +1 -1
  5. package/src/seeders/test/{20210226121222-create-synonyms.js → 20210226121222-create-synonyms-framework.js} +1 -1
  6. package/src/seeders/test/{20210301174809-create-dialog-node.js → 20210301174809-create-dialog-node-framework.js} +4 -5
  7. package/src/seeders/test/{20210607124530-create-tranship.js → 20210607124530-create-tranship-framework.js} +4 -4
  8. package/src/seeders/test/{20210608103730-create-transhipConversation.js → 20210608103730-create-transhipConversation-framework.js} +5 -3
  9. package/src/seeders/test/{20210608140230-test-transfer.js → 20210608140230-test-transfer-framework.js} +4 -4
  10. /package/src/seeders/test/{20210224163857-create-ibmprovider.js → 20210224163857-create-ibmprovider-framework.js} +0 -0
  11. /package/src/seeders/test/{20210224165819-create-skill.js → 20210224165819-create-skill-framework.js} +0 -0
  12. /package/src/seeders/test/{20210224165821-seed-channel.js → 20210224165821-seed-channel-framework.js} +0 -0
  13. /package/src/seeders/test/{20210226115055-create-entity.js → 20210226115055-create-entity-framework.js} +0 -0
  14. /package/src/seeders/test/{20210226115540-create-entity-value.js → 20210226115540-create-entity-value-framework.js} +0 -0
  15. /package/src/seeders/test/{20210226115720-create-intention.js → 20210226115720-create-intention-framework.js} +0 -0
  16. /package/src/seeders/test/{20210813143730-tests-botIterables.js → 20210813143730-tests-botIterables-framework.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itleanchatbot/shared-models-js-postgres",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Shared Models JS Postgres",
5
5
  "main": "index.js",
6
6
  "license": "ISC",
@@ -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
+ }
@@ -1,24 +1,26 @@
1
1
  'use strict'
2
2
 
3
- module.exports = {
4
- up: async (queryInterface, Sequelize) => {
5
- const skillId = '148d1182-9f28-4b30-8fc3-70b650672f73'
3
+ const apiId = '7b62d509-9634-4c09-ab82-d753b12ebe9c'
4
+
5
+ const apiBodyId = '5c55f6c5-b4b2-4c0c-94b7-e241ed534f45'
6
6
 
7
- const apiId = '36a3e2b0-66d1-491e-aa5b-04bc45465a18'
7
+ const apiResourceId = '2ea2a347-bfdf-4209-b51f-7cacfa511299'
8
8
 
9
+ module.exports = {
10
+ up: async (queryInterface, Sequelize) => {
9
11
  await queryInterface.bulkInsert('Apis', [
10
12
  {
11
13
  id: apiId,
12
14
  baseUrl: JSON.stringify([
13
15
  {
14
- url: 'http://localhost:3000',
16
+ url: 'https://leanbot.api.dev.itlean.com.br',
15
17
  type: 'apiKey',
16
- environment: 'test',
17
18
  auth: {
18
19
  key: 'x-api-key',
19
20
  value: 'key',
20
21
  addTo: 'header',
21
22
  },
23
+ environment: 'test',
22
24
  },
23
25
  ]),
24
26
  type: 'json',
@@ -30,8 +32,6 @@ module.exports = {
30
32
  },
31
33
  ])
32
34
 
33
- const apiBodyId = 'e92ad0ec-3acf-4845-80af-d80753580e60'
34
-
35
35
  await queryInterface.bulkInsert('ApiResourcesBodies', [
36
36
  {
37
37
  id: apiBodyId,
@@ -46,7 +46,6 @@ module.exports = {
46
46
  },
47
47
  ])
48
48
 
49
- const apiResourceId = '7756e862-61bc-41ee-b8ce-0b8a646c7de0'
50
49
  const resourcePathParamToReplaceKey = '$lang'
51
50
 
52
51
  await queryInterface.bulkInsert('ApiResources', [
@@ -65,7 +64,7 @@ module.exports = {
65
64
 
66
65
  await queryInterface.bulkInsert('ApiResourcesHeaders', [
67
66
  {
68
- id: '2b06c987-0a53-48f1-bd2c-45130f4aa761',
67
+ id: '61b94d90-149c-4b82-b354-6b06c1e654c7',
69
68
  ApiResourceId: apiResourceId,
70
69
  value: 'en',
71
70
  type: 'Accept-Language',
@@ -76,7 +75,7 @@ module.exports = {
76
75
 
77
76
  await queryInterface.bulkInsert('ApiResourcesPathParams', [
78
77
  {
79
- id: '2b06c987-0a53-48f1-bd2c-45130f4aa761',
78
+ id: '715f4fd0-4920-4503-92ee-e27eb568bc1d',
80
79
  ApiResourceId: apiResourceId,
81
80
  key: resourcePathParamToReplaceKey,
82
81
  value: 'en',
@@ -87,7 +86,7 @@ module.exports = {
87
86
 
88
87
  await queryInterface.bulkInsert('ApiResourcesQueryStringParams', [
89
88
  {
90
- id: '2b06c987-0a53-48f1-bd2c-45130f4aa761',
89
+ id: '18de7724-a4d9-4f7b-88d3-06865f685659',
91
90
  ApiResourceId: apiResourceId,
92
91
  key: 'lang',
93
92
  type: 'string',
@@ -98,12 +97,18 @@ module.exports = {
98
97
  ])
99
98
  },
100
99
 
101
- down: async (queryInterface, Sequelize) => {
102
- await queryInterface.bulkDelete('ApiResourcesQueryStringParams', null, {})
103
- await queryInterface.bulkDelete('ApiResourcesPathParams', null, {})
104
- await queryInterface.bulkDelete('ApiResourcesHeaders', null, {})
105
- await queryInterface.bulkDelete('ApiResources', null, {})
106
- await queryInterface.bulkDelete('ApiResourcesBodies', null, {})
107
- await queryInterface.bulkDelete('Apis', null, {})
100
+ down: async (queryInterface) => {
101
+ await queryInterface.bulkDelete('ApiResourcesQueryStringParams', [
102
+ { ApiResourceId: apiResourceId },
103
+ ])
104
+ await queryInterface.bulkDelete('ApiResourcesPathParams', [
105
+ { ApiResourceId: apiResourceId },
106
+ ])
107
+ await queryInterface.bulkDelete('ApiResourcesHeaders', [
108
+ { ApiResourceId: apiResourceId },
109
+ ])
110
+ await queryInterface.bulkDelete('ApiResources', [{ id: apiResourceId }])
111
+ await queryInterface.bulkDelete('ApiResourcesBodies', [{ id: apiBodyId }])
112
+ await queryInterface.bulkDelete('Apis', [{ id: apiId }])
108
113
  },
109
114
  }
@@ -15,7 +15,7 @@ module.exports = {
15
15
  ])
16
16
  },
17
17
 
18
- down: async (queryInterface, Sequelize) => {
18
+ down: async (queryInterface) => {
19
19
  await queryInterface.bulkDelete('IntentionValues', null, {})
20
20
  },
21
21
  }
@@ -18,7 +18,7 @@ module.exports = {
18
18
  ])
19
19
  },
20
20
 
21
- down: async (queryInterface, Sequelize) => {
21
+ down: async (queryInterface) => {
22
22
  await queryInterface.bulkDelete('Synonyms', null, {})
23
23
  },
24
24
  }
@@ -1,11 +1,10 @@
1
1
  'use strict'
2
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'
3
6
  module.exports = {
4
7
  up: async (queryInterface, Sequelize) => {
5
- const skillId = '148d1182-9f28-4b30-8fc3-70b650672f73'
6
- const dialogNodeId = '9f023259-fd70-4724-9ab2-e11ce5555d77'
7
- const apiResourceId = '7756e862-61bc-41ee-b8ce-0b8a646c7de0'
8
-
9
8
  await queryInterface.bulkInsert('DialogNodes', [
10
9
  {
11
10
  id: dialogNodeId,
@@ -37,7 +36,7 @@ module.exports = {
37
36
  ])
38
37
  },
39
38
 
40
- down: async (queryInterface, Sequelize) => {
39
+ down: async (queryInterface) => {
41
40
  await queryInterface.bulkDelete('DialogNodes_ApiResources', null, {})
42
41
  await queryInterface.bulkDelete('DialogNodes', null, {})
43
42
  },
@@ -1,9 +1,9 @@
1
- const { v4: uuidv4 } = require('uuid')
1
+ 'use strict'
2
2
 
3
- ;('use strict')
3
+ const { v4: uuidv4 } = require('uuid')
4
4
 
5
5
  module.exports = {
6
- up: async (queryInterface, Sequelize) => {
6
+ up: async (queryInterface) => {
7
7
  const { ENTERPRISE_CNPJ } = process.env
8
8
 
9
9
  const EnterpriseId = await queryInterface.rawSelect(
@@ -323,7 +323,7 @@ module.exports = {
323
323
  ])
324
324
  },
325
325
 
326
- down: async (queryInterface, Sequelize) => {
326
+ down: async (queryInterface) => {
327
327
  const ChannelId = await queryInterface.rawSelect(
328
328
  'Channels',
329
329
  { where: { name: 'tranship.test.0001' } },
@@ -1,10 +1,12 @@
1
+
2
+ 'use strict'
3
+
1
4
  const { Op } = require('sequelize')
2
5
  const { v4: uuidv4 } = require('uuid')
3
6
 
4
- ;('use strict')
5
7
 
6
8
  module.exports = {
7
- up: async (queryInterface, Sequelize) => {
9
+ up: async (queryInterface) => {
8
10
  const { ENTERPRISE_CNPJ } = process.env
9
11
  const EnterpriseId = await queryInterface.rawSelect(
10
12
  'Enterprises',
@@ -281,7 +283,7 @@ module.exports = {
281
283
  ])
282
284
  },
283
285
 
284
- down: async (queryInterface, Sequelize) => {
286
+ down: async (queryInterface) => {
285
287
  const BranchId = await queryInterface.rawSelect(
286
288
  'Branches',
287
289
  { where: { internalId: '20210608103930FIL' } },
@@ -1,10 +1,10 @@
1
+ 'use strict'
2
+
1
3
  const { Op } = require('sequelize')
2
4
  const { v4: uuidv4 } = require('uuid')
3
5
 
4
- ;('use strict')
5
-
6
6
  module.exports = {
7
- up: async (queryInterface, Sequelize) => {
7
+ up: async (queryInterface) => {
8
8
  const { ENTERPRISE_CNPJ } = process.env
9
9
  const EnterpriseId = await queryInterface.rawSelect(
10
10
  'Enterprises',
@@ -299,7 +299,7 @@ module.exports = {
299
299
  ])
300
300
  },
301
301
 
302
- down: async (queryInterface, Sequelize) => {
302
+ down: async (queryInterface) => {
303
303
  const clientOneId = await queryInterface.rawSelect(
304
304
  'Clients',
305
305
  { where: { clientId: 'transfer.test.client.0001' } },