@itleanchatbot/shared-models-js-postgres 2.1.0 → 2.1.1
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/20200924195050-create-ibmprovider.js +38 -0
- package/src/seeders/test/20200924195050-create-itlean-provider.js +40 -0
- package/src/seeders/test/20200924195050-seed-enterprises.js +24 -0
- package/src/seeders/test/20200925184253-seed-skils-itlean-provider.js +37 -0
- package/src/seeders/test/20200925184253-seed-skils.js +41 -0
- package/src/seeders/test/20200925184254-seed-Intention.js +39 -0
- package/src/seeders/test/20200925184258-seed-Intention-values.js +41 -0
- package/src/seeders/test/20200925191642-seed-entity-skill-itlean.js +23 -0
- package/src/seeders/test/20200925191642-seed-entity.js +23 -0
- package/src/seeders/test/20200925191643-seed-entity-values-skill-itlean.js +32 -0
- package/src/seeders/test/20200925191643-seed-entity-values.js +33 -0
- package/src/seeders/test/20200929132705-seed-dialog-node.js +128 -0
- package/src/seeders/test/20201016200600-seed-responses.js +563 -0
- package/src/seeders/test/20201104183653-seed-create-ype-skill.js +42 -0
- package/src/seeders/test/20201104183700-seed-create-ype-intention.js +26 -0
- package/src/seeders/test/20201104183706-seed-create-ype-intention-values.js +70 -0
- package/src/seeders/test/20201104183714-seed-create-ype-entity.js +38 -0
- package/src/seeders/test/20201104183723-seed-create-ype-entity-values.js +243 -0
- package/src/seeders/test/20201104183727-seed-create-ype-synonyms.js +253 -0
- package/src/seeders/test/20201104202534-seed-create-ype-node-saudacao.js +124 -0
- package/src/seeders/test/20210224171409-create-apiResource.js +114 -0
- package/src/seeders/test/20210422144458-seed-context-test.js +175 -0
- package/src/seeders/test/20210422181114-seed-jump-node.js +123 -0
- package/src/seeders/test/20210422182413-seed-jump-skill.js +123 -0
- package/src/seeders/test/20210426100156-seed-api-test.js +138 -0
- package/src/seeders/test/20210426103704-seed-multiple-response-test.js +272 -0
- package/src/seeders/test/20210426190844-seed-entity-search-test.js +160 -0
- package/src/seeders/test/20210427172150-seed-test-with-input-test-fisrt.js +160 -0
- package/src/seeders/test/20210428105402-seed-test-condition-1.js +190 -0
- package/src/seeders/test/20210430181906-seed-test-input-text-zero.js +120 -0
- package/src/seeders/test/20210430183204-seed-ype-test-condition.js +557 -0
- package/src/seeders/test/20210503172321-seed-invalid-condition.js +119 -0
- package/src/seeders/test/20210505140225-insert-skills.js +41 -0
- package/src/seeders/test/20210505183810-seed-chain-with-context.js +147 -0
- package/src/seeders/test/20210506125701-seed-with-intention-and-entity-same-name.js +188 -0
- package/src/seeders/test/20210507204437-seed-condition-igual-true.js +119 -0
- package/src/seeders/test/20210511181006-seed-using-internal-functions.js +274 -0
- package/src/seeders/test/20210512140152-seed-ype-real-bot.js +2578 -0
- package/src/seeders/test/20210519162746-seed-response-with-context.js +186 -0
- package/src/seeders/test/20210524141819-seed-dialog-node-faq.js +244 -0
- package/src/seeders/test/20210525180523-seed-regex.js +173 -0
- package/src/seeders/test/20210602111930-insert-dialogNodes.js +200 -0
- package/src/seeders/test/20210610152534-seed-test-internal-function-in-context.js +216 -0
- package/src/seeders/test/20210610181308-seed-test-find-in-array-internal-function.js +147 -0
- package/src/seeders/test/20210611101042-bot-example-internal-functions.js +985 -0
- package/src/seeders/test/20210613111900-bot-example-api.js +420 -0
- package/src/seeders/test/20210614113654-miltiple-response-with-research.js +387 -0
- package/src/seeders/test/20210616212102-api-authentication-and-list.js +422 -0
- package/src/seeders/test/20210624172310-seed-api-duble-request.js +424 -0
- package/src/seeders/test/20210628135630-test-branches.js +224 -0
- package/src/seeders/test/20210629141030-test-departments.js +225 -0
- package/src/seeders/test/20210630105430-test-subDepartments.js +223 -0
- package/src/seeders/test/20210630114011-test-contact.js +178 -0
- package/src/seeders/test/20210701130630-test-channels.js +381 -0
- package/src/seeders/test/20210702191230-seed-test-counter-in-context.js +122 -0
- package/src/seeders/test/20210705061313-test-fields.js +152 -0
- package/src/seeders/test/20210705080813-test-groups.js +122 -0
- package/src/seeders/test/20210705105918-seed-test-function-slice.js +161 -0
- package/src/seeders/test/20210706105508-seed-node-without-condition.js +254 -0
- package/src/seeders/test/20210706112906-seed-1.0-on-response.js +172 -0
- package/src/seeders/test/20210706145547-seed-clean-context.js +132 -0
- package/src/seeders/test/20210707151538-seed-test-response-break-line.js +161 -0
- package/src/seeders/test/20210713155530-seed-test-itl0079-875.js +129 -0
- package/src/seeders/test/20210715125619-seed-multiple-response-with-several-jumps.js +764 -0
- package/src/seeders/test/20210715163606-seed-test-multiple-response-with-jump.js +250 -0
- package/src/seeders/test/20210719154025-seed-2-contexts-together.js +133 -0
- package/src/seeders/test/20210802144227-seed-end-session-trigger.js +163 -0
- package/src/seeders/test/20210803103030-tests-dialogNodes.js +406 -0
- package/src/seeders/test/20210804094630-tests-lines.js +487 -0
- package/src/seeders/test/20210805104130-tests-lineConfigurations.js +106 -0
- package/src/seeders/test/20210805133330-tests-systemUsers.js +507 -0
- package/src/seeders/test/20210813124630-tests-getMessagesBySession.js +333 -0
- package/src/seeders/test/20210816151830-testes-inactivityTriggers.js +196 -0
- package/src/seeders/test/20210830134230-tests-sessionReports.js +254 -0
- package/src/seeders/test/20210830165830-tests-attendancesHistory.js +181 -0
- package/src/seeders/test/20210927115821-skill-test-open-faq.js +37 -0
- package/src/seeders/test/20211004131813-true-and-context-with-parent.js +190 -0
- package/src/seeders/test/20211006210203-context-concat-with-text.js +193 -0
|
@@ -0,0 +1,985 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const SkillId = '49187e93-1a43-4f8f-b169-4b8db8a1b3e0'
|
|
4
|
+
const ChannelId = '3987fe7e-5e03-451a-994d-5877acab0c9c'
|
|
5
|
+
const serverId = 'd9d9ff19-7d85-4d19-af12-720e84eedcc6'
|
|
6
|
+
|
|
7
|
+
const dialogNodeWelcomeId = '36771490-2c8c-434d-a52c-d22db6f359e1'
|
|
8
|
+
const dialogNodeAnythingElseId = 'adec7985-d9a4-4c89-8fec-ad5a078048fd'
|
|
9
|
+
const dialogNodeFolderSimpleExamplesId = 'd81fa6d1-cf92-4dfe-8be4-b7e679735e03'
|
|
10
|
+
const dialogNodeFolderContextExamplesId = 'b360f7ad-8768-4f17-80f4-c3092750b399'
|
|
11
|
+
|
|
12
|
+
const dialogNodeFunctionSizeId = 'a482fb05-c4bb-42a6-8106-611c2d7696e6'
|
|
13
|
+
const dialogNodeFunctionFindInArray = '5fc9ad82-5fc9-4535-bb1b-621e0e2da079'
|
|
14
|
+
const dialogNodeFunctionCurrency = '0d069bfd-ad48-4725-b0f6-742503539764'
|
|
15
|
+
const dialogNodeFunctionDate = '4b3caa58-a7de-46f1-880f-e7d25f98db33'
|
|
16
|
+
const dialogNodeFunctionNow = 'ba8b5dc3-2c8c-4cd1-961a-09dec48cb153'
|
|
17
|
+
const dialogNodeFunctionFindInArrayCity = 'a7c42e5d-fff8-4b02-8d67-ee15c225616e'
|
|
18
|
+
const dialogNodeFunctionExtractStringAndNumber =
|
|
19
|
+
'40b188b7-7637-492d-b204-def8e356e183'
|
|
20
|
+
const dialogNodeFunctionSizeContext = '0bf9edfa-c575-4981-9e66-c666a6aa4ea2'
|
|
21
|
+
const dialogNodeFunctionRandomFloor0Id = '0e4945fe-695a-496d-ac4b-aef925bc7551'
|
|
22
|
+
const dialogNodeFunctionRandomFloor1Id = '528d9445-bd0f-465b-bda7-c98b2ebf95c8'
|
|
23
|
+
const dialogNodeFunctionTemplateToArrayId =
|
|
24
|
+
'19f7d874-7643-43f0-83c8-1574b75a80ac'
|
|
25
|
+
const dialogNodeFunctionTemplateToArrayJoinId =
|
|
26
|
+
'5f723a2a-75e5-4b01-b1cc-42a1f7567123'
|
|
27
|
+
|
|
28
|
+
const responseWelcomeId = '5364f096-dba9-4081-addb-e7340f72b030'
|
|
29
|
+
const responseAnythingElseId = 'ff4b6439-5f5b-4c98-a185-72bc4d6f31f0'
|
|
30
|
+
const responseFunctionSizeId = '84c91497-cb65-4a62-9e14-76b225aeeea0'
|
|
31
|
+
const responseFunctionFindInArray = '5a5f062c-f337-4dbc-a958-8d975b5272d6'
|
|
32
|
+
const responseFunctionCurrency = '2bad0898-de30-4412-b233-7cf1e29e590a'
|
|
33
|
+
const responseFunctionDate = '0debd8be-0f5b-49e9-8bad-d694764d203f'
|
|
34
|
+
const responseFunctionNow = '455dd09b-629b-470b-88a9-a4b8e9036160'
|
|
35
|
+
const responseFunctionFindInArrayCity = '04715a43-9fd6-4db1-a438-21270b7a2381'
|
|
36
|
+
const responseFunctionExtractStringAndNumber =
|
|
37
|
+
'fa6d4034-8fe1-4055-9165-a3956c4058c8'
|
|
38
|
+
const responseFunctionSizeContext = 'f5e9b05a-eada-4e7a-9a99-a88062c267e5'
|
|
39
|
+
const responseFunctionRandomFloorId = 'f9811678-736a-44b9-847e-6123e4958f4f'
|
|
40
|
+
const responseFunctionTemplateToArrayId = '39a23076-eee8-4ead-bb1a-86a117f5d19f'
|
|
41
|
+
const responseFunctionTemplateToArrayJoinId =
|
|
42
|
+
'8c093bbd-e9e1-4b3b-9fed-0237e6dc6010'
|
|
43
|
+
|
|
44
|
+
const responses = [
|
|
45
|
+
responseWelcomeId,
|
|
46
|
+
responseAnythingElseId,
|
|
47
|
+
responseFunctionSizeId,
|
|
48
|
+
responseFunctionFindInArray,
|
|
49
|
+
responseFunctionCurrency,
|
|
50
|
+
responseFunctionDate,
|
|
51
|
+
responseFunctionNow,
|
|
52
|
+
responseFunctionFindInArrayCity,
|
|
53
|
+
responseFunctionExtractStringAndNumber,
|
|
54
|
+
responseFunctionSizeContext,
|
|
55
|
+
responseFunctionRandomFloorId,
|
|
56
|
+
responseFunctionTemplateToArrayId,
|
|
57
|
+
responseFunctionTemplateToArrayJoinId,
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
const Response_DialogNodes = [
|
|
61
|
+
{
|
|
62
|
+
DialogNodeId: dialogNodeWelcomeId,
|
|
63
|
+
ResponseId: responseWelcomeId,
|
|
64
|
+
createdAt: new Date(),
|
|
65
|
+
updatedAt: new Date(),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
DialogNodeId: dialogNodeAnythingElseId,
|
|
69
|
+
ResponseId: responseAnythingElseId,
|
|
70
|
+
createdAt: new Date(),
|
|
71
|
+
updatedAt: new Date(),
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
DialogNodeId: dialogNodeFunctionSizeId,
|
|
75
|
+
ResponseId: responseFunctionSizeId,
|
|
76
|
+
createdAt: new Date(),
|
|
77
|
+
updatedAt: new Date(),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
DialogNodeId: dialogNodeFunctionFindInArray,
|
|
81
|
+
ResponseId: responseFunctionFindInArray,
|
|
82
|
+
createdAt: new Date(),
|
|
83
|
+
updatedAt: new Date(),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
DialogNodeId: dialogNodeFunctionCurrency,
|
|
87
|
+
ResponseId: responseFunctionCurrency,
|
|
88
|
+
createdAt: new Date(),
|
|
89
|
+
updatedAt: new Date(),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
DialogNodeId: dialogNodeFunctionDate,
|
|
93
|
+
ResponseId: responseFunctionDate,
|
|
94
|
+
createdAt: new Date(),
|
|
95
|
+
updatedAt: new Date(),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
DialogNodeId: dialogNodeFunctionNow,
|
|
99
|
+
ResponseId: responseFunctionNow,
|
|
100
|
+
createdAt: new Date(),
|
|
101
|
+
updatedAt: new Date(),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
DialogNodeId: dialogNodeFunctionFindInArrayCity,
|
|
105
|
+
ResponseId: responseFunctionFindInArrayCity,
|
|
106
|
+
createdAt: new Date(),
|
|
107
|
+
updatedAt: new Date(),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
DialogNodeId: dialogNodeFunctionExtractStringAndNumber,
|
|
111
|
+
ResponseId: responseFunctionExtractStringAndNumber,
|
|
112
|
+
createdAt: new Date(),
|
|
113
|
+
updatedAt: new Date(),
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
DialogNodeId: dialogNodeFunctionSizeContext,
|
|
117
|
+
ResponseId: responseFunctionSizeContext,
|
|
118
|
+
createdAt: new Date(),
|
|
119
|
+
updatedAt: new Date(),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
DialogNodeId: dialogNodeFunctionRandomFloor0Id,
|
|
123
|
+
ResponseId: responseFunctionRandomFloorId,
|
|
124
|
+
createdAt: new Date(),
|
|
125
|
+
updatedAt: new Date(),
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
DialogNodeId: dialogNodeFunctionRandomFloor1Id,
|
|
129
|
+
ResponseId: responseFunctionRandomFloorId,
|
|
130
|
+
createdAt: new Date(),
|
|
131
|
+
updatedAt: new Date(),
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
DialogNodeId: dialogNodeFunctionTemplateToArrayId,
|
|
135
|
+
ResponseId: responseFunctionTemplateToArrayId,
|
|
136
|
+
createdAt: new Date(),
|
|
137
|
+
updatedAt: new Date(),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
DialogNodeId: dialogNodeFunctionTemplateToArrayJoinId,
|
|
141
|
+
ResponseId: responseFunctionTemplateToArrayJoinId,
|
|
142
|
+
createdAt: new Date(),
|
|
143
|
+
updatedAt: new Date(),
|
|
144
|
+
},
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
module.exports = {
|
|
148
|
+
up: async (queryInterface, Sequelize) => {
|
|
149
|
+
const EnterpriseId = await queryInterface.rawSelect(
|
|
150
|
+
'Enterprises',
|
|
151
|
+
{ where: { cnpj: process.env.ENTERPRISE_CNPJ } },
|
|
152
|
+
['id']
|
|
153
|
+
)
|
|
154
|
+
const intelligenceId = await queryInterface.rawSelect(
|
|
155
|
+
'Intelligences',
|
|
156
|
+
{
|
|
157
|
+
where: {
|
|
158
|
+
providerType: 'itlean',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
['id']
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
const ItleanProviderId = await queryInterface.rawSelect(
|
|
165
|
+
'ItleanProviders',
|
|
166
|
+
{
|
|
167
|
+
where: {
|
|
168
|
+
EnterpriseId,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
['id']
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
const ChannelTypeId = await queryInterface.rawSelect(
|
|
175
|
+
'ChannelTypes',
|
|
176
|
+
{ where: { channelName: 'webchat' } },
|
|
177
|
+
['id']
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
await queryInterface.bulkInsert(
|
|
181
|
+
'Skills',
|
|
182
|
+
[
|
|
183
|
+
{
|
|
184
|
+
id: SkillId,
|
|
185
|
+
IntelligenceId: intelligenceId,
|
|
186
|
+
AwsProviderId: null,
|
|
187
|
+
ItleanProviderId,
|
|
188
|
+
IbmProviderId: null,
|
|
189
|
+
name: 'example_internal_functions',
|
|
190
|
+
description: 'Bot criado de examplo de uso das funcções internas',
|
|
191
|
+
lang: 'pt-br',
|
|
192
|
+
createdAt: new Date(),
|
|
193
|
+
updatedAt: new Date(),
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
{}
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
await queryInterface.bulkInsert('Channels', [
|
|
200
|
+
{
|
|
201
|
+
id: ChannelId,
|
|
202
|
+
ChannelTypeId,
|
|
203
|
+
FileId: null,
|
|
204
|
+
SkillId,
|
|
205
|
+
name: 'example_internal_functions',
|
|
206
|
+
configurations: JSON.stringify({
|
|
207
|
+
backgroundColor: '#0dff00',
|
|
208
|
+
componentsColor: '#000000',
|
|
209
|
+
displayName: 'functions',
|
|
210
|
+
domainName: 'example/functions',
|
|
211
|
+
fontColor: '#787e00',
|
|
212
|
+
sendAttachments: true,
|
|
213
|
+
serverId,
|
|
214
|
+
}),
|
|
215
|
+
createdAt: new Date(),
|
|
216
|
+
updatedAt: new Date(),
|
|
217
|
+
},
|
|
218
|
+
])
|
|
219
|
+
|
|
220
|
+
await queryInterface.bulkInsert(
|
|
221
|
+
'DialogNodes',
|
|
222
|
+
[
|
|
223
|
+
{
|
|
224
|
+
id: dialogNodeWelcomeId,
|
|
225
|
+
name: 'welcome',
|
|
226
|
+
condition:
|
|
227
|
+
'input.text === oi || input.text === oie || input.text === ola',
|
|
228
|
+
SkillId,
|
|
229
|
+
contexts: JSON.stringify([
|
|
230
|
+
{
|
|
231
|
+
label: 'array',
|
|
232
|
+
value: [1, 2, 3, 4, 5, 6],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: 'arrayCities',
|
|
236
|
+
value: [
|
|
237
|
+
{
|
|
238
|
+
city: {
|
|
239
|
+
name: 'Tokyo',
|
|
240
|
+
population: 927300,
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
city: {
|
|
245
|
+
name: 'Beijing',
|
|
246
|
+
population: 20693000,
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
city: {
|
|
251
|
+
name: 'Fake',
|
|
252
|
+
population: 800000,
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
label: 'size',
|
|
259
|
+
value: 'chatbot',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
label: 'randomFloor',
|
|
263
|
+
value: 'randomFloor(100)%2',
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
label: 'template',
|
|
267
|
+
value:
|
|
268
|
+
'\n %position%- Data de vencimento: %dueDate% \nValor: %value% \n',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
label: 'fakeApiResult',
|
|
272
|
+
value: {
|
|
273
|
+
data: [
|
|
274
|
+
{ position: 1, dueDate: '20/05/2021', value: 'R$ 100.00' },
|
|
275
|
+
{ position: 2, dueDate: '20/05/2021', value: 'R$ 100.00' },
|
|
276
|
+
{ position: 3, dueDate: '20/05/2021', value: 'R$ 100.00' },
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
]),
|
|
281
|
+
step: 1,
|
|
282
|
+
replayWait: true,
|
|
283
|
+
type: 'node',
|
|
284
|
+
isMultipleResponse: false,
|
|
285
|
+
JumpToDialogNodeId: null,
|
|
286
|
+
JumpToSkillId: null,
|
|
287
|
+
DialogNodeFolderId: null,
|
|
288
|
+
createdAt: new Date(),
|
|
289
|
+
updatedAt: new Date(),
|
|
290
|
+
},
|
|
291
|
+
// Simple examples
|
|
292
|
+
{
|
|
293
|
+
id: dialogNodeFolderSimpleExamplesId,
|
|
294
|
+
name: 'simple_examples',
|
|
295
|
+
condition: '',
|
|
296
|
+
SkillId,
|
|
297
|
+
contexts: '{}',
|
|
298
|
+
step: 2,
|
|
299
|
+
replayWait: true,
|
|
300
|
+
type: 'folder',
|
|
301
|
+
isMultipleResponse: false,
|
|
302
|
+
JumpToDialogNodeId: null,
|
|
303
|
+
JumpToSkillId: null,
|
|
304
|
+
DialogNodeFolderId: null,
|
|
305
|
+
createdAt: new Date(),
|
|
306
|
+
updatedAt: new Date(),
|
|
307
|
+
},
|
|
308
|
+
|
|
309
|
+
{
|
|
310
|
+
id: dialogNodeFunctionSizeId,
|
|
311
|
+
name: 'size_length',
|
|
312
|
+
condition: `input.text === size && size(abc) === 'abc'.length`,
|
|
313
|
+
SkillId,
|
|
314
|
+
contexts: '{}',
|
|
315
|
+
step: 1,
|
|
316
|
+
replayWait: true,
|
|
317
|
+
type: 'node',
|
|
318
|
+
isMultipleResponse: false,
|
|
319
|
+
JumpToDialogNodeId: null,
|
|
320
|
+
JumpToSkillId: null,
|
|
321
|
+
DialogNodeFolderId: dialogNodeFolderSimpleExamplesId,
|
|
322
|
+
createdAt: new Date(),
|
|
323
|
+
updatedAt: new Date(),
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: dialogNodeFunctionCurrency,
|
|
327
|
+
name: 'currency',
|
|
328
|
+
condition: `input.text === currency`,
|
|
329
|
+
SkillId,
|
|
330
|
+
contexts: '{}',
|
|
331
|
+
step: 2,
|
|
332
|
+
replayWait: true,
|
|
333
|
+
type: 'node',
|
|
334
|
+
isMultipleResponse: false,
|
|
335
|
+
JumpToDialogNodeId: null,
|
|
336
|
+
JumpToSkillId: null,
|
|
337
|
+
DialogNodeFolderId: dialogNodeFolderSimpleExamplesId,
|
|
338
|
+
createdAt: new Date(),
|
|
339
|
+
updatedAt: new Date(),
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: dialogNodeFunctionDate,
|
|
343
|
+
name: 'date',
|
|
344
|
+
condition: `input.text === date && date().format('DD/MM/YYYY') === now()`,
|
|
345
|
+
SkillId,
|
|
346
|
+
contexts: '{}',
|
|
347
|
+
step: 3,
|
|
348
|
+
replayWait: true,
|
|
349
|
+
type: 'node',
|
|
350
|
+
isMultipleResponse: false,
|
|
351
|
+
JumpToDialogNodeId: null,
|
|
352
|
+
JumpToSkillId: null,
|
|
353
|
+
DialogNodeFolderId: dialogNodeFolderSimpleExamplesId,
|
|
354
|
+
createdAt: new Date(),
|
|
355
|
+
updatedAt: new Date(),
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
id: dialogNodeFunctionNow,
|
|
359
|
+
name: 'now',
|
|
360
|
+
condition: `input.text === now && now().indexOf(now('YYYY')) !== -1`,
|
|
361
|
+
SkillId,
|
|
362
|
+
contexts: '{}',
|
|
363
|
+
step: 4,
|
|
364
|
+
replayWait: true,
|
|
365
|
+
type: 'node',
|
|
366
|
+
isMultipleResponse: false,
|
|
367
|
+
JumpToDialogNodeId: null,
|
|
368
|
+
JumpToSkillId: null,
|
|
369
|
+
DialogNodeFolderId: dialogNodeFolderSimpleExamplesId,
|
|
370
|
+
createdAt: new Date(),
|
|
371
|
+
updatedAt: new Date(),
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
id: dialogNodeFunctionExtractStringAndNumber,
|
|
375
|
+
name: 'extract',
|
|
376
|
+
condition: `input.text === extract && extractNumbers(abc123) === 123 && extractString(abc123) === abc`,
|
|
377
|
+
SkillId,
|
|
378
|
+
contexts: '{}',
|
|
379
|
+
step: 5,
|
|
380
|
+
replayWait: true,
|
|
381
|
+
type: 'node',
|
|
382
|
+
isMultipleResponse: false,
|
|
383
|
+
JumpToDialogNodeId: null,
|
|
384
|
+
JumpToSkillId: null,
|
|
385
|
+
DialogNodeFolderId: dialogNodeFolderSimpleExamplesId,
|
|
386
|
+
createdAt: new Date(),
|
|
387
|
+
updatedAt: new Date(),
|
|
388
|
+
},
|
|
389
|
+
// Examples with context
|
|
390
|
+
{
|
|
391
|
+
id: dialogNodeFolderContextExamplesId,
|
|
392
|
+
name: 'context_examples',
|
|
393
|
+
condition: '',
|
|
394
|
+
SkillId,
|
|
395
|
+
contexts: '{}',
|
|
396
|
+
step: 3,
|
|
397
|
+
replayWait: true,
|
|
398
|
+
type: 'folder',
|
|
399
|
+
isMultipleResponse: false,
|
|
400
|
+
JumpToDialogNodeId: null,
|
|
401
|
+
JumpToSkillId: null,
|
|
402
|
+
DialogNodeFolderId: null,
|
|
403
|
+
createdAt: new Date(),
|
|
404
|
+
updatedAt: new Date(),
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
{
|
|
408
|
+
id: dialogNodeFunctionFindInArray,
|
|
409
|
+
name: 'find_in_array',
|
|
410
|
+
condition: 'input.text === find_in_array',
|
|
411
|
+
SkillId,
|
|
412
|
+
contexts: JSON.stringify([
|
|
413
|
+
{
|
|
414
|
+
label: 'findToArrayResult',
|
|
415
|
+
value: 'findInArray($array,item===5)',
|
|
416
|
+
},
|
|
417
|
+
]),
|
|
418
|
+
step: 1,
|
|
419
|
+
replayWait: true,
|
|
420
|
+
type: 'node',
|
|
421
|
+
isMultipleResponse: false,
|
|
422
|
+
JumpToDialogNodeId: null,
|
|
423
|
+
JumpToSkillId: null,
|
|
424
|
+
DialogNodeFolderId: dialogNodeFolderContextExamplesId,
|
|
425
|
+
createdAt: new Date(),
|
|
426
|
+
updatedAt: new Date(),
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
id: dialogNodeFunctionFindInArrayCity,
|
|
430
|
+
name: 'find_in_array_city',
|
|
431
|
+
condition: 'input.text === find_in_array_city',
|
|
432
|
+
SkillId,
|
|
433
|
+
contexts: JSON.stringify([
|
|
434
|
+
{
|
|
435
|
+
label: 'arrayCitiesFind',
|
|
436
|
+
value: 'findInArray($arrayCities,item.city.population===927300)',
|
|
437
|
+
},
|
|
438
|
+
]),
|
|
439
|
+
step: 2,
|
|
440
|
+
replayWait: true,
|
|
441
|
+
type: 'node',
|
|
442
|
+
isMultipleResponse: false,
|
|
443
|
+
JumpToDialogNodeId: null,
|
|
444
|
+
JumpToSkillId: null,
|
|
445
|
+
DialogNodeFolderId: dialogNodeFolderContextExamplesId,
|
|
446
|
+
createdAt: new Date(),
|
|
447
|
+
updatedAt: new Date(),
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
id: dialogNodeFunctionSizeContext,
|
|
451
|
+
name: 'size_context',
|
|
452
|
+
condition: 'input.text === size_context',
|
|
453
|
+
SkillId,
|
|
454
|
+
contexts: '{}',
|
|
455
|
+
step: 3,
|
|
456
|
+
replayWait: true,
|
|
457
|
+
type: 'node',
|
|
458
|
+
isMultipleResponse: false,
|
|
459
|
+
JumpToDialogNodeId: null,
|
|
460
|
+
JumpToSkillId: null,
|
|
461
|
+
DialogNodeFolderId: dialogNodeFolderContextExamplesId,
|
|
462
|
+
createdAt: new Date(),
|
|
463
|
+
updatedAt: new Date(),
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
id: dialogNodeFunctionRandomFloor0Id,
|
|
467
|
+
name: 'randomFloor_0',
|
|
468
|
+
condition: 'input.text === randomFloor && $randomFloor === 0',
|
|
469
|
+
SkillId,
|
|
470
|
+
contexts: '{}',
|
|
471
|
+
step: 4,
|
|
472
|
+
replayWait: true,
|
|
473
|
+
type: 'node',
|
|
474
|
+
isMultipleResponse: false,
|
|
475
|
+
JumpToDialogNodeId: null,
|
|
476
|
+
JumpToSkillId: null,
|
|
477
|
+
DialogNodeFolderId: dialogNodeFolderContextExamplesId,
|
|
478
|
+
createdAt: new Date(),
|
|
479
|
+
updatedAt: new Date(),
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
id: dialogNodeFunctionRandomFloor1Id,
|
|
483
|
+
name: 'randomFloor_1',
|
|
484
|
+
condition: 'input.text === randomFloor && $randomFloor === 1',
|
|
485
|
+
SkillId,
|
|
486
|
+
contexts: '{}',
|
|
487
|
+
step: 5,
|
|
488
|
+
replayWait: true,
|
|
489
|
+
type: 'node',
|
|
490
|
+
isMultipleResponse: false,
|
|
491
|
+
JumpToDialogNodeId: dialogNodeFolderContextExamplesId,
|
|
492
|
+
JumpToSkillId: null,
|
|
493
|
+
DialogNodeFolderId: null,
|
|
494
|
+
createdAt: new Date(),
|
|
495
|
+
updatedAt: new Date(),
|
|
496
|
+
},
|
|
497
|
+
|
|
498
|
+
{
|
|
499
|
+
id: dialogNodeFunctionTemplateToArrayId,
|
|
500
|
+
name: 'template_to_array',
|
|
501
|
+
condition: 'input.text === template_to_array',
|
|
502
|
+
SkillId,
|
|
503
|
+
contexts: '{}',
|
|
504
|
+
step: 6,
|
|
505
|
+
replayWait: true,
|
|
506
|
+
type: 'node',
|
|
507
|
+
isMultipleResponse: false,
|
|
508
|
+
JumpToDialogNodeId: dialogNodeFolderContextExamplesId,
|
|
509
|
+
JumpToSkillId: null,
|
|
510
|
+
DialogNodeFolderId: null,
|
|
511
|
+
createdAt: new Date(),
|
|
512
|
+
updatedAt: new Date(),
|
|
513
|
+
},
|
|
514
|
+
|
|
515
|
+
{
|
|
516
|
+
id: dialogNodeFunctionTemplateToArrayJoinId,
|
|
517
|
+
name: 'template_to_array_join',
|
|
518
|
+
condition: 'input.text === template_to_array_join',
|
|
519
|
+
SkillId,
|
|
520
|
+
contexts: '{}',
|
|
521
|
+
step: 7,
|
|
522
|
+
replayWait: true,
|
|
523
|
+
type: 'node',
|
|
524
|
+
isMultipleResponse: false,
|
|
525
|
+
JumpToDialogNodeId: dialogNodeFolderContextExamplesId,
|
|
526
|
+
JumpToSkillId: null,
|
|
527
|
+
DialogNodeFolderId: null,
|
|
528
|
+
createdAt: new Date(),
|
|
529
|
+
updatedAt: new Date(),
|
|
530
|
+
},
|
|
531
|
+
|
|
532
|
+
{
|
|
533
|
+
id: dialogNodeAnythingElseId,
|
|
534
|
+
name: 'anything_else',
|
|
535
|
+
condition: 'true',
|
|
536
|
+
SkillId,
|
|
537
|
+
contexts: '{}',
|
|
538
|
+
step: Response_DialogNodes.length + 2,
|
|
539
|
+
replayWait: true,
|
|
540
|
+
type: 'node',
|
|
541
|
+
isMultipleResponse: false,
|
|
542
|
+
JumpToDialogNodeId: null,
|
|
543
|
+
JumpToSkillId: null,
|
|
544
|
+
DialogNodeFolderId: null,
|
|
545
|
+
createdAt: new Date(),
|
|
546
|
+
updatedAt: new Date(),
|
|
547
|
+
},
|
|
548
|
+
],
|
|
549
|
+
{}
|
|
550
|
+
)
|
|
551
|
+
|
|
552
|
+
await queryInterface.bulkInsert(
|
|
553
|
+
'Responses',
|
|
554
|
+
[
|
|
555
|
+
{
|
|
556
|
+
id: responseWelcomeId,
|
|
557
|
+
name: 'welcome',
|
|
558
|
+
SkillId,
|
|
559
|
+
createdAt: new Date(),
|
|
560
|
+
updatedAt: new Date(),
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
id: responseAnythingElseId,
|
|
564
|
+
name: 'anything_else',
|
|
565
|
+
SkillId,
|
|
566
|
+
createdAt: new Date(),
|
|
567
|
+
updatedAt: new Date(),
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
id: responseFunctionSizeId,
|
|
571
|
+
name: 'size_length',
|
|
572
|
+
SkillId,
|
|
573
|
+
createdAt: new Date(),
|
|
574
|
+
updatedAt: new Date(),
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
id: responseFunctionFindInArray,
|
|
578
|
+
name: 'find_in_array',
|
|
579
|
+
SkillId,
|
|
580
|
+
createdAt: new Date(),
|
|
581
|
+
updatedAt: new Date(),
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
id: responseFunctionCurrency,
|
|
585
|
+
name: 'currency',
|
|
586
|
+
SkillId,
|
|
587
|
+
createdAt: new Date(),
|
|
588
|
+
updatedAt: new Date(),
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
id: responseFunctionDate,
|
|
592
|
+
name: 'date',
|
|
593
|
+
SkillId,
|
|
594
|
+
createdAt: new Date(),
|
|
595
|
+
updatedAt: new Date(),
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
id: responseFunctionNow,
|
|
599
|
+
name: 'now',
|
|
600
|
+
SkillId,
|
|
601
|
+
createdAt: new Date(),
|
|
602
|
+
updatedAt: new Date(),
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
id: responseFunctionFindInArrayCity,
|
|
606
|
+
name: 'find_in_array_city',
|
|
607
|
+
SkillId,
|
|
608
|
+
createdAt: new Date(),
|
|
609
|
+
updatedAt: new Date(),
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
id: responseFunctionExtractStringAndNumber,
|
|
613
|
+
name: 'extract',
|
|
614
|
+
SkillId,
|
|
615
|
+
createdAt: new Date(),
|
|
616
|
+
updatedAt: new Date(),
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
id: responseFunctionSizeContext,
|
|
620
|
+
name: 'size_context',
|
|
621
|
+
SkillId,
|
|
622
|
+
createdAt: new Date(),
|
|
623
|
+
updatedAt: new Date(),
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
id: responseFunctionRandomFloorId,
|
|
627
|
+
name: 'random_floor',
|
|
628
|
+
SkillId,
|
|
629
|
+
createdAt: new Date(),
|
|
630
|
+
updatedAt: new Date(),
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
id: responseFunctionTemplateToArrayId,
|
|
634
|
+
name: 'template_to_array',
|
|
635
|
+
SkillId,
|
|
636
|
+
createdAt: new Date(),
|
|
637
|
+
updatedAt: new Date(),
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
id: responseFunctionTemplateToArrayJoinId,
|
|
641
|
+
name: 'template_to_array_join',
|
|
642
|
+
SkillId,
|
|
643
|
+
createdAt: new Date(),
|
|
644
|
+
updatedAt: new Date(),
|
|
645
|
+
},
|
|
646
|
+
],
|
|
647
|
+
{}
|
|
648
|
+
)
|
|
649
|
+
|
|
650
|
+
await queryInterface.bulkInsert(
|
|
651
|
+
'ResponsesBoxes',
|
|
652
|
+
[
|
|
653
|
+
{
|
|
654
|
+
ResponseId: responseWelcomeId,
|
|
655
|
+
ChannelTypeId,
|
|
656
|
+
type: 'flow',
|
|
657
|
+
payload: JSON.stringify([
|
|
658
|
+
{
|
|
659
|
+
id: '',
|
|
660
|
+
type: 'text',
|
|
661
|
+
messages: [
|
|
662
|
+
{
|
|
663
|
+
message:
|
|
664
|
+
'Oi, eu sou um bot criado de exemplo das funções internas, então testa ai 😍',
|
|
665
|
+
},
|
|
666
|
+
],
|
|
667
|
+
},
|
|
668
|
+
]),
|
|
669
|
+
createdAt: new Date(),
|
|
670
|
+
updatedAt: new Date(),
|
|
671
|
+
},
|
|
672
|
+
|
|
673
|
+
{
|
|
674
|
+
ResponseId: responseAnythingElseId,
|
|
675
|
+
ChannelTypeId,
|
|
676
|
+
type: 'flow',
|
|
677
|
+
payload: JSON.stringify([
|
|
678
|
+
{
|
|
679
|
+
id: '',
|
|
680
|
+
type: 'text',
|
|
681
|
+
messages: [{ message: 'Desculpe não entendi.' }],
|
|
682
|
+
},
|
|
683
|
+
]),
|
|
684
|
+
createdAt: new Date(),
|
|
685
|
+
updatedAt: new Date(),
|
|
686
|
+
},
|
|
687
|
+
|
|
688
|
+
{
|
|
689
|
+
ResponseId: responseFunctionSizeId,
|
|
690
|
+
ChannelTypeId,
|
|
691
|
+
type: 'flow',
|
|
692
|
+
payload: JSON.stringify([
|
|
693
|
+
{
|
|
694
|
+
id: '',
|
|
695
|
+
type: 'text',
|
|
696
|
+
messages: [
|
|
697
|
+
{
|
|
698
|
+
message:
|
|
699
|
+
'O tamanho da string "chatbot" é size = size(chatbot) | length = "chatbot".length',
|
|
700
|
+
},
|
|
701
|
+
],
|
|
702
|
+
},
|
|
703
|
+
]),
|
|
704
|
+
createdAt: new Date(),
|
|
705
|
+
updatedAt: new Date(),
|
|
706
|
+
},
|
|
707
|
+
|
|
708
|
+
{
|
|
709
|
+
ResponseId: responseFunctionFindInArray,
|
|
710
|
+
ChannelTypeId,
|
|
711
|
+
type: 'flow',
|
|
712
|
+
payload: JSON.stringify([
|
|
713
|
+
{
|
|
714
|
+
id: '',
|
|
715
|
+
type: 'text',
|
|
716
|
+
messages: [
|
|
717
|
+
{
|
|
718
|
+
message:
|
|
719
|
+
'Dentro do array pesquisei e encontrei o valor <:$findToArrayResult:>',
|
|
720
|
+
},
|
|
721
|
+
],
|
|
722
|
+
},
|
|
723
|
+
]),
|
|
724
|
+
createdAt: new Date(),
|
|
725
|
+
updatedAt: new Date(),
|
|
726
|
+
},
|
|
727
|
+
|
|
728
|
+
{
|
|
729
|
+
ResponseId: responseFunctionCurrency,
|
|
730
|
+
ChannelTypeId,
|
|
731
|
+
type: 'flow',
|
|
732
|
+
payload: JSON.stringify([
|
|
733
|
+
{
|
|
734
|
+
id: '',
|
|
735
|
+
type: 'text',
|
|
736
|
+
messages: [{ message: 'Moeda R$ currencyFormat(10.5)' }],
|
|
737
|
+
},
|
|
738
|
+
]),
|
|
739
|
+
createdAt: new Date(),
|
|
740
|
+
updatedAt: new Date(),
|
|
741
|
+
},
|
|
742
|
+
|
|
743
|
+
{
|
|
744
|
+
ResponseId: responseFunctionDate,
|
|
745
|
+
ChannelTypeId,
|
|
746
|
+
type: 'flow',
|
|
747
|
+
payload: JSON.stringify([
|
|
748
|
+
{
|
|
749
|
+
id: '',
|
|
750
|
+
type: 'text',
|
|
751
|
+
messages: [
|
|
752
|
+
{ message: `A data de hoje é: date().format('DD/MM/YYYY')` },
|
|
753
|
+
],
|
|
754
|
+
},
|
|
755
|
+
]),
|
|
756
|
+
createdAt: new Date(),
|
|
757
|
+
updatedAt: new Date(),
|
|
758
|
+
},
|
|
759
|
+
|
|
760
|
+
{
|
|
761
|
+
ResponseId: responseFunctionDate,
|
|
762
|
+
ChannelTypeId,
|
|
763
|
+
type: 'flow',
|
|
764
|
+
payload: JSON.stringify([
|
|
765
|
+
{
|
|
766
|
+
id: '',
|
|
767
|
+
type: 'text',
|
|
768
|
+
messages: [
|
|
769
|
+
{
|
|
770
|
+
message: `A hora de agora é: date().format('LT') | date().format('LTS')`,
|
|
771
|
+
},
|
|
772
|
+
],
|
|
773
|
+
},
|
|
774
|
+
]),
|
|
775
|
+
createdAt: new Date(),
|
|
776
|
+
updatedAt: new Date(),
|
|
777
|
+
},
|
|
778
|
+
|
|
779
|
+
{
|
|
780
|
+
ResponseId: responseFunctionDate,
|
|
781
|
+
ChannelTypeId,
|
|
782
|
+
type: 'flow',
|
|
783
|
+
payload: JSON.stringify([
|
|
784
|
+
{
|
|
785
|
+
id: '',
|
|
786
|
+
type: 'text',
|
|
787
|
+
messages: [{ message: `date().format('LL')` }],
|
|
788
|
+
},
|
|
789
|
+
]),
|
|
790
|
+
createdAt: new Date(),
|
|
791
|
+
updatedAt: new Date(),
|
|
792
|
+
},
|
|
793
|
+
|
|
794
|
+
{
|
|
795
|
+
ResponseId: responseFunctionNow,
|
|
796
|
+
ChannelTypeId,
|
|
797
|
+
type: 'flow',
|
|
798
|
+
payload: JSON.stringify([
|
|
799
|
+
{
|
|
800
|
+
id: '',
|
|
801
|
+
type: 'text',
|
|
802
|
+
messages: [
|
|
803
|
+
{ message: `Data de agora sem formatação padrão: now()` },
|
|
804
|
+
],
|
|
805
|
+
},
|
|
806
|
+
]),
|
|
807
|
+
createdAt: new Date(),
|
|
808
|
+
updatedAt: new Date(),
|
|
809
|
+
},
|
|
810
|
+
|
|
811
|
+
{
|
|
812
|
+
ResponseId: responseFunctionNow,
|
|
813
|
+
ChannelTypeId,
|
|
814
|
+
type: 'flow',
|
|
815
|
+
payload: JSON.stringify([
|
|
816
|
+
{
|
|
817
|
+
id: '',
|
|
818
|
+
type: 'text',
|
|
819
|
+
messages: [
|
|
820
|
+
{
|
|
821
|
+
message: `Data de agora com formatação padrão: now(YYYY-MM-DD)`,
|
|
822
|
+
},
|
|
823
|
+
],
|
|
824
|
+
},
|
|
825
|
+
]),
|
|
826
|
+
createdAt: new Date(),
|
|
827
|
+
updatedAt: new Date(),
|
|
828
|
+
},
|
|
829
|
+
|
|
830
|
+
{
|
|
831
|
+
ResponseId: responseFunctionFindInArrayCity,
|
|
832
|
+
ChannelTypeId,
|
|
833
|
+
type: 'flow',
|
|
834
|
+
payload: JSON.stringify([
|
|
835
|
+
{
|
|
836
|
+
id: '',
|
|
837
|
+
type: 'text',
|
|
838
|
+
messages: [
|
|
839
|
+
{
|
|
840
|
+
message: `Cidade encontrada: <:$arrayCitiesFind.city.name:>`,
|
|
841
|
+
},
|
|
842
|
+
],
|
|
843
|
+
},
|
|
844
|
+
]),
|
|
845
|
+
createdAt: new Date(),
|
|
846
|
+
updatedAt: new Date(),
|
|
847
|
+
},
|
|
848
|
+
|
|
849
|
+
{
|
|
850
|
+
ResponseId: responseFunctionExtractStringAndNumber,
|
|
851
|
+
ChannelTypeId,
|
|
852
|
+
type: 'flow',
|
|
853
|
+
payload: JSON.stringify([
|
|
854
|
+
{
|
|
855
|
+
id: '',
|
|
856
|
+
type: 'text',
|
|
857
|
+
messages: [
|
|
858
|
+
{
|
|
859
|
+
message: `Testando função de extração de string com abc123 = extractString(abc123) `,
|
|
860
|
+
},
|
|
861
|
+
],
|
|
862
|
+
},
|
|
863
|
+
]),
|
|
864
|
+
createdAt: new Date(),
|
|
865
|
+
updatedAt: new Date(),
|
|
866
|
+
},
|
|
867
|
+
|
|
868
|
+
{
|
|
869
|
+
ResponseId: responseFunctionExtractStringAndNumber,
|
|
870
|
+
ChannelTypeId,
|
|
871
|
+
type: 'flow',
|
|
872
|
+
payload: JSON.stringify([
|
|
873
|
+
{
|
|
874
|
+
id: '',
|
|
875
|
+
type: 'text',
|
|
876
|
+
messages: [
|
|
877
|
+
{
|
|
878
|
+
message: `Testando função de extração de número com abc123 = extractNumbers(abc123) `,
|
|
879
|
+
},
|
|
880
|
+
],
|
|
881
|
+
},
|
|
882
|
+
]),
|
|
883
|
+
createdAt: new Date(),
|
|
884
|
+
updatedAt: new Date(),
|
|
885
|
+
},
|
|
886
|
+
|
|
887
|
+
{
|
|
888
|
+
ResponseId: responseFunctionSizeContext,
|
|
889
|
+
ChannelTypeId,
|
|
890
|
+
type: 'flow',
|
|
891
|
+
payload: JSON.stringify([
|
|
892
|
+
{
|
|
893
|
+
id: '',
|
|
894
|
+
type: 'text',
|
|
895
|
+
messages: [
|
|
896
|
+
{ message: `O tamanho do campo de contexto é size($size)` },
|
|
897
|
+
],
|
|
898
|
+
},
|
|
899
|
+
]),
|
|
900
|
+
createdAt: new Date(),
|
|
901
|
+
updatedAt: new Date(),
|
|
902
|
+
},
|
|
903
|
+
|
|
904
|
+
{
|
|
905
|
+
ResponseId: responseFunctionRandomFloorId,
|
|
906
|
+
ChannelTypeId,
|
|
907
|
+
type: 'flow',
|
|
908
|
+
payload: JSON.stringify([
|
|
909
|
+
{
|
|
910
|
+
id: '',
|
|
911
|
+
type: 'text',
|
|
912
|
+
messages: [
|
|
913
|
+
{
|
|
914
|
+
message: `O resto da divisão por 2 do número aleátório é <:$randomFloor:>`,
|
|
915
|
+
},
|
|
916
|
+
],
|
|
917
|
+
},
|
|
918
|
+
]),
|
|
919
|
+
createdAt: new Date(),
|
|
920
|
+
updatedAt: new Date(),
|
|
921
|
+
},
|
|
922
|
+
|
|
923
|
+
{
|
|
924
|
+
ResponseId: responseFunctionTemplateToArrayId,
|
|
925
|
+
ChannelTypeId,
|
|
926
|
+
type: 'flow',
|
|
927
|
+
payload: JSON.stringify([
|
|
928
|
+
{
|
|
929
|
+
id: '',
|
|
930
|
+
type: 'text',
|
|
931
|
+
messages: [
|
|
932
|
+
{
|
|
933
|
+
message: `Boletos: templateToArray($fakeApiResult.data,$template).join('')`,
|
|
934
|
+
},
|
|
935
|
+
],
|
|
936
|
+
},
|
|
937
|
+
]),
|
|
938
|
+
createdAt: new Date(),
|
|
939
|
+
updatedAt: new Date(),
|
|
940
|
+
},
|
|
941
|
+
|
|
942
|
+
{
|
|
943
|
+
ResponseId: responseFunctionTemplateToArrayJoinId,
|
|
944
|
+
ChannelTypeId,
|
|
945
|
+
type: 'flow',
|
|
946
|
+
payload: JSON.stringify([
|
|
947
|
+
{
|
|
948
|
+
id: '',
|
|
949
|
+
type: 'text',
|
|
950
|
+
messages: [
|
|
951
|
+
{
|
|
952
|
+
message: `Boletos: templateToArrayJoin($fakeApiResult.data,$template)`,
|
|
953
|
+
},
|
|
954
|
+
],
|
|
955
|
+
},
|
|
956
|
+
]),
|
|
957
|
+
createdAt: new Date(),
|
|
958
|
+
updatedAt: new Date(),
|
|
959
|
+
},
|
|
960
|
+
],
|
|
961
|
+
{}
|
|
962
|
+
)
|
|
963
|
+
|
|
964
|
+
await queryInterface.bulkInsert(
|
|
965
|
+
'Response_DialogNodes',
|
|
966
|
+
Response_DialogNodes
|
|
967
|
+
)
|
|
968
|
+
},
|
|
969
|
+
|
|
970
|
+
down: async (queryInterface) => {
|
|
971
|
+
for (const ResponseId of responses) {
|
|
972
|
+
await queryInterface.bulkDelete('Response_DialogNodes', [{ ResponseId }])
|
|
973
|
+
await queryInterface.bulkDelete('ResponsesBoxes', [{ ResponseId }])
|
|
974
|
+
|
|
975
|
+
await queryInterface.bulkDelete('Responses', [{ id: ResponseId }])
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
await queryInterface.bulkDelete('DialogNodes', [{ SkillId }])
|
|
979
|
+
await queryInterface.bulkDelete('BotIterables', [{ ChannelId }])
|
|
980
|
+
await queryInterface.bulkDelete('Sessions', [{ ChannelId }])
|
|
981
|
+
await queryInterface.bulkDelete('Clients', [{ serverId }])
|
|
982
|
+
await queryInterface.bulkDelete('Channels', [{ SkillId }])
|
|
983
|
+
await queryInterface.bulkDelete('Skills', [{ id: SkillId }])
|
|
984
|
+
},
|
|
985
|
+
}
|