mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 11:52:20 -06:00
Compare commits
2430 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd800f2976 | ||
|
|
4f642e17a7 | ||
|
|
afa6d633c6 | ||
|
|
2e3e752719 | ||
|
|
de11e6f9ca | ||
|
|
26e7eefe51 | ||
|
|
b55c9fcab7 | ||
|
|
86b194af5f | ||
|
|
3c1573c400 | ||
|
|
178386594c | ||
|
|
cea1fa0979 | ||
|
|
38be0b49d9 | ||
|
|
04ac880fcc | ||
|
|
3864366e75 | ||
|
|
2756d7e61c | ||
|
|
bb36bfe424 | ||
|
|
6277c5d084 | ||
|
|
b1d77019f5 | ||
|
|
8d5c7d875e | ||
|
|
abd0351f8f | ||
|
|
c7a2aa51ee | ||
|
|
bbf60e30b0 | ||
|
|
2408384b0f | ||
|
|
250ddd2e89 | ||
|
|
bee309cd28 | ||
|
|
92c2ace7bc | ||
|
|
faed3f4574 | ||
|
|
baff4e8f5e | ||
|
|
1c3a7ab027 | ||
|
|
338cc93cfc | ||
|
|
930d32df3a | ||
|
|
fa6b5c28a6 | ||
|
|
8e7f348c12 | ||
|
|
5c58cb7eae | ||
|
|
879bee962b | ||
|
|
af47b859e4 | ||
|
|
1c61116a3e | ||
|
|
13f96a366b | ||
|
|
08a4795016 | ||
|
|
53a94af3f7 | ||
|
|
302e219f7f | ||
|
|
1e036ba3ae | ||
|
|
377993e4b0 | ||
|
|
689f347457 | ||
|
|
7743063439 | ||
|
|
f5e43a3b3f | ||
|
|
ea88edd512 | ||
|
|
e6a9ed92ce | ||
|
|
8707520a3e | ||
|
|
d3e3c458a0 | ||
|
|
067f0999b5 | ||
|
|
179af3f41c | ||
|
|
31a6f2d92e | ||
|
|
dc72f01625 | ||
|
|
3b139078c3 | ||
|
|
f2c2a6a64a | ||
|
|
e5a249109c | ||
|
|
73fb376602 | ||
|
|
27633aad53 | ||
|
|
06543e89e5 | ||
|
|
90640b7cee | ||
|
|
da8774caa2 | ||
|
|
4ae3139163 | ||
|
|
f4043a9141 | ||
|
|
139ad9b3cb | ||
|
|
fca39a2b34 | ||
|
|
1e3a23588e | ||
|
|
27be03ea95 | ||
|
|
9b73252f35 | ||
|
|
71322cd8f6 | ||
|
|
263854db47 | ||
|
|
400b6291a2 | ||
|
|
feff038446 | ||
|
|
4d2a189905 | ||
|
|
48625a739c | ||
|
|
b6620d2bd6 | ||
|
|
45e461e757 | ||
|
|
be5760905e | ||
|
|
92626fa559 | ||
|
|
1aaad541ad | ||
|
|
3b0432dd9f | ||
|
|
a95c843e77 | ||
|
|
8d1151d0a0 | ||
|
|
a1393b679c | ||
|
|
5cbc163716 | ||
|
|
a84faaa575 | ||
|
|
503cbfb21c | ||
|
|
40281871c8 | ||
|
|
85868b3439 | ||
|
|
066e060b86 | ||
|
|
c555048783 | ||
|
|
2d14c8849b | ||
|
|
df20c5fc93 | ||
|
|
3818313161 | ||
|
|
4a38e505f4 | ||
|
|
d5f5b8325e | ||
|
|
1ad51a434b | ||
|
|
3454bec79f | ||
|
|
8c27f11f5b | ||
|
|
ae9f3efeff | ||
|
|
ba3a2fae59 | ||
|
|
aa0d793d26 | ||
|
|
48bda1b5af | ||
|
|
dd21a29ea6 | ||
|
|
e83a7e2e88 | ||
|
|
d58d0b8bff | ||
|
|
4efc9b65bc | ||
|
|
cd71ff503d | ||
|
|
582166e5ae | ||
|
|
e1ae03c1e4 | ||
|
|
0737c45df2 | ||
|
|
adbe1079d5 | ||
|
|
423f629b04 | ||
|
|
946dcaeb2e | ||
|
|
d48fbc3a4e | ||
|
|
cdf06666a1 | ||
|
|
5254928887 | ||
|
|
8468690d37 | ||
|
|
bdd9257c47 | ||
|
|
d6834c8741 | ||
|
|
164beddb39 | ||
|
|
4991f1dc37 | ||
|
|
1b1e3b3e9d | ||
|
|
563ca2dd22 | ||
|
|
4e44bfb222 | ||
|
|
9edd600513 | ||
|
|
501b06d133 | ||
|
|
dc530285d5 | ||
|
|
8775cdf036 | ||
|
|
6ad33df879 | ||
|
|
633d0b4c45 | ||
|
|
82c0eadf7c | ||
|
|
1756abf1e6 | ||
|
|
a2f48030dc | ||
|
|
3214a9fb5b | ||
|
|
4b89e3f987 | ||
|
|
72622dca31 | ||
|
|
d73b72b67e | ||
|
|
20eef33df3 | ||
|
|
37571c03b4 | ||
|
|
017949458b | ||
|
|
2feaf1c74e | ||
|
|
4b043cb4b8 | ||
|
|
b0d261b305 | ||
|
|
c041986e26 | ||
|
|
0976109d27 | ||
|
|
b808dda33b | ||
|
|
98b7f15a43 | ||
|
|
94ddc0dfbe | ||
|
|
d4b0cfd2ba | ||
|
|
a5a46dc72a | ||
|
|
e13434804c | ||
|
|
53cd7d5d13 | ||
|
|
bedfb019aa | ||
|
|
6e1d027750 | ||
|
|
fb1fa4d91a | ||
|
|
57ea6707bc | ||
|
|
ad8df44236 | ||
|
|
c132379b3a | ||
|
|
f7862637b1 | ||
|
|
0d8e8bc0fb | ||
|
|
b62917e80f | ||
|
|
eeb324227b | ||
|
|
c31b62fb3d | ||
|
|
22465c0a56 | ||
|
|
da6f1bd540 | ||
|
|
069786b9fe | ||
|
|
bd0c43feac | ||
|
|
5dc1d02d0a | ||
|
|
8697329f71 | ||
|
|
58b5561f72 | ||
|
|
093515555d | ||
|
|
d8268b0eb1 | ||
|
|
4585850741 | ||
|
|
6c150eed6d | ||
|
|
78c7b96f0f | ||
|
|
dfea584aa7 | ||
|
|
6c5b056615 | ||
|
|
d8b4378163 | ||
|
|
838cc14531 | ||
|
|
878da12fa4 | ||
|
|
10a2b60595 | ||
|
|
b0ca79cd11 | ||
|
|
71eb189a6d | ||
|
|
407d254cf7 | ||
|
|
5f44da61fb | ||
|
|
41a36bbb19 | ||
|
|
8ab41fcfc9 | ||
|
|
5e08628d89 | ||
|
|
4726c4727d | ||
|
|
0787a10f39 | ||
|
|
5bdd6ad9d8 | ||
|
|
f602ba343f | ||
|
|
9d42ad3495 | ||
|
|
e4da6a1763 | ||
|
|
55125856fe | ||
|
|
a1281927a8 | ||
|
|
250cb61748 | ||
|
|
ff9ff60e3b | ||
|
|
c6a7e2368b | ||
|
|
f0c6300599 | ||
|
|
24c339343f | ||
|
|
deb4494fc0 | ||
|
|
0a357089b3 | ||
|
|
3ddbd6a7fb | ||
|
|
81a991a62e | ||
|
|
a721beda3c | ||
|
|
7088ad05d2 | ||
|
|
805f40c841 | ||
|
|
09ee2e6296 | ||
|
|
dd931eee36 | ||
|
|
55822f9443 | ||
|
|
00780157db | ||
|
|
b514fab30e | ||
|
|
7ba878742e | ||
|
|
d998baa839 | ||
|
|
e75dae38ee | ||
|
|
1fabb1f3bd | ||
|
|
ddbaf2335a | ||
|
|
edfcb0c082 | ||
|
|
827604644b | ||
|
|
481e179cc5 | ||
|
|
5a39f1ae49 | ||
|
|
4378c33f42 | ||
|
|
ab4bec3b54 | ||
|
|
20c8a2ff0e | ||
|
|
e623269a18 | ||
|
|
3eeffe4586 | ||
|
|
0e737d48c1 | ||
|
|
a3223ec890 | ||
|
|
875b874a7b | ||
|
|
0363fa979d | ||
|
|
486645fb08 | ||
|
|
b640329cf8 | ||
|
|
f72b1f7717 | ||
|
|
ed4c8868a0 | ||
|
|
06081f6502 | ||
|
|
bfe7030fab | ||
|
|
1320ec8d4f | ||
|
|
d31d6fa554 | ||
|
|
edbf36019e | ||
|
|
d67eb3202b | ||
|
|
0aa6c96765 | ||
|
|
8619e320bc | ||
|
|
5015cfbc9d | ||
|
|
cf548eedbe | ||
|
|
b9ae40145d | ||
|
|
bc9724a929 | ||
|
|
21502b996d | ||
|
|
d9c04fc866 | ||
|
|
d6a76a096d | ||
|
|
0116bc4c9f | ||
|
|
6da79f0313 | ||
|
|
8830f476e8 | ||
|
|
e864b18561 | ||
|
|
9cb703a427 | ||
|
|
05fcdd9ffc | ||
|
|
3ecf288daf | ||
|
|
3989ff928b | ||
|
|
16c0a8033f | ||
|
|
79438c9445 | ||
|
|
10a2c001ab | ||
|
|
7486d22ed1 | ||
|
|
4f13a8ac28 | ||
|
|
1be58c8487 | ||
|
|
613d486fc2 | ||
|
|
025b183ebf | ||
|
|
ceddace915 | ||
|
|
02b81beb7a | ||
|
|
43cc6d3608 | ||
|
|
edb4fa3b3e | ||
|
|
17120e91a4 | ||
|
|
23cd6d2fd8 | ||
|
|
c2085b59ea | ||
|
|
2513f96178 | ||
|
|
70a2c18146 | ||
|
|
b8953f1431 | ||
|
|
9ab6f9ad76 | ||
|
|
9beb38d807 | ||
|
|
e48e878b4f | ||
|
|
293f655274 | ||
|
|
cca929e7fc | ||
|
|
a91a4ad19c | ||
|
|
00ba227e15 | ||
|
|
c02d37028b | ||
|
|
14771ab84e | ||
|
|
20352e77ef | ||
|
|
78f7618d04 | ||
|
|
57b19d85d5 | ||
|
|
b325500310 | ||
|
|
4681576cfc | ||
|
|
7a99fba556 | ||
|
|
6e652d6ea2 | ||
|
|
33a922995b | ||
|
|
74cb65c4ea | ||
|
|
8e51ae63ae | ||
|
|
f9c4255500 | ||
|
|
af423cef28 | ||
|
|
40ce6b56ca | ||
|
|
4945345519 | ||
|
|
ab9e0edad6 | ||
|
|
3390958314 | ||
|
|
a8343a8739 | ||
|
|
dab66fc8c8 | ||
|
|
03a44cf9b2 | ||
|
|
fb11f3f99c | ||
|
|
d4eb61f64d | ||
|
|
4f043f9576 | ||
|
|
79f4a22217 | ||
|
|
20dd1b1660 | ||
|
|
fe8280ab7b | ||
|
|
bc11d0f751 | ||
|
|
095e435561 | ||
|
|
96f4b80d46 | ||
|
|
9cdb897a0f | ||
|
|
b5c67774dc | ||
|
|
7f8293f4c6 | ||
|
|
a62f9ebe46 | ||
|
|
69726f0dc2 | ||
|
|
6101c8d651 | ||
|
|
c66485ef98 | ||
|
|
4a25cd1ff7 | ||
|
|
23f54d1d96 | ||
|
|
5191438acf | ||
|
|
96d3ec2017 | ||
|
|
cf95c027eb | ||
|
|
9b7ca4bfb7 | ||
|
|
d490f8f576 | ||
|
|
68e847d10e | ||
|
|
b98cd11fb1 | ||
|
|
5386d7171b | ||
|
|
f59cae7ee2 | ||
|
|
0e358cf9c1 | ||
|
|
6954472070 | ||
|
|
afd0e01ddb | ||
|
|
b3dae7a68e | ||
|
|
44d4781f6f | ||
|
|
e304b1dcdf | ||
|
|
f8f2153cb4 | ||
|
|
192c34caa0 | ||
|
|
cdef7dc9f9 | ||
|
|
85798b209c | ||
|
|
71ebecbed3 | ||
|
|
419300b31f | ||
|
|
9fd40a411a | ||
|
|
d98fa5259e | ||
|
|
05886ec684 | ||
|
|
89d4d341f6 | ||
|
|
1ca829c00b | ||
|
|
e321609b93 | ||
|
|
196617507e | ||
|
|
6da71f5161 | ||
|
|
5d0278a589 | ||
|
|
2fb3eac383 | ||
|
|
4a5696eda9 | ||
|
|
11520481ba | ||
|
|
95a53d33ef | ||
|
|
d458c978f3 | ||
|
|
bd35d7977c | ||
|
|
e92961e7b0 | ||
|
|
f11d490f7a | ||
|
|
37319966db | ||
|
|
630f5c5624 | ||
|
|
3e690fe9e2 | ||
|
|
09429e68fe | ||
|
|
9acccf723d | ||
|
|
3b920f93c5 | ||
|
|
85936dcaed | ||
|
|
333ef3eeb8 | ||
|
|
8dd51b0302 | ||
|
|
e6ec706a38 | ||
|
|
53101d4571 | ||
|
|
c7b5abce6e | ||
|
|
5b1b5ff9d2 | ||
|
|
505490d237 | ||
|
|
675745ae3c | ||
|
|
6dfbfe2d83 | ||
|
|
1c247498d8 | ||
|
|
419324837c | ||
|
|
17f97fb051 | ||
|
|
f7e7a6c901 | ||
|
|
b35b33ca50 | ||
|
|
3efe69ada3 | ||
|
|
287c679ce4 | ||
|
|
918697866f | ||
|
|
3c917af602 | ||
|
|
52798fd761 | ||
|
|
34446d188e | ||
|
|
ef31b6de1f | ||
|
|
d7afe5d7ab | ||
|
|
72fb2f408b | ||
|
|
e4f7856ca9 | ||
|
|
e86b6463fd | ||
|
|
0302944654 | ||
|
|
1b0d81b022 | ||
|
|
854d357518 | ||
|
|
6e8da4a8dc | ||
|
|
e92e98dd22 | ||
|
|
cdd2e59755 | ||
|
|
1a1d9fc957 | ||
|
|
8ea4d65bc2 | ||
|
|
af713dee55 | ||
|
|
ee9ccb55ca | ||
|
|
977f686233 | ||
|
|
a38caeaf5f | ||
|
|
873fdcb22a | ||
|
|
2e077a77ef | ||
|
|
4be818a436 | ||
|
|
a7badb9af5 | ||
|
|
ba5fb567eb | ||
|
|
1070caf131 | ||
|
|
9766e10ce9 | ||
|
|
cc5612822f | ||
|
|
83c1040114 | ||
|
|
b4d1148d6a | ||
|
|
bd94423e5b | ||
|
|
94670cbca3 | ||
|
|
bda3f5f146 | ||
|
|
7724fe3a4f | ||
|
|
8b5f49592a | ||
|
|
6c0082cd7a | ||
|
|
3391b2ce4b | ||
|
|
39606240da | ||
|
|
f4fbc4afc6 | ||
|
|
70905e7338 | ||
|
|
07cccb7c7f | ||
|
|
5f0862a759 | ||
|
|
029d68e2cd | ||
|
|
a1fae85531 | ||
|
|
1afa8df556 | ||
|
|
bfb044b234 | ||
|
|
ae99ec7a0e | ||
|
|
22c379aa36 | ||
|
|
62c00c3db2 | ||
|
|
afc2927837 | ||
|
|
c17b48bca0 | ||
|
|
534c54a171 | ||
|
|
8603e6def0 | ||
|
|
bcf2febf48 | ||
|
|
a02ecc88f5 | ||
|
|
bc451e8493 | ||
|
|
1eb2c848f7 | ||
|
|
7cfc359be9 | ||
|
|
421e762c2d | ||
|
|
9e1f9cbb83 | ||
|
|
44e0ff2250 | ||
|
|
614ad7cbdf | ||
|
|
77b3b331f8 | ||
|
|
e469dc132f | ||
|
|
fa14abac5a | ||
|
|
9db56560e4 | ||
|
|
786e57603f | ||
|
|
a53e0a8694 | ||
|
|
16e4bba108 | ||
|
|
bd19fff264 | ||
|
|
94285ecb90 | ||
|
|
3500fbe27f | ||
|
|
cb76381466 | ||
|
|
98502f6555 | ||
|
|
3fc77e4c76 | ||
|
|
19e291178c | ||
|
|
7682a679d1 | ||
|
|
97ca23a7b0 | ||
|
|
95bd85b6e3 | ||
|
|
64fc7a05ac | ||
|
|
39aaf29d54 | ||
|
|
22e99f7934 | ||
|
|
dd0dfd447c | ||
|
|
fb18267ac5 | ||
|
|
fc5965938e | ||
|
|
623efd86a2 | ||
|
|
3297364c10 | ||
|
|
373a531e88 | ||
|
|
e081533f02 | ||
|
|
17fd407d8d | ||
|
|
0cdc67effe | ||
|
|
ddaf32be76 | ||
|
|
0b2d8a752f | ||
|
|
9cda6a2f99 | ||
|
|
d2263af3e8 | ||
|
|
0239638232 | ||
|
|
3459d61eff | ||
|
|
5330121c49 | ||
|
|
53c1c218c4 | ||
|
|
06378e5d6b | ||
|
|
6a83e89394 | ||
|
|
d24540d6dd | ||
|
|
2af7b24013 | ||
|
|
6f47a54fae | ||
|
|
edde059fa1 | ||
|
|
dcb09b87fe | ||
|
|
bbf142cf39 | ||
|
|
da51b6bd76 | ||
|
|
8b15c11817 | ||
|
|
272a4de236 | ||
|
|
65111481b9 | ||
|
|
0ca109e9d6 | ||
|
|
5b817028a9 | ||
|
|
6a0fc19702 | ||
|
|
9cedf31eed | ||
|
|
f9567fbeaa | ||
|
|
d673c83a93 | ||
|
|
e16bb0e580 | ||
|
|
09120aa026 | ||
|
|
fbfa364df9 | ||
|
|
624b37e2aa | ||
|
|
fcde1f9acc | ||
|
|
cc01787501 | ||
|
|
c30bae4c3a | ||
|
|
2545013040 | ||
|
|
c53a96e757 | ||
|
|
a2d8642e1c | ||
|
|
9c530c69cf | ||
|
|
348a4ff251 | ||
|
|
fc00916345 | ||
|
|
69b4f1aa02 | ||
|
|
7cccda10bb | ||
|
|
33c808b195 | ||
|
|
d3ee370bdc | ||
|
|
7e5740b462 | ||
|
|
0b33a76394 | ||
|
|
6a0b024b13 | ||
|
|
fda6b0d50e | ||
|
|
9ec6847683 | ||
|
|
c745fbad64 | ||
|
|
40ea8bf356 | ||
|
|
0699ad4bb0 | ||
|
|
70a4fe8f6e | ||
|
|
71124755b0 | ||
|
|
a1cc504777 | ||
|
|
0fd2e04286 | ||
|
|
4f2b0c42f3 | ||
|
|
401b0359cd | ||
|
|
b1f3c5cc5f | ||
|
|
362736ea71 | ||
|
|
2544c10592 | ||
|
|
383805aa95 | ||
|
|
71101807bb | ||
|
|
38f089f04c | ||
|
|
6d63f2fb6e | ||
|
|
bb0b9b94ff | ||
|
|
a449fdf0ef | ||
|
|
ec9de49647 | ||
|
|
a7a9de2903 | ||
|
|
99b0c86278 | ||
|
|
e6a72bd829 | ||
|
|
341a0d884f | ||
|
|
383bac090a | ||
|
|
60a58ca037 | ||
|
|
e5989f3d47 | ||
|
|
bff3bf564b | ||
|
|
c74eee8e52 | ||
|
|
d1a28ea4f7 | ||
|
|
d2f1985913 | ||
|
|
90e27cc7d8 | ||
|
|
c4ddfe6804 | ||
|
|
aaa103a842 | ||
|
|
b2809b6f3e | ||
|
|
d52256718d | ||
|
|
8f0ede4207 | ||
|
|
95827a2d70 | ||
|
|
b064e512e2 | ||
|
|
db5f0d0891 | ||
|
|
ccbd866e42 | ||
|
|
dc67039b39 | ||
|
|
eeedfb0e2a | ||
|
|
3ab75faff7 | ||
|
|
095754d173 | ||
|
|
b94b452597 | ||
|
|
2ded19752f | ||
|
|
4c8c7ee19b | ||
|
|
8c6f95fbef | ||
|
|
402b37d7b4 | ||
|
|
09f79c94be | ||
|
|
7c7dca9da9 | ||
|
|
1d2e029b54 | ||
|
|
3f8d89e970 | ||
|
|
abda9e2113 | ||
|
|
2a020928e8 | ||
|
|
b436e5b0b0 | ||
|
|
9889035ddc | ||
|
|
07ce09d8e2 | ||
|
|
0d2a7ad50b | ||
|
|
7e8044a777 | ||
|
|
645f305cd6 | ||
|
|
829032dc08 | ||
|
|
3d40b0850b | ||
|
|
17bd108251 | ||
|
|
f695e8bdc9 | ||
|
|
bf59ff1287 | ||
|
|
ce1680f515 | ||
|
|
119ceba1ca | ||
|
|
9710fbdac4 | ||
|
|
658dae0b59 | ||
|
|
b89f1144b4 | ||
|
|
d196590862 | ||
|
|
c5c354ffe7 | ||
|
|
36757dddc2 | ||
|
|
027401b839 | ||
|
|
6e7dd51679 | ||
|
|
f8b1c6e0fa | ||
|
|
cee2bc4d71 | ||
|
|
043df62a8f | ||
|
|
53ae521863 | ||
|
|
13bdbc268c | ||
|
|
ea9c3fbbe0 | ||
|
|
22a958616d | ||
|
|
32cde710b8 | ||
|
|
d9aa111800 | ||
|
|
fb41ab14e8 | ||
|
|
5998fcf940 | ||
|
|
2198a86ae4 | ||
|
|
8a54efe11c | ||
|
|
4fadf64bae | ||
|
|
2f1df734e0 | ||
|
|
247c39fe39 | ||
|
|
ada63b58af | ||
|
|
5192f49a4f | ||
|
|
48b5fd41e0 | ||
|
|
5720bdc0ef | ||
|
|
ab2364b9a3 | ||
|
|
278add6b11 | ||
|
|
8f632a6f5c | ||
|
|
a4ac798b43 | ||
|
|
fc513f1d1d | ||
|
|
6f1667abb5 | ||
|
|
98b8419b8d | ||
|
|
59479f9a21 | ||
|
|
ff77bc018a | ||
|
|
33f7f2932d | ||
|
|
c939ed2337 | ||
|
|
a49c97996c | ||
|
|
da72edfb03 | ||
|
|
b51526aff3 | ||
|
|
b93ee2e023 | ||
|
|
b58d9e957f | ||
|
|
e5137e1aac | ||
|
|
6b120e5da2 | ||
|
|
342dacc398 | ||
|
|
d75c37e233 | ||
|
|
36df38d78b | ||
|
|
68c6ad4f91 | ||
|
|
8685f2fdc4 | ||
|
|
5a50381a8e | ||
|
|
736ca5e4b6 | ||
|
|
6c1355b64b | ||
|
|
95401cf9b0 | ||
|
|
0c5d28bb6c | ||
|
|
0d1e7c08c9 | ||
|
|
d665474404 | ||
|
|
9a72b90ab2 | ||
|
|
b143363c5d | ||
|
|
56a8e09ba8 | ||
|
|
023e030802 | ||
|
|
e27db0612f | ||
|
|
e51b6e9270 | ||
|
|
867e8493aa | ||
|
|
8135994340 | ||
|
|
427c994993 | ||
|
|
da74611769 | ||
|
|
91e7a32209 | ||
|
|
4137984b5d | ||
|
|
96821f5d9a | ||
|
|
3c2ea5c67c | ||
|
|
4a5d7a91e2 | ||
|
|
9109b140a9 | ||
|
|
ff5a8adc71 | ||
|
|
b09638600e | ||
|
|
fc84e0f327 | ||
|
|
c1494ca035 | ||
|
|
7ea46a05ca | ||
|
|
f8f1cbf4a2 | ||
|
|
79b1c6bb1c | ||
|
|
169d2f797b | ||
|
|
db9cdbfc38 | ||
|
|
6afcc958c5 | ||
|
|
2166aad1d3 | ||
|
|
14fea2f5e0 | ||
|
|
9122dae262 | ||
|
|
96549664c9 | ||
|
|
fa19c7fa89 | ||
|
|
503728e1e7 | ||
|
|
f11e3247f0 | ||
|
|
7f10a0eecd | ||
|
|
a1085b4a4d | ||
|
|
b1b2d18e5d | ||
|
|
37a9e316a8 | ||
|
|
f340f7716f | ||
|
|
dab843f118 | ||
|
|
f7db442a94 | ||
|
|
3a04f7587e | ||
|
|
666c0b514d | ||
|
|
ab5eb80edd | ||
|
|
b0219e5e5a | ||
|
|
d7b4965d60 | ||
|
|
cfe6bd9ae0 | ||
|
|
ac58f58bbc | ||
|
|
cb08f6b152 | ||
|
|
a817d62067 | ||
|
|
540467293c | ||
|
|
616ae0a7eb | ||
|
|
d598c4ed0b | ||
|
|
ca451bfacc | ||
|
|
f971f388d5 | ||
|
|
236b0f9b26 | ||
|
|
0f2498bbaa | ||
|
|
2816a16387 | ||
|
|
a82669b6fa | ||
|
|
72a33ae59f | ||
|
|
425d340956 | ||
|
|
f2872cf59a | ||
|
|
1773f2738e | ||
|
|
18626c9846 | ||
|
|
6212ee3eb0 | ||
|
|
8c877029e5 | ||
|
|
0000c1c05c | ||
|
|
16daf9be8f | ||
|
|
e0c960cc54 | ||
|
|
08ceb803c8 | ||
|
|
6b72550286 | ||
|
|
df0990df0f | ||
|
|
60c9e231be | ||
|
|
2fb6318011 | ||
|
|
070159568e | ||
|
|
bfba702fde | ||
|
|
d5c2cfb4f9 | ||
|
|
cdab5e2ae8 | ||
|
|
682eaa995f | ||
|
|
62ea22a06a | ||
|
|
370025b8f9 | ||
|
|
5d13f7055b | ||
|
|
c4e87c160e | ||
|
|
ee8e937fad | ||
|
|
d5a7e03ec2 | ||
|
|
52b6b61ac9 | ||
|
|
6e6711a5af | ||
|
|
013fa9dc08 | ||
|
|
a42bc988ec | ||
|
|
3582cd38fb | ||
|
|
bfd8c08987 | ||
|
|
ecbbc5b090 | ||
|
|
b7e15be418 | ||
|
|
1d5508736e | ||
|
|
cefe3ef6c3 | ||
|
|
09a33a423e | ||
|
|
e092a80aeb | ||
|
|
99a533afc1 | ||
|
|
b603021f56 | ||
|
|
7bf0fd1c36 | ||
|
|
52cf4fa8b8 | ||
|
|
ef7574273c | ||
|
|
d797d8177c | ||
|
|
e7ed1446ee | ||
|
|
5eaabfb1eb | ||
|
|
59383d5944 | ||
|
|
d87d7c0775 | ||
|
|
753f4ba141 | ||
|
|
7ef8afa9b3 | ||
|
|
c5fd81ddbf | ||
|
|
8f855b4bfd | ||
|
|
084be1cee2 | ||
|
|
997aceeebf | ||
|
|
c8410bd146 | ||
|
|
3d51b45e2b | ||
|
|
50d84d1a08 | ||
|
|
fd1f08a41e | ||
|
|
8dc27919b1 | ||
|
|
6591a67ab6 | ||
|
|
08192a03ca | ||
|
|
8f86c9d758 | ||
|
|
0e5f9e3b77 | ||
|
|
1665654676 | ||
|
|
133eddd742 | ||
|
|
c55312d206 | ||
|
|
52216ec08e | ||
|
|
7a01cdf0ef | ||
|
|
65a9c78d86 | ||
|
|
f6ccd58dee | ||
|
|
fbccf2eb2a | ||
|
|
23640a71b8 | ||
|
|
fce3e55e91 | ||
|
|
9f39ec2110 | ||
|
|
89c4c194df | ||
|
|
a4e7baa41c | ||
|
|
e22ff6c0d9 | ||
|
|
11d31123ac | ||
|
|
0fdc47e8f0 | ||
|
|
60db8081bd | ||
|
|
37b003f169 | ||
|
|
891c3eb5d3 | ||
|
|
3b99699f1a | ||
|
|
e1de70542b | ||
|
|
c10680df41 | ||
|
|
171f460f3b | ||
|
|
6d0ad5f3db | ||
|
|
f34115fdcb | ||
|
|
f9705c07dc | ||
|
|
e986768716 | ||
|
|
34769e2293 | ||
|
|
5401ecd2c4 | ||
|
|
84451ba3e0 | ||
|
|
bc751bbb6b | ||
|
|
da77af5bd1 | ||
|
|
1787238c63 | ||
|
|
c4bcd1fafe | ||
|
|
ecd4b913b6 | ||
|
|
1aeda4e1f4 | ||
|
|
fb1eed8beb | ||
|
|
287f387e82 | ||
|
|
b18e83d293 | ||
|
|
968cc25d37 | ||
|
|
b38f3cdddf | ||
|
|
a6fb8cbd30 | ||
|
|
aa8396d437 | ||
|
|
ec2b7f94f8 | ||
|
|
45acc6d281 | ||
|
|
b324e22d57 | ||
|
|
001f4d3ca5 | ||
|
|
aa18d13e21 | ||
|
|
fa759f5da1 | ||
|
|
3af8f968c2 | ||
|
|
d8061346da | ||
|
|
84df14ef93 | ||
|
|
f5baced024 | ||
|
|
0987fda327 | ||
|
|
5b91648d5c | ||
|
|
d50da79f22 | ||
|
|
29e2cfaf96 | ||
|
|
8ab8961e91 | ||
|
|
f38f3e5ba5 | ||
|
|
c29d20ea40 | ||
|
|
e19ee05e9f | ||
|
|
68ccfb0517 | ||
|
|
7cb5d10fc9 | ||
|
|
ab0fedf484 | ||
|
|
5fcdf5aeaf | ||
|
|
394c091810 | ||
|
|
73e732bf24 | ||
|
|
c6ee463dae | ||
|
|
cada7be1e5 | ||
|
|
eb456f6a88 | ||
|
|
7adab5c1c0 | ||
|
|
f5f778ecbe | ||
|
|
f2bb01a640 | ||
|
|
2f1ba83546 | ||
|
|
10aeeebb53 | ||
|
|
96e1802148 | ||
|
|
27dc49f2c3 | ||
|
|
edb3875b91 | ||
|
|
ac3b18678e | ||
|
|
49edd174a9 | ||
|
|
4d33ad3aef | ||
|
|
3511082511 | ||
|
|
23abcbecd3 | ||
|
|
87fe8c2b3c | ||
|
|
eee43bb073 | ||
|
|
51a3710b46 | ||
|
|
0aa8150070 | ||
|
|
8e8a3db529 | ||
|
|
bcf59a2015 | ||
|
|
e66f877b4c | ||
|
|
aac8d446b4 | ||
|
|
a0a62b997c | ||
|
|
070840d364 | ||
|
|
0af00582f0 | ||
|
|
b80b203670 | ||
|
|
29a1d99d05 | ||
|
|
2e43683835 | ||
|
|
ebbba7b7e9 | ||
|
|
c823f84c70 | ||
|
|
0f7c2437bc | ||
|
|
1f6473cfd5 | ||
|
|
db7428abd9 | ||
|
|
59af93251d | ||
|
|
83567d6466 | ||
|
|
d7ddb99fb0 | ||
|
|
2d732c8071 | ||
|
|
0d2125ddff | ||
|
|
0791e1afe9 | ||
|
|
fcfa96d97d | ||
|
|
01ae55f02a | ||
|
|
97f633a69a | ||
|
|
5c046d51c5 | ||
|
|
487d8b93fb | ||
|
|
db065ab942 | ||
|
|
373268c938 | ||
|
|
fcc26f931e | ||
|
|
2037e78045 | ||
|
|
161abf1d03 | ||
|
|
ec2d7e349f | ||
|
|
44e152bea2 | ||
|
|
9083bf44fe | ||
|
|
7b41d333d7 | ||
|
|
0a4b8d202a | ||
|
|
d84713f6ca | ||
|
|
d1bc0e6150 | ||
|
|
14d10c00ec | ||
|
|
88c1830bf5 | ||
|
|
23549e3c1f | ||
|
|
1ded6c81ad | ||
|
|
7ca9bff6e0 | ||
|
|
4fa3c50138 | ||
|
|
14df0b368b | ||
|
|
8dee8a1ec0 | ||
|
|
acad895c9d | ||
|
|
49327593a9 | ||
|
|
567152184c | ||
|
|
0d8982395f | ||
|
|
479dc12f28 | ||
|
|
182c5fc25e | ||
|
|
f16e9bc60f | ||
|
|
10174069e0 | ||
|
|
e146921e53 | ||
|
|
449a3b2252 | ||
|
|
efbb32ff0c | ||
|
|
0ad330bdb3 | ||
|
|
9a6d4a8e44 | ||
|
|
0b40583fa8 | ||
|
|
fe4a439fde | ||
|
|
58a8d92c37 | ||
|
|
185fb587e0 | ||
|
|
5829762f91 | ||
|
|
af56b06f50 | ||
|
|
168c5f18d8 | ||
|
|
510eaf1141 | ||
|
|
1e5d62c777 | ||
|
|
ca2387cc70 | ||
|
|
0ff421121f | ||
|
|
8789f9bc97 | ||
|
|
d535bc4ea2 | ||
|
|
f35f8dd7e0 | ||
|
|
f9726863ef | ||
|
|
49ceb44102 | ||
|
|
f54a00a07f | ||
|
|
e241cf4ee0 | ||
|
|
59fac8bc4a | ||
|
|
68b5d8db4d | ||
|
|
4ca141b4f4 | ||
|
|
d3b229c6a1 | ||
|
|
ffac87835b | ||
|
|
726b0dcbb2 | ||
|
|
5ebebbf211 | ||
|
|
3527e662e1 | ||
|
|
2b3062222a | ||
|
|
495b50f933 | ||
|
|
ae69eb0bce | ||
|
|
cecbf59f46 | ||
|
|
d3f90a7abd | ||
|
|
4e4caab970 | ||
|
|
154dd4e9ba | ||
|
|
79170b8f01 | ||
|
|
adfe2977ef | ||
|
|
92373812c1 | ||
|
|
0544d80cbd | ||
|
|
76fe717076 | ||
|
|
aeb422b3f7 | ||
|
|
17313d45f9 | ||
|
|
6b447c654f | ||
|
|
ff98d0724e | ||
|
|
9a1d5664c9 | ||
|
|
f5fbf73139 | ||
|
|
ade5f8d122 | ||
|
|
7fa41a4d4c | ||
|
|
c8b36a2401 | ||
|
|
9fcb1e8829 | ||
|
|
83f87bc1c5 | ||
|
|
55a3e59fa5 | ||
|
|
2947269c4e | ||
|
|
599560bdd7 | ||
|
|
a84bc18dea | ||
|
|
918cf295ad | ||
|
|
1ef379baf7 | ||
|
|
d183990732 | ||
|
|
9f30c7b160 | ||
|
|
bfcf99bba0 | ||
|
|
80ae86b298 | ||
|
|
63dac9d04f | ||
|
|
65c6ecff88 | ||
|
|
c20a3b643f | ||
|
|
a9e4860a77 | ||
|
|
16a0e6b18e | ||
|
|
49410d7d5e | ||
|
|
ff78954383 | ||
|
|
2c7288e888 | ||
|
|
a97a01e0aa | ||
|
|
18ccccf344 | ||
|
|
65debe5a95 | ||
|
|
672bdc1cc7 | ||
|
|
71289fb919 | ||
|
|
b93725dd32 | ||
|
|
2784b907b0 | ||
|
|
25daec9f41 | ||
|
|
849d5f79dc | ||
|
|
73727da867 | ||
|
|
401770be1c | ||
|
|
acd4100b23 | ||
|
|
b0aa299850 | ||
|
|
1db339c65f | ||
|
|
fed49c2072 | ||
|
|
5f86f01e3a | ||
|
|
951da04373 | ||
|
|
1161a8a0e2 | ||
|
|
2cb68b38a9 | ||
|
|
265cba9e3e | ||
|
|
f17bb4ec42 | ||
|
|
4cdf76f381 | ||
|
|
f0840e07fe | ||
|
|
47d56f9c52 | ||
|
|
ed5ff089c5 | ||
|
|
256bd3ef73 | ||
|
|
09eaba99c0 | ||
|
|
a57842519b | ||
|
|
011bef3daf | ||
|
|
2fc0815e14 | ||
|
|
5ac98f7278 | ||
|
|
8b5ca0c9c4 | ||
|
|
c63cb23433 | ||
|
|
41342f39de | ||
|
|
49806cf47e | ||
|
|
7468ae9169 | ||
|
|
7a76600cd6 | ||
|
|
ce6438b9a8 | ||
|
|
a19343d3e1 | ||
|
|
0989f8a3ad | ||
|
|
3b9761992a | ||
|
|
b19c5375e5 | ||
|
|
cb865bf5a0 | ||
|
|
bb89816ca6 | ||
|
|
c7281cbdea | ||
|
|
a44aa1f646 | ||
|
|
d712cbc467 | ||
|
|
fc786c54f5 | ||
|
|
b8d6e55fba | ||
|
|
d776770d09 | ||
|
|
8b7ff37261 | ||
|
|
c531906de2 | ||
|
|
e8fa952de5 | ||
|
|
d7049e798c | ||
|
|
238c332df5 | ||
|
|
aeea61ef4b | ||
|
|
a90617fa0c | ||
|
|
a9c737da3f | ||
|
|
25959ad143 | ||
|
|
c00f46b105 | ||
|
|
2344dfc22f | ||
|
|
25cbe3a035 | ||
|
|
b546e56eea | ||
|
|
aa79409d44 | ||
|
|
f6b3612c3d | ||
|
|
5d6a34ad3f | ||
|
|
1b9fec6c27 | ||
|
|
e809f38865 | ||
|
|
0fca8c0746 | ||
|
|
d7b3230db9 | ||
|
|
fcdee75f39 | ||
|
|
ca503b49c6 | ||
|
|
1f0a5a2e09 | ||
|
|
6a62ae85fc | ||
|
|
beafc62403 | ||
|
|
a08ca7a67d | ||
|
|
9418faff30 | ||
|
|
99161de094 | ||
|
|
c3c1ffe7e5 | ||
|
|
03c32de743 | ||
|
|
05ee65f422 | ||
|
|
6328c64192 | ||
|
|
fcc4fc2665 | ||
|
|
a83a358620 | ||
|
|
fff11ea452 | ||
|
|
9099adf363 | ||
|
|
e77a974b59 | ||
|
|
0e9cd21981 | ||
|
|
2196f65b7a | ||
|
|
e9f4477d11 | ||
|
|
0e6a78d011 | ||
|
|
61523c0a79 | ||
|
|
891d00ccba | ||
|
|
e0ac6ab5d5 | ||
|
|
52234089e4 | ||
|
|
1ebd6f79c2 | ||
|
|
beb7942d7c | ||
|
|
cca063dfed | ||
|
|
16bc363d5f | ||
|
|
4aac2da253 | ||
|
|
0aeecde847 | ||
|
|
912df56c55 | ||
|
|
6585e8f0c2 | ||
|
|
1bf76ecb94 | ||
|
|
35bde8498b | ||
|
|
9a09a6662a | ||
|
|
73d65b0eb6 | ||
|
|
e7d971867b | ||
|
|
9209c9992d | ||
|
|
edeb1efd2a | ||
|
|
dcef6919cb | ||
|
|
475fced33b | ||
|
|
8876797172 | ||
|
|
b58ad83c12 | ||
|
|
839fe74a2c | ||
|
|
68f57aa507 | ||
|
|
583ce33868 | ||
|
|
3b39f13180 | ||
|
|
2ec0b842c1 | ||
|
|
884362e70c | ||
|
|
df77aadd04 | ||
|
|
7b79591e42 | ||
|
|
64ed0faa83 | ||
|
|
d68d42b984 | ||
|
|
1673132c3e | ||
|
|
ec9e227413 | ||
|
|
82634c0cb2 | ||
|
|
8b5b4994f2 | ||
|
|
ff52be5ac5 | ||
|
|
e555bc3930 | ||
|
|
046c64c65d | ||
|
|
9ae5255d5f | ||
|
|
87a5663da7 | ||
|
|
5300c345d9 | ||
|
|
0cfd143db0 | ||
|
|
fcd038924d | ||
|
|
cb36f04534 | ||
|
|
fbff945d5b | ||
|
|
dc04eb16fc | ||
|
|
a77fa414e5 | ||
|
|
0dbb5f53f1 | ||
|
|
b921a4d324 | ||
|
|
3ef80bd6c5 | ||
|
|
fb93c890ca | ||
|
|
19f0296718 | ||
|
|
38ec114fff | ||
|
|
212d09ef5a | ||
|
|
a679776f89 | ||
|
|
00cb80f173 | ||
|
|
60eb923f64 | ||
|
|
975f41d58e | ||
|
|
285a950c67 | ||
|
|
c4f91ead54 | ||
|
|
785a72cbc8 | ||
|
|
b475d1d5ea | ||
|
|
000d8fd436 | ||
|
|
061696e140 | ||
|
|
16b910f955 | ||
|
|
376cafa350 | ||
|
|
448aefb989 | ||
|
|
1059c92583 | ||
|
|
b68814795d | ||
|
|
2772c2f31f | ||
|
|
360f8066a7 | ||
|
|
b3991cf6bb | ||
|
|
daa4c76967 | ||
|
|
790b13f123 | ||
|
|
b08287f568 | ||
|
|
1d31f533f4 | ||
|
|
881a011493 | ||
|
|
707ac9db2c | ||
|
|
e385932bbc | ||
|
|
78da13fcab | ||
|
|
7f83263b63 | ||
|
|
04f6e11cbd | ||
|
|
f0a6fb111e | ||
|
|
48febec36a | ||
|
|
041b3c5e1f | ||
|
|
dbb6ea9147 | ||
|
|
6800b63945 | ||
|
|
b3dacdb1e6 | ||
|
|
404edaa4e1 | ||
|
|
367d44a4d3 | ||
|
|
32e58debc6 | ||
|
|
66ae86b6f5 | ||
|
|
7b1e4e9e3d | ||
|
|
93cc25b513 | ||
|
|
77cf4125dd | ||
|
|
54e47c09c4 | ||
|
|
dacd408f8d | ||
|
|
d31b2c7f97 | ||
|
|
926197b1ba | ||
|
|
668f477218 | ||
|
|
feb7b795e9 | ||
|
|
0f299993d9 | ||
|
|
e7ff09752e | ||
|
|
0dfbed4eb9 | ||
|
|
9bf17f27f0 | ||
|
|
678f2c2b5d | ||
|
|
840f9c6f57 | ||
|
|
9367be0fb1 | ||
|
|
fa05cf85ab | ||
|
|
56a165db54 | ||
|
|
9329330297 | ||
|
|
4d9f6ef416 | ||
|
|
55d37250aa | ||
|
|
bf3cb7c804 | ||
|
|
801515a8f4 | ||
|
|
83d88ad70a | ||
|
|
6f2971cf24 | ||
|
|
df3092b876 | ||
|
|
a49b1e5ac4 | ||
|
|
e3ba803247 | ||
|
|
543a82d0f9 | ||
|
|
26a974a239 | ||
|
|
e7ca3cf254 | ||
|
|
59edf4ffb7 | ||
|
|
0e4034ffac | ||
|
|
d0a723b8ef | ||
|
|
1c3bea4225 | ||
|
|
258f56759c | ||
|
|
d82945a735 | ||
|
|
de8e4a0ca3 | ||
|
|
2aa0e08ae4 | ||
|
|
8438c442b4 | ||
|
|
1d530ac2e9 | ||
|
|
9c5eb4bfd1 | ||
|
|
c74333719f | ||
|
|
819ef70b7b | ||
|
|
9f2801d289 | ||
|
|
b92a985cf8 | ||
|
|
c6db03ffa2 | ||
|
|
7ed1965f57 | ||
|
|
8df38e871a | ||
|
|
385307edc6 | ||
|
|
7ad96f54ca | ||
|
|
671b677569 | ||
|
|
3fa6b1fcc5 | ||
|
|
fd64ea07d0 | ||
|
|
359908041b | ||
|
|
fc5b8668e6 | ||
|
|
67409e1bf5 | ||
|
|
b6e90bb037 | ||
|
|
af5ef4d53c | ||
|
|
b4d01da68d | ||
|
|
9b4f80dfc5 | ||
|
|
f09fedb7c0 | ||
|
|
a73b74ceaa | ||
|
|
a49c63bc2b | ||
|
|
8118c68dce | ||
|
|
ef2291b9a9 | ||
|
|
bb65b566e5 | ||
|
|
881c1c2aa6 | ||
|
|
fcb9dd29f3 | ||
|
|
7cd0d2430d | ||
|
|
35016087d6 | ||
|
|
a5d72a0dfd | ||
|
|
b604e4ecc7 | ||
|
|
66814b403e | ||
|
|
95bc5e6b21 | ||
|
|
5047e6281a | ||
|
|
7ba1f2fdf4 | ||
|
|
21375bcb4d | ||
|
|
7bfb4f93bb | ||
|
|
c03e0cc954 | ||
|
|
b3b1fb30c7 | ||
|
|
2a7f9698d2 | ||
|
|
089810fb55 | ||
|
|
24866834e9 | ||
|
|
c3bb632a1a | ||
|
|
bda0f6a198 | ||
|
|
d00e3677f5 | ||
|
|
f95d34a1da | ||
|
|
0bb2b92853 | ||
|
|
31cb83a40c | ||
|
|
4746d3991e | ||
|
|
50591e9ed6 | ||
|
|
388a4f7630 | ||
|
|
c1d3209f2f | ||
|
|
837f7f310a | ||
|
|
f8e303f3a3 | ||
|
|
51749e8712 | ||
|
|
29b9e688a8 | ||
|
|
5b13de377b | ||
|
|
aa2da01401 | ||
|
|
9aa2b1b3bf | ||
|
|
b907d85a7e | ||
|
|
7e9132fcfe | ||
|
|
d76816eb9c | ||
|
|
d1098cfcae | ||
|
|
1e96878e5f | ||
|
|
19e9ff9cc8 | ||
|
|
6188944100 | ||
|
|
a03ce984f6 | ||
|
|
22a24b1b88 | ||
|
|
e33893d943 | ||
|
|
7a675e7b37 | ||
|
|
cb1921d28c | ||
|
|
585421c514 | ||
|
|
484736facd | ||
|
|
e6916acf45 | ||
|
|
d80b0d14ac | ||
|
|
db1ab7404b | ||
|
|
e73d9c1982 | ||
|
|
f7a731a193 | ||
|
|
e3a97d0071 | ||
|
|
d3ab402d94 | ||
|
|
b2bf5d2318 | ||
|
|
480cc67927 | ||
|
|
a52a687493 | ||
|
|
634ee9b4b3 | ||
|
|
49ad9812a4 | ||
|
|
c782305456 | ||
|
|
ca3dadfb35 | ||
|
|
99a091ec61 | ||
|
|
26bddf3c53 | ||
|
|
a145935366 | ||
|
|
f6d4f940a3 | ||
|
|
4737c71ae1 | ||
|
|
90e03e6d1e | ||
|
|
3637b95f8f | ||
|
|
b3a0899f4f | ||
|
|
ebc78d63ac | ||
|
|
7e48f1bba1 | ||
|
|
aab62e4b03 | ||
|
|
6cea02252e | ||
|
|
8e72983304 | ||
|
|
b5683aed2a | ||
|
|
228dcf8aa5 | ||
|
|
457628b996 | ||
|
|
5ea276398f | ||
|
|
d342a7b621 | ||
|
|
b70ab5a4c3 | ||
|
|
6cb3357f08 | ||
|
|
99f4fe2e43 | ||
|
|
0ded76d366 | ||
|
|
a737fed5cb | ||
|
|
79cadadcc7 | ||
|
|
75922e603b | ||
|
|
d0eee796ba | ||
|
|
47d6fd5d31 | ||
|
|
4120318ec4 | ||
|
|
4349959daa | ||
|
|
549224ac16 | ||
|
|
d45e303d55 | ||
|
|
85106667a2 | ||
|
|
371ab944b3 | ||
|
|
2d49c73023 | ||
|
|
92a0d8ccc9 | ||
|
|
7dfc09ff16 | ||
|
|
61d6ddfa81 | ||
|
|
06ba1fd17b | ||
|
|
f1c31a70bc | ||
|
|
7799e6626f | ||
|
|
aa79c1bfd7 | ||
|
|
7451b0d1e3 | ||
|
|
18d4c68025 | ||
|
|
a7887f0b1c | ||
|
|
fa14b7b1a9 | ||
|
|
2776f113cb | ||
|
|
0bf8e55144 | ||
|
|
87c68df0f6 | ||
|
|
f551242e86 | ||
|
|
31258a9b85 | ||
|
|
a8937bd8b1 | ||
|
|
fa3306b0f4 | ||
|
|
4824ccafd6 | ||
|
|
f40cdb62ba | ||
|
|
8c6e1a579f | ||
|
|
95022578ba | ||
|
|
99999eae5d | ||
|
|
2eb09c1853 | ||
|
|
99ebb81838 | ||
|
|
6d6f7293f9 | ||
|
|
9cd50833cf | ||
|
|
c1cbc0d30c | ||
|
|
ed6e28744e | ||
|
|
28e5b2f65e | ||
|
|
4879bdb527 | ||
|
|
7ebf237c1c | ||
|
|
21d984969a | ||
|
|
b3adedca0b | ||
|
|
f6cca7df92 | ||
|
|
1737e61d60 | ||
|
|
dae04c5a2f | ||
|
|
7b2f8fa5e1 | ||
|
|
11a52c3f43 | ||
|
|
d61d5e9631 | ||
|
|
2e61de5297 | ||
|
|
b7936d77f5 | ||
|
|
184009bc4b | ||
|
|
8369b857da | ||
|
|
585692cae3 | ||
|
|
56950bc274 | ||
|
|
e132434846 | ||
|
|
5abb94f187 | ||
|
|
a2dbfed19c | ||
|
|
7dd4d8ae86 | ||
|
|
6c8e84eed4 | ||
|
|
14e7a68c32 | ||
|
|
71a97e047a | ||
|
|
35aa19853c | ||
|
|
caf8d0c826 | ||
|
|
43c8842dc6 | ||
|
|
9e25904dc9 | ||
|
|
585bf84af4 | ||
|
|
620cd8b06b | ||
|
|
828ac2f383 | ||
|
|
9f1c2e4e5f | ||
|
|
72de0a6e4d | ||
|
|
3342a22cc7 | ||
|
|
fff0ca5c79 | ||
|
|
bd069200ea | ||
|
|
c898f1e62a | ||
|
|
81a62373f8 | ||
|
|
2002e1c38d | ||
|
|
e7b0bb53b9 | ||
|
|
1f817df5f6 | ||
|
|
49daf5719b | ||
|
|
ee9cdc51c0 | ||
|
|
b7a34ec81a | ||
|
|
9178fd74a9 | ||
|
|
fe9803b828 | ||
|
|
56df0caab0 | ||
|
|
ff31ef912e | ||
|
|
360d378c33 | ||
|
|
be65b93d59 | ||
|
|
de89f03f13 | ||
|
|
cbb5d1d048 | ||
|
|
2cb6bdb38b | ||
|
|
da687041af | ||
|
|
52c1394ce2 | ||
|
|
cf2ebdad63 | ||
|
|
dbb309eaa0 | ||
|
|
8fd082ad80 | ||
|
|
a578384e85 | ||
|
|
eed32a3bd9 | ||
|
|
0bb9940d05 | ||
|
|
ea0ef20979 | ||
|
|
85b0627737 | ||
|
|
bdd1b8fa21 | ||
|
|
51c873c19e | ||
|
|
161814a9e5 | ||
|
|
1be9c7f95d | ||
|
|
99c8cc0242 | ||
|
|
b309d686ec | ||
|
|
36ec67cef9 | ||
|
|
35f97e08dd | ||
|
|
272bed1351 | ||
|
|
8eced6c575 | ||
|
|
afcf6eab71 | ||
|
|
9633412ef6 | ||
|
|
8034e7f587 | ||
|
|
5be01e1c18 | ||
|
|
6371773416 | ||
|
|
52230edc5c | ||
|
|
dd123c6a99 | ||
|
|
5b2a0fdcb1 | ||
|
|
9354af3bc7 | ||
|
|
f48f331d43 | ||
|
|
696261d749 | ||
|
|
0e9d036fe0 | ||
|
|
8e19fe2fb5 | ||
|
|
861b690217 | ||
|
|
f7c9541f5e | ||
|
|
05b5ae8a84 | ||
|
|
2e9c14a0a8 | ||
|
|
3350cec589 | ||
|
|
bd7a42646b | ||
|
|
2ae4ddee18 | ||
|
|
2fb6e2b209 | ||
|
|
91f869b136 | ||
|
|
1284a97625 | ||
|
|
3a5cfbf36f | ||
|
|
47b8ecd43b | ||
|
|
25ce1a4689 | ||
|
|
a5156709ab | ||
|
|
fd2d37d862 | ||
|
|
87bf433e9a | ||
|
|
b5ec79daae | ||
|
|
3b19200997 | ||
|
|
0ab040080c | ||
|
|
5719896d18 | ||
|
|
e9e1cb6ebc | ||
|
|
ceee6a7e74 | ||
|
|
ebfc6d4fa5 | ||
|
|
0d62557a15 | ||
|
|
097c09328f | ||
|
|
732103292b | ||
|
|
3191e9b450 | ||
|
|
bf88fdbb31 | ||
|
|
4c3fb5e762 | ||
|
|
e4b6f4ff0d | ||
|
|
ca0b0d4602 | ||
|
|
d7c3779ff7 | ||
|
|
f0d40eea15 | ||
|
|
68dcc1c86a | ||
|
|
f7dcab3736 | ||
|
|
2fcb476c50 | ||
|
|
44a7cd62c8 | ||
|
|
f7f0f8251b | ||
|
|
395b81a6ac | ||
|
|
da06ed1185 | ||
|
|
67afbd6a77 | ||
|
|
8fce53b4af | ||
|
|
65bba23519 | ||
|
|
283b497788 | ||
|
|
8cc1b8daa8 | ||
|
|
9ccdb45a7a | ||
|
|
f78d360c38 | ||
|
|
6144fbe856 | ||
|
|
8446be7646 | ||
|
|
8875ab1e93 | ||
|
|
7c207a50e1 | ||
|
|
dcc32479ff | ||
|
|
09911c472d | ||
|
|
7a0149ee23 | ||
|
|
3ae8cf32b0 | ||
|
|
11cf947bbb | ||
|
|
60a20f61af | ||
|
|
e65c7b6bcf | ||
|
|
80c892aca3 | ||
|
|
39ee266598 | ||
|
|
aa58d7744e | ||
|
|
ea3b0b3712 | ||
|
|
d9d8707123 | ||
|
|
8e9a1e2ba5 | ||
|
|
e29b4865e8 | ||
|
|
4b60ca175d | ||
|
|
2fbbc7b5a9 | ||
|
|
633dbb82d3 | ||
|
|
95907b3cea | ||
|
|
14c210c771 | ||
|
|
00e7fcc46b | ||
|
|
720efcbcbf | ||
|
|
d95791cc18 | ||
|
|
d45b7af3b6 | ||
|
|
0ad3acaf07 | ||
|
|
e27818ecda | ||
|
|
ff21cf4d4c | ||
|
|
dc19c7fdec | ||
|
|
6c8ffd8ec6 | ||
|
|
96fdb210be | ||
|
|
84ad8e0d6e | ||
|
|
53361682f4 | ||
|
|
0ee243f284 | ||
|
|
26ff0b634f | ||
|
|
f44ab0f678 | ||
|
|
1f128747bb | ||
|
|
3bf975d90f | ||
|
|
92f8951be4 | ||
|
|
e071f56767 | ||
|
|
c85619efcf | ||
|
|
27f9ae1e56 | ||
|
|
7449102d95 | ||
|
|
234a2c71b5 | ||
|
|
4dd5533202 | ||
|
|
a4d1740754 | ||
|
|
1a2ea1c38a | ||
|
|
371ec9b8d5 | ||
|
|
5e288d57ea | ||
|
|
61bd5b3484 | ||
|
|
bb974e10f5 | ||
|
|
4ed1335f89 | ||
|
|
4274c7afdb | ||
|
|
27f67142c8 | ||
|
|
ac8aba6ba4 | ||
|
|
07ff61c070 | ||
|
|
3645ac6704 | ||
|
|
9764719245 | ||
|
|
b3aeed7fc1 | ||
|
|
5ae5d8546e | ||
|
|
d190d8b1af | ||
|
|
c45538684d | ||
|
|
575e7bf4c4 | ||
|
|
a4338d8472 | ||
|
|
7d542cf115 | ||
|
|
9c9a542bbe | ||
|
|
b6c56551bc | ||
|
|
1379228196 | ||
|
|
d6e19b9273 | ||
|
|
5e0e4051dc | ||
|
|
8caf3a0a7b | ||
|
|
96ae97664c | ||
|
|
901b121695 | ||
|
|
3e88c9f0c7 | ||
|
|
94f5c130bf | ||
|
|
eb04c3f113 | ||
|
|
8ece6fb998 | ||
|
|
794213b5c6 | ||
|
|
ef4a9ab66b | ||
|
|
86e978faad | ||
|
|
d5d8f2a318 | ||
|
|
4ca1fad335 | ||
|
|
0edf6bdcb1 | ||
|
|
c2839ddd56 | ||
|
|
28581f88b2 | ||
|
|
833c625d18 | ||
|
|
6e2a3a410a | ||
|
|
3e85af9589 | ||
|
|
589dec52a3 | ||
|
|
a5477509bd | ||
|
|
5d951a96b5 | ||
|
|
76552f6ae5 | ||
|
|
e153515847 | ||
|
|
3bc692d894 | ||
|
|
73360d66cd | ||
|
|
04575d8051 | ||
|
|
9aba51cb45 | ||
|
|
1172b6c871 | ||
|
|
240f01f378 | ||
|
|
5975117636 | ||
|
|
51b285f665 | ||
|
|
b3958d4735 | ||
|
|
128119d494 | ||
|
|
324dc01699 | ||
|
|
f11d468e31 | ||
|
|
aa5ed13752 | ||
|
|
10ce7da18d | ||
|
|
73bd55dfac | ||
|
|
db10f81d53 | ||
|
|
717aac4438 | ||
|
|
077a464481 | ||
|
|
9bf18592fc | ||
|
|
677e196c96 | ||
|
|
19e6896f0d | ||
|
|
ba537baab2 | ||
|
|
2b8b6b086b | ||
|
|
cf3ec2b601 | ||
|
|
35eaa7852c | ||
|
|
b87558d301 | ||
|
|
9f1003e94e | ||
|
|
73c003907b | ||
|
|
b65d292af4 | ||
|
|
43bdbf1018 | ||
|
|
ec7986420d | ||
|
|
0b23153316 | ||
|
|
ad4f5e5e65 | ||
|
|
1d48532146 | ||
|
|
950803b2aa | ||
|
|
a41d92f4da | ||
|
|
70d4eb393f | ||
|
|
9f162127d0 | ||
|
|
4cd30dabc4 | ||
|
|
8f78728863 | ||
|
|
e7c5d33d50 | ||
|
|
5400f31acb | ||
|
|
e58f1d778e | ||
|
|
5f5db2011e | ||
|
|
aea4d89f62 | ||
|
|
ccda17d704 | ||
|
|
4ab6c438cf | ||
|
|
219e63c226 | ||
|
|
ee1e4623a3 | ||
|
|
5982212903 | ||
|
|
32e6ecb12d | ||
|
|
3b774558f4 | ||
|
|
072171da18 | ||
|
|
8292221790 | ||
|
|
901954de33 | ||
|
|
286fe03500 | ||
|
|
9c4f02634b | ||
|
|
434f39de1f | ||
|
|
e72b543f38 | ||
|
|
826e818802 | ||
|
|
cbf846d32f | ||
|
|
55811a39a5 | ||
|
|
a81f5953fc | ||
|
|
bd09328ec2 | ||
|
|
17ecc88f80 | ||
|
|
7bc4c7b36e | ||
|
|
79189ac5d7 | ||
|
|
060c4e6e72 | ||
|
|
8f7c518487 | ||
|
|
12761cbfce | ||
|
|
2b30c273a4 | ||
|
|
03684a893d | ||
|
|
fef27111b9 | ||
|
|
b04ed66686 | ||
|
|
f5df8bca20 | ||
|
|
060af66c09 | ||
|
|
a6adbd61db | ||
|
|
bab58054f7 | ||
|
|
e27e990cd6 | ||
|
|
196c2e0ed8 | ||
|
|
499bd4328a | ||
|
|
e389047aaf | ||
|
|
da04ff284b | ||
|
|
10b48aed97 | ||
|
|
ac6e9ae994 | ||
|
|
7dd589fb6c | ||
|
|
6b930058d1 | ||
|
|
aef3495a79 | ||
|
|
da341a95c6 | ||
|
|
bca5ec6482 | ||
|
|
f0a0cb7269 | ||
|
|
238b7618b4 | ||
|
|
4f206f67c9 | ||
|
|
fa513bf784 | ||
|
|
a68b0b3878 | ||
|
|
249489e697 | ||
|
|
e2c67d7dae | ||
|
|
703bc310a7 | ||
|
|
4caecfa680 | ||
|
|
fd4fde2543 | ||
|
|
763c5de03f | ||
|
|
4e160a46dd | ||
|
|
56aaf18663 | ||
|
|
df841aed27 | ||
|
|
d4372a0332 | ||
|
|
1595da789d | ||
|
|
7e65cb1d19 | ||
|
|
a931ee7afb | ||
|
|
bc6944736e | ||
|
|
16c2e28e9c | ||
|
|
ab89ef8db3 | ||
|
|
9ef14d11f8 | ||
|
|
e753990da3 | ||
|
|
f469c2e65d | ||
|
|
0525501b87 | ||
|
|
3a37fd9d32 | ||
|
|
b095c9dfb9 | ||
|
|
cd00effcfe | ||
|
|
1cd0334ccd | ||
|
|
3b1a16844e | ||
|
|
6995e8a451 | ||
|
|
1dd0f319fc | ||
|
|
5ce96369cf | ||
|
|
0791d78e28 | ||
|
|
cecbb7c34e | ||
|
|
525daff5fe | ||
|
|
b2c51b4b8c | ||
|
|
ffddb05ba3 | ||
|
|
4bb81b9a41 | ||
|
|
3df4e8d2ba | ||
|
|
3edef873bc | ||
|
|
c04b5cb851 | ||
|
|
fabd717d92 | ||
|
|
945bcf5fad | ||
|
|
d35d755379 | ||
|
|
a2622cb38e | ||
|
|
b58fd78450 | ||
|
|
e8d32066b4 | ||
|
|
6d3779eb83 | ||
|
|
c7bed04c80 | ||
|
|
b0e956cfa9 | ||
|
|
8608b7cded | ||
|
|
23f1b4ac03 | ||
|
|
27900c214f | ||
|
|
704701e251 | ||
|
|
34c53d352a | ||
|
|
32026d1fd4 | ||
|
|
35cdce0d52 | ||
|
|
e59098cf61 | ||
|
|
d8ca480b19 | ||
|
|
803b123ade | ||
|
|
cffb673fba | ||
|
|
1f6535d61b | ||
|
|
8a5ebe83a3 | ||
|
|
cc17d61016 | ||
|
|
0547ff719c | ||
|
|
c130846fe8 | ||
|
|
b3adde3a7a | ||
|
|
54603002a6 | ||
|
|
b995cdfc32 | ||
|
|
b09546577a | ||
|
|
6e84c1dc4c | ||
|
|
f41f3aaba8 | ||
|
|
8fa61e4632 | ||
|
|
7dacd752d3 | ||
|
|
7439d2401d | ||
|
|
dfb1ee0c56 | ||
|
|
3da73b821d | ||
|
|
66b82ac10a | ||
|
|
058acc5042 | ||
|
|
cdf822291f | ||
|
|
3f9e872e1c | ||
|
|
94aa3067f6 | ||
|
|
bff8064597 | ||
|
|
6b2d4e2585 | ||
|
|
56dfc2ae82 | ||
|
|
535d5ee47f | ||
|
|
838905f3dd | ||
|
|
59f5208c5c | ||
|
|
32a1a715ea | ||
|
|
3755d3870e | ||
|
|
0edc8a9284 | ||
|
|
5449d63602 | ||
|
|
dfa72fd6af | ||
|
|
0e50da324b | ||
|
|
679f8118f6 | ||
|
|
804d177782 | ||
|
|
eb96c9fece | ||
|
|
ed6c50621c | ||
|
|
7f74de07ed | ||
|
|
9e5bf93580 | ||
|
|
9d685da12d | ||
|
|
6bb40eb502 | ||
|
|
1ceee572cf | ||
|
|
391ffea4ab | ||
|
|
5292e569d9 | ||
|
|
82e111f1be | ||
|
|
1e9b3a1e42 | ||
|
|
35520d85a2 | ||
|
|
e19e37eef4 | ||
|
|
814795f566 | ||
|
|
1a633dcf10 | ||
|
|
c9b0e66641 | ||
|
|
440ff2f3ea | ||
|
|
96be63f50b | ||
|
|
69a323691f | ||
|
|
4357fcf7ef | ||
|
|
5f79513617 | ||
|
|
ba3ccbbc9a | ||
|
|
f182436673 | ||
|
|
793b907fe6 | ||
|
|
c75dfcd499 | ||
|
|
29a48f7914 | ||
|
|
095a8aa9dd | ||
|
|
2d8b5f04e9 | ||
|
|
ba9f97bc3e | ||
|
|
ed51f44ee8 | ||
|
|
933d787108 | ||
|
|
0bc12733a3 | ||
|
|
8cfd9c44ab | ||
|
|
3ddff84be0 | ||
|
|
afb5361a1b | ||
|
|
f376047632 | ||
|
|
7373eea842 | ||
|
|
a446df4620 | ||
|
|
306c6dd21d | ||
|
|
380ba8860c | ||
|
|
6c8c8ddcfc | ||
|
|
0c09c5e140 | ||
|
|
b761fba8cb | ||
|
|
dfceda3942 | ||
|
|
85d1825236 | ||
|
|
8f8c7e26c7 | ||
|
|
181768d91f | ||
|
|
2dcd4d8fd3 | ||
|
|
d909550134 | ||
|
|
c564ec41e2 | ||
|
|
af94a0e174 | ||
|
|
fcd8815fca | ||
|
|
5bd3f28117 | ||
|
|
384bde333e | ||
|
|
d06ec604b9 | ||
|
|
d8ce23f2a0 | ||
|
|
3ccb983377 | ||
|
|
19fb9fcd31 | ||
|
|
5f4a1b96ce | ||
|
|
6983f385fc | ||
|
|
2aadd1cac5 | ||
|
|
bfa7d429bd | ||
|
|
3238150b92 | ||
|
|
3603571967 | ||
|
|
7c2a8c0abb | ||
|
|
8b5f73badd | ||
|
|
ff57fd3d23 | ||
|
|
49aa1ea17c | ||
|
|
7430897085 | ||
|
|
82894a1c4f | ||
|
|
3bb4217a45 | ||
|
|
dfc8330035 | ||
|
|
45e03d87c7 | ||
|
|
3e358e5d26 | ||
|
|
dc5dae04eb | ||
|
|
9128b1f47d | ||
|
|
16a8226ba7 | ||
|
|
9ecaf3199d | ||
|
|
a44cd0373e | ||
|
|
2c0b629302 | ||
|
|
89a37a1771 | ||
|
|
cadc038966 | ||
|
|
07e8449379 | ||
|
|
71e908ad1a | ||
|
|
035c85b775 | ||
|
|
a87b753151 | ||
|
|
edaa4aff7e | ||
|
|
be02610349 | ||
|
|
1f65731165 | ||
|
|
fb61fb7849 | ||
|
|
060a945aea | ||
|
|
2797250f34 | ||
|
|
97b3f9b3c7 | ||
|
|
9363301d2a | ||
|
|
d93a826e28 | ||
|
|
244fe0835e | ||
|
|
5f1a5d6589 | ||
|
|
4e27c22292 | ||
|
|
53ee270096 | ||
|
|
a00ad20c08 | ||
|
|
e8764dd1c6 | ||
|
|
a869d38499 | ||
|
|
7bf7c96587 | ||
|
|
72b857a92f | ||
|
|
380d6a43a5 | ||
|
|
076f2b492e | ||
|
|
547f981c47 | ||
|
|
8bfc62a3b2 | ||
|
|
d39776a314 | ||
|
|
35641d0543 | ||
|
|
038cd6f149 | ||
|
|
38978dd447 | ||
|
|
fb24b7eaa7 | ||
|
|
b4ce45bc4b | ||
|
|
8d04198309 | ||
|
|
da796347c4 | ||
|
|
2d6a29664a | ||
|
|
4ba5cfceaf | ||
|
|
7cc324e1c0 | ||
|
|
cf89601269 | ||
|
|
c07e23bf8d | ||
|
|
5aa89d85f3 | ||
|
|
4ed1edf53d | ||
|
|
1be1326b52 | ||
|
|
42ae7d1568 | ||
|
|
b781c83545 | ||
|
|
e48cea18e7 | ||
|
|
ff82987144 | ||
|
|
f612a45550 | ||
|
|
182dce4840 | ||
|
|
4e41e072d6 | ||
|
|
a369c16db8 | ||
|
|
1fc820787a | ||
|
|
d3a83ba89e | ||
|
|
20fb66e2f7 | ||
|
|
a44646161b | ||
|
|
87027ea2d0 | ||
|
|
c9757cbb4b | ||
|
|
9a8f4aefe0 | ||
|
|
3545b80050 | ||
|
|
379855714e | ||
|
|
ff06cd7643 | ||
|
|
ade3952016 | ||
|
|
f246516a6e | ||
|
|
c296bf4178 | ||
|
|
1568554a1c | ||
|
|
ae66be197e | ||
|
|
3e904aa160 | ||
|
|
64c1440c46 | ||
|
|
f069a41390 | ||
|
|
d4a33e2290 | ||
|
|
7ee5bcecff | ||
|
|
48f6ee8846 | ||
|
|
7a24f52782 | ||
|
|
324d46120b | ||
|
|
87baec5ff8 | ||
|
|
b2e144f35c | ||
|
|
87a8e25662 | ||
|
|
8e88f00fb2 | ||
|
|
d14505d59a | ||
|
|
1e6d4347fa | ||
|
|
b8d9a8c072 | ||
|
|
fd15ae5e8c | ||
|
|
fb6377414b | ||
|
|
9a5dbe055e | ||
|
|
42dd280aca | ||
|
|
41b2946cdc | ||
|
|
a90f0f2c59 | ||
|
|
4222c0e53b | ||
|
|
ee0f0f0be0 | ||
|
|
f8d874453c | ||
|
|
aa891489f0 | ||
|
|
4c69b059d4 | ||
|
|
359bd9f762 | ||
|
|
2de0b61726 | ||
|
|
d75163aa57 | ||
|
|
e49f30641e | ||
|
|
1631c2c342 | ||
|
|
cf7de369b2 | ||
|
|
78c03d8f2f | ||
|
|
876320b849 | ||
|
|
a1d13f8ff3 | ||
|
|
3c19bdfaa9 | ||
|
|
4fa895086e | ||
|
|
9945d8debb | ||
|
|
4362de2198 | ||
|
|
a5c5879e4f | ||
|
|
1a57f4f33d | ||
|
|
a99e173168 | ||
|
|
e02a28f61e | ||
|
|
26d3ff97ce | ||
|
|
57fb3c9785 | ||
|
|
edeb970a82 | ||
|
|
e17baddf01 | ||
|
|
a277d36696 | ||
|
|
6c9e86e17a | ||
|
|
e75ef21eb6 | ||
|
|
04e5443b82 | ||
|
|
8b4cdf3b9b | ||
|
|
37f1620f7c | ||
|
|
b0a0e805cf | ||
|
|
c619e253a2 | ||
|
|
2bd111f1e2 | ||
|
|
40174b50eb | ||
|
|
e0fe28717f | ||
|
|
ac5fc22043 | ||
|
|
e30f196dad | ||
|
|
9e4e1ce8ec | ||
|
|
f710898844 | ||
|
|
94633484ca | ||
|
|
0817c2589f | ||
|
|
8a99386b33 | ||
|
|
52d6a563d6 | ||
|
|
d0a5ae1da4 | ||
|
|
783c00a1d9 | ||
|
|
bc70ec8b07 | ||
|
|
50e1efe5d7 | ||
|
|
d8629e53f1 | ||
|
|
cc9df1dabb | ||
|
|
cd6cb8182e | ||
|
|
5b0e90e5b9 | ||
|
|
3c3bbc84b3 | ||
|
|
23615cff4f | ||
|
|
daadc6cb68 | ||
|
|
e157a2a36b | ||
|
|
d8d7debfee | ||
|
|
a82b206fe6 | ||
|
|
a4416214c8 | ||
|
|
8fe75cd210 | ||
|
|
303effebbc | ||
|
|
f32a34190d | ||
|
|
8588ef1d8a | ||
|
|
51ec4821f3 | ||
|
|
957033a7bb | ||
|
|
62c74deac3 | ||
|
|
29fd448998 | ||
|
|
e55cb08a6a | ||
|
|
047359e8dc | ||
|
|
eb814e181a | ||
|
|
857031ff5a | ||
|
|
d5eeb68714 | ||
|
|
966b287026 | ||
|
|
a348729109 | ||
|
|
1f29b7733e | ||
|
|
e26ae30f6f | ||
|
|
547943a05c | ||
|
|
46aa229531 | ||
|
|
28bd796289 | ||
|
|
6a3f82ed7e | ||
|
|
523f3301c0 | ||
|
|
f085343a99 | ||
|
|
f76a924700 | ||
|
|
f8e3b76a4a | ||
|
|
b8f1e8a7ef | ||
|
|
d007fc49d8 | ||
|
|
f6d8ebd8d3 | ||
|
|
6ff9c4578a | ||
|
|
33acfe1464 | ||
|
|
f5eeb16bb1 | ||
|
|
c35c5faaa4 | ||
|
|
8425ebc13f | ||
|
|
6fc37a4298 | ||
|
|
99f3e77c12 | ||
|
|
a9c087c45f | ||
|
|
3f4333087f | ||
|
|
e1ac29683d | ||
|
|
5c74cbfe19 | ||
|
|
3fdb3fa673 | ||
|
|
ba584974cb | ||
|
|
bddd6408ac | ||
|
|
413ad66a07 | ||
|
|
0ef5d884cc | ||
|
|
f6b6d23e93 | ||
|
|
50be69f3d3 | ||
|
|
5a75e4d5e6 | ||
|
|
ec463df9d6 | ||
|
|
b648334323 | ||
|
|
916972aeb1 | ||
|
|
3893e01af9 | ||
|
|
7835f32c8b | ||
|
|
37302244ee | ||
|
|
f1be7ddb83 | ||
|
|
7447a65a83 | ||
|
|
129009d602 | ||
|
|
c656bd6f4b | ||
|
|
36528d7484 | ||
|
|
f9c85b6a67 | ||
|
|
4dfe6bdbe8 | ||
|
|
ee343f2fa1 | ||
|
|
1a1f5f85b2 | ||
|
|
bd64b0c884 | ||
|
|
e1c8928ed9 | ||
|
|
1f98940445 | ||
|
|
707aa22a6d | ||
|
|
32da15fa8a | ||
|
|
97cd6e289a | ||
|
|
def6576fb9 | ||
|
|
196c10b253 | ||
|
|
cfdca38d59 | ||
|
|
ccd90a69ee | ||
|
|
c16f962d2b | ||
|
|
8fccf69ceb | ||
|
|
adc8833670 | ||
|
|
ecbf90ded8 | ||
|
|
c5d2d7782a | ||
|
|
72dae22ef4 | ||
|
|
9a9cd41009 | ||
|
|
0c4c8162c2 | ||
|
|
d47cc5d5f4 | ||
|
|
cb942e512d | ||
|
|
bd0a479645 | ||
|
|
cd0da914f4 | ||
|
|
7a7e72897a | ||
|
|
c1542054c9 | ||
|
|
250e67e7ae | ||
|
|
cdbe839b35 | ||
|
|
240a77dcce | ||
|
|
1dc5bb8bd1 | ||
|
|
23534da27d | ||
|
|
8652d4031c | ||
|
|
384e311c7a | ||
|
|
2791f88b4c | ||
|
|
402d5af19a | ||
|
|
b554d8c19c | ||
|
|
7d9dd64303 | ||
|
|
41bea8931f | ||
|
|
f83d8de476 | ||
|
|
af2a652098 | ||
|
|
a3c911263d | ||
|
|
836c677837 | ||
|
|
7e4dbfdd7e | ||
|
|
6eda556242 | ||
|
|
3ea454c7ed | ||
|
|
9123d7014d | ||
|
|
3ea3abe81a | ||
|
|
7289c3d7f9 | ||
|
|
d00e1df29c | ||
|
|
16a18c4f22 | ||
|
|
30b156d92f | ||
|
|
931f9d33e4 | ||
|
|
e61fe4d092 | ||
|
|
5bc33ac654 | ||
|
|
878ba5a869 | ||
|
|
92632b2b96 | ||
|
|
d803a9e298 | ||
|
|
b9f67533dd | ||
|
|
7ade78bedf | ||
|
|
b4eca48f4d | ||
|
|
2cf8e317fa | ||
|
|
821a422ab5 | ||
|
|
91c7b4f2cd | ||
|
|
adb43ec5b3 | ||
|
|
c9721d7bc9 | ||
|
|
bbc2b8a396 | ||
|
|
54cfa67d52 | ||
|
|
9b72b3e332 | ||
|
|
c03919be2d | ||
|
|
706cc6f49c | ||
|
|
10c7e81e02 | ||
|
|
03637b2d4d | ||
|
|
b7218a05be | ||
|
|
a2cd57d9c6 | ||
|
|
001849eeaa | ||
|
|
bf09a70096 | ||
|
|
530aec92a9 | ||
|
|
deb8f2a0b7 | ||
|
|
5c247e3d2c | ||
|
|
04b9a070c4 | ||
|
|
dd2caf720c | ||
|
|
0d16a7aab0 | ||
|
|
31325d0999 | ||
|
|
6f99784224 | ||
|
|
201e6f7e7b | ||
|
|
c4d41134b8 | ||
|
|
680c92ecec | ||
|
|
deb07d2b7f | ||
|
|
3a14fc373a | ||
|
|
29e429a02e | ||
|
|
907a0ee135 | ||
|
|
22a03f77ab | ||
|
|
9761b10bf6 | ||
|
|
c364d3fdca | ||
|
|
07ad5756eb | ||
|
|
6e401eecde | ||
|
|
f32e259d2f | ||
|
|
83ed0e6454 | ||
|
|
da568e4ea5 | ||
|
|
ad819bf3ba | ||
|
|
b502ebd23a | ||
|
|
7c5d94c19e | ||
|
|
a16b5f4644 | ||
|
|
f3cb8c531b | ||
|
|
469e696ab7 | ||
|
|
d99ccd9df6 | ||
|
|
3b3118d764 | ||
|
|
84386847e2 | ||
|
|
0da3d100b3 | ||
|
|
56d621bab8 | ||
|
|
f1571b5f66 | ||
|
|
55f8e179af | ||
|
|
ab5289a136 | ||
|
|
e05c48979d | ||
|
|
24c880343b | ||
|
|
b3b4ee7a28 | ||
|
|
e26b440a66 | ||
|
|
d6194316e1 | ||
|
|
341148612f | ||
|
|
79864e97d6 | ||
|
|
ed5e66e430 | ||
|
|
074a861fb4 | ||
|
|
b88656829e | ||
|
|
aefe6a5943 | ||
|
|
3d743f8498 | ||
|
|
0186fff67d | ||
|
|
38f61cdf75 | ||
|
|
84366002db | ||
|
|
eff5bb74b5 | ||
|
|
2614088fae | ||
|
|
3699e04db9 | ||
|
|
0dca009c01 | ||
|
|
1b39eb1a23 | ||
|
|
2637aebb7f | ||
|
|
8afcfde078 | ||
|
|
9ea1eaf3ed | ||
|
|
66d06afaf7 | ||
|
|
cffcca9722 | ||
|
|
fe2b9774d8 | ||
|
|
3d02fabef4 | ||
|
|
f89c2b1f63 | ||
|
|
ee755d5a6c | ||
|
|
65e2ecf88e | ||
|
|
332ec69ee8 | ||
|
|
1ce30f8431 | ||
|
|
3ae6944307 | ||
|
|
52533d4b38 | ||
|
|
38409d9336 | ||
|
|
d344e513c4 | ||
|
|
9af7f67930 | ||
|
|
f95d938fb6 | ||
|
|
f74a7e87bd | ||
|
|
d3fce5fc89 | ||
|
|
14f3f3d2ac | ||
|
|
127d5b97c4 | ||
|
|
7ef1c097e8 | ||
|
|
80e3116cd8 | ||
|
|
46bac55bb3 | ||
|
|
2cadafd5c1 | ||
|
|
bb27dca21c | ||
|
|
86fc9fbffa | ||
|
|
9bdbfc6f4f | ||
|
|
28a7d9c62b | ||
|
|
2ca344b17c | ||
|
|
1bf2278f31 | ||
|
|
6188ab0d30 | ||
|
|
f016b53013 | ||
|
|
127cd3e843 | ||
|
|
457dbe5831 | ||
|
|
8d73fb1161 | ||
|
|
af5746bb39 | ||
|
|
3f27d018c7 | ||
|
|
68402393b5 | ||
|
|
2ad33857f4 | ||
|
|
d3c7677dc7 | ||
|
|
73e92f9ef5 | ||
|
|
fcc8748daf | ||
|
|
312ee249b6 | ||
|
|
e4548f6961 | ||
|
|
1b93aac8c5 | ||
|
|
e7ed666037 | ||
|
|
85ca0683ed | ||
|
|
78689a23e5 | ||
|
|
ba63a55883 | ||
|
|
dc3d59bae1 | ||
|
|
0a851b935e | ||
|
|
ddc75d710f | ||
|
|
5482601b41 | ||
|
|
249aecbc0d | ||
|
|
03f3020e9f | ||
|
|
e151eb85f0 | ||
|
|
348586553e | ||
|
|
fb6e58b3c4 | ||
|
|
67e98456bb | ||
|
|
3e47420534 | ||
|
|
1d3d557c43 | ||
|
|
3f41974a75 | ||
|
|
3e3c7397a5 | ||
|
|
dcb51702e7 | ||
|
|
de0c9a1eff | ||
|
|
dd0c1e20a7 | ||
|
|
4769d75dc3 | ||
|
|
6b926dc697 | ||
|
|
ecae077c6d | ||
|
|
78ab1bed35 | ||
|
|
2b6dbfde6b | ||
|
|
6bb1abd7f0 | ||
|
|
aef92240cc | ||
|
|
f0d8c2d095 | ||
|
|
14529f2c35 | ||
|
|
89f40d54d9 | ||
|
|
4c006970a2 | ||
|
|
de676041df | ||
|
|
82b1567ae5 | ||
|
|
1cd7291068 | ||
|
|
fdee1df5b3 | ||
|
|
c314d00ccd | ||
|
|
62e2a8a6e3 | ||
|
|
a12231a0aa | ||
|
|
183efd427a | ||
|
|
f95f3126c3 | ||
|
|
4d9ca4b451 | ||
|
|
c76334a68a | ||
|
|
f475391ba6 | ||
|
|
b77f22790b | ||
|
|
757a578c6e | ||
|
|
c5824767c8 | ||
|
|
84f3f07279 | ||
|
|
f8e1892eee | ||
|
|
036a8edca0 | ||
|
|
58ed6f395f | ||
|
|
ef4be6a612 | ||
|
|
3d8e6f4394 | ||
|
|
0cc1f18a7e | ||
|
|
8b6e577b8f | ||
|
|
cc91f2e5db | ||
|
|
8d1f2313ac | ||
|
|
f9abd90cc9 | ||
|
|
f7293255cf | ||
|
|
7d6a130cf9 | ||
|
|
be7bb2e39f | ||
|
|
1c30728880 | ||
|
|
8d91e7cb1d | ||
|
|
68d980795a | ||
|
|
45c11a5a8e | ||
|
|
4d00351db7 | ||
|
|
fff420b652 | ||
|
|
7103a95305 | ||
|
|
bcada5d553 | ||
|
|
c9b24ff612 | ||
|
|
854c7ed04d | ||
|
|
c0054959cd | ||
|
|
1aa837d220 | ||
|
|
95df402c4c | ||
|
|
2f3d6f7e63 | ||
|
|
ffe1523170 | ||
|
|
a73d5f4b4d | ||
|
|
f35b62ed12 | ||
|
|
20abdd2908 | ||
|
|
28c2c7285c | ||
|
|
3ca8ab12a4 | ||
|
|
fd82aa143c | ||
|
|
1fcbd4f9fd | ||
|
|
73d9cd62a5 | ||
|
|
be699d24a1 | ||
|
|
798eb90bed | ||
|
|
c252f5f8d9 | ||
|
|
76d77ad76f | ||
|
|
69f5cdd61a | ||
|
|
9f52f20660 | ||
|
|
90048afa9d | ||
|
|
1ec3ed32ee | ||
|
|
16ed5821e2 | ||
|
|
b681e33944 | ||
|
|
8f4d44a212 | ||
|
|
93a5d07f9a | ||
|
|
40c230c7db | ||
|
|
d0fa3b92f8 | ||
|
|
2a7727cf5f | ||
|
|
98722e7acf | ||
|
|
683fe4c3db | ||
|
|
e851696430 | ||
|
|
b2ccf965bb | ||
|
|
f847f38812 | ||
|
|
19039aa281 | ||
|
|
091b920a22 | ||
|
|
d7f264c1c2 | ||
|
|
897f8164b9 | ||
|
|
04a6f7c954 | ||
|
|
796287a776 | ||
|
|
763e30bd1d | ||
|
|
5121374d60 | ||
|
|
3e3a175bdc | ||
|
|
4a1aa9130b | ||
|
|
5a3f5f60b6 | ||
|
|
8c1600be55 | ||
|
|
7d3ae2347b | ||
|
|
27add47db4 | ||
|
|
836bcab036 | ||
|
|
2d20a07dfb | ||
|
|
24c5c70466 | ||
|
|
22ead22499 | ||
|
|
65e1620b43 | ||
|
|
acac09375e | ||
|
|
83cf859da3 | ||
|
|
956c391f13 | ||
|
|
7767a2607e | ||
|
|
429d1ac183 | ||
|
|
f42928f88f | ||
|
|
2d816ab92d | ||
|
|
aa75380662 | ||
|
|
3cf0ced62e | ||
|
|
41fa700fb3 | ||
|
|
a4ef9fb9b7 | ||
|
|
1db23b5277 | ||
|
|
584f0cbac0 | ||
|
|
dc432a19a3 | ||
|
|
6727b1cfca | ||
|
|
8c7b0698f3 | ||
|
|
69e1622e82 | ||
|
|
af7a5d3248 | ||
|
|
7b1a4554ad | ||
|
|
b3e213c133 | ||
|
|
a9fafec79d | ||
|
|
7cacf7bbaf | ||
|
|
44bf39f7b7 | ||
|
|
0db8f7295b | ||
|
|
c1226062b1 | ||
|
|
819ed168da | ||
|
|
19940953e2 | ||
|
|
f4af3eaf5d | ||
|
|
718563fe6a | ||
|
|
7e996ad6fa | ||
|
|
0b07fb6a49 | ||
|
|
0cb87e6ed9 | ||
|
|
71a3e75ae2 | ||
|
|
a2448ea4c1 | ||
|
|
8a14141021 | ||
|
|
69353892d9 | ||
|
|
7a2fcc3469 | ||
|
|
dfa6dd5011 | ||
|
|
654400c0cf | ||
|
|
3c15fc1b0d | ||
|
|
4b32485e3c | ||
|
|
b90736ed25 | ||
|
|
f28d5c7781 | ||
|
|
0654627478 | ||
|
|
2e91a2ecdb | ||
|
|
66a8ceb27a | ||
|
|
e6b0addb6c | ||
|
|
c00f132145 | ||
|
|
b9eb8d45b2 | ||
|
|
ec7ad70458 | ||
|
|
64e19699fb | ||
|
|
6d3e1b0cbe | ||
|
|
d3a53e1d3c | ||
|
|
23bbb3ee32 | ||
|
|
56bfcd52b7 | ||
|
|
1c19b6de1e | ||
|
|
85bed0bdf1 | ||
|
|
0102796769 | ||
|
|
50b2a72f1b | ||
|
|
04cc239756 | ||
|
|
0c20da2481 | ||
|
|
72d2a563f3 | ||
|
|
6f3f8c944d |
107
.cursor/rules/README.md
Normal file
107
.cursor/rules/README.md
Normal file
@@ -0,0 +1,107 @@
|
||||
# Evolution API Cursor Rules
|
||||
|
||||
Este diretório contém as regras e configurações do Cursor IDE para o projeto Evolution API.
|
||||
|
||||
## Estrutura dos Arquivos
|
||||
|
||||
### Arquivos Principais (alwaysApply: true)
|
||||
- **`core-development.mdc`** - Princípios fundamentais de desenvolvimento
|
||||
- **`project-context.mdc`** - Contexto específico do projeto Evolution API
|
||||
- **`cursor.json`** - Configurações do Cursor IDE
|
||||
|
||||
### Regras Especializadas (alwaysApply: false)
|
||||
Estas regras são ativadas automaticamente quando você trabalha nos arquivos correspondentes:
|
||||
|
||||
#### Camadas da Aplicação
|
||||
- **`specialized-rules/service-rules.mdc`** - Padrões para services (`src/api/services/`)
|
||||
- **`specialized-rules/controller-rules.mdc`** - Padrões para controllers (`src/api/controllers/`)
|
||||
- **`specialized-rules/dto-rules.mdc`** - Padrões para DTOs (`src/api/dto/`)
|
||||
- **`specialized-rules/guard-rules.mdc`** - Padrões para guards (`src/api/guards/`)
|
||||
- **`specialized-rules/route-rules.mdc`** - Padrões para routers (`src/api/routes/`)
|
||||
|
||||
#### Tipos e Validação
|
||||
- **`specialized-rules/type-rules.mdc`** - Definições TypeScript (`src/api/types/`)
|
||||
- **`specialized-rules/validate-rules.mdc`** - Schemas de validação (`src/validate/`)
|
||||
|
||||
#### Utilitários
|
||||
- **`specialized-rules/util-rules.mdc`** - Funções utilitárias (`src/utils/`)
|
||||
|
||||
#### Integrações
|
||||
- **`specialized-rules/integration-channel-rules.mdc`** - Integrações de canal (`src/api/integrations/channel/`)
|
||||
- **`specialized-rules/integration-chatbot-rules.mdc`** - Integrações de chatbot (`src/api/integrations/chatbot/`)
|
||||
- **`specialized-rules/integration-storage-rules.mdc`** - Integrações de storage (`src/api/integrations/storage/`)
|
||||
- **`specialized-rules/integration-event-rules.mdc`** - Integrações de eventos (`src/api/integrations/event/`)
|
||||
|
||||
## Como Usar
|
||||
|
||||
### Referências Cruzadas
|
||||
Os arquivos principais fazem referência aos especializados usando a sintaxe `@specialized-rules/nome-do-arquivo.mdc`. Quando você trabalha em um arquivo específico, o Cursor automaticamente carrega as regras relevantes.
|
||||
|
||||
### Exemplo de Uso
|
||||
Quando você edita um arquivo em `src/api/services/`, o Cursor automaticamente:
|
||||
1. Carrega `core-development.mdc` (sempre ativo)
|
||||
2. Carrega `project-context.mdc` (sempre ativo)
|
||||
3. Carrega `specialized-rules/service-rules.mdc` (ativado pelo glob pattern)
|
||||
|
||||
### Padrões de Código
|
||||
Cada arquivo de regras contém:
|
||||
- **Estruturas padrão** - Como organizar o código
|
||||
- **Padrões de nomenclatura** - Convenções de nomes
|
||||
- **Exemplos práticos** - Código de exemplo
|
||||
- **Anti-padrões** - O que evitar
|
||||
- **Testes** - Como testar o código
|
||||
- **Padrões de Commit** - Conventional Commits com commitlint
|
||||
|
||||
## Configuração do Cursor
|
||||
|
||||
O arquivo `cursor.json` contém:
|
||||
- Configurações de formatação
|
||||
- Padrões de código específicos do Evolution API
|
||||
- Diretórios principais do projeto
|
||||
- Integrações e tecnologias utilizadas
|
||||
|
||||
## Manutenção
|
||||
|
||||
Para manter as regras atualizadas:
|
||||
1. Analise novos padrões no código
|
||||
2. Atualize as regras especializadas correspondentes
|
||||
3. Mantenha os exemplos sincronizados com o código real
|
||||
4. Documente mudanças significativas
|
||||
|
||||
## Tecnologias Cobertas
|
||||
|
||||
- **Backend**: Node.js 20+ + TypeScript 5+ + Express.js
|
||||
- **Database**: Prisma ORM (PostgreSQL/MySQL)
|
||||
- **Cache**: Redis + Node-cache
|
||||
- **Queue**: RabbitMQ + Amazon SQS
|
||||
- **Real-time**: Socket.io
|
||||
- **Storage**: AWS S3 + Minio
|
||||
- **Validation**: JSONSchema7
|
||||
- **Logging**: Pino
|
||||
- **WhatsApp**: Baileys + Meta Business API
|
||||
- **Integrations**: Chatwoot, Typebot, OpenAI, Dify
|
||||
|
||||
## Estrutura do Projeto
|
||||
|
||||
```
|
||||
src/
|
||||
├── api/
|
||||
│ ├── controllers/ # Controllers (HTTP handlers)
|
||||
│ ├── services/ # Business logic
|
||||
│ ├── dto/ # Data Transfer Objects
|
||||
│ ├── guards/ # Authentication/Authorization
|
||||
│ ├── routes/ # Express routers
|
||||
│ ├── types/ # TypeScript definitions
|
||||
│ └── integrations/ # External integrations
|
||||
│ ├── channel/ # WhatsApp channels (Baileys, Business API)
|
||||
│ ├── chatbot/ # Chatbot integrations
|
||||
│ ├── event/ # Event integrations
|
||||
│ └── storage/ # Storage integrations
|
||||
├── cache/ # Cache implementations
|
||||
├── config/ # Configuration files
|
||||
├── utils/ # Utility functions
|
||||
├── validate/ # Validation schemas
|
||||
└── exceptions/ # Custom exceptions
|
||||
```
|
||||
|
||||
Este sistema de regras garante consistência no código e facilita o desenvolvimento seguindo os padrões estabelecidos do Evolution API.
|
||||
167
.cursor/rules/core-development.mdc
Normal file
167
.cursor/rules/core-development.mdc
Normal file
@@ -0,0 +1,167 @@
|
||||
---
|
||||
description: Core development principles and standards for Evolution API development
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Evolution API Development Standards
|
||||
|
||||
## Cross-References
|
||||
- **Project Context**: @project-context.mdc for Evolution API-specific patterns
|
||||
- **Specialized Rules**:
|
||||
- @specialized-rules/service-rules.mdc for service layer patterns
|
||||
- @specialized-rules/controller-rules.mdc for controller patterns
|
||||
- @specialized-rules/dto-rules.mdc for DTO validation patterns
|
||||
- @specialized-rules/guard-rules.mdc for authentication/authorization
|
||||
- @specialized-rules/route-rules.mdc for router patterns
|
||||
- @specialized-rules/type-rules.mdc for TypeScript definitions
|
||||
- @specialized-rules/util-rules.mdc for utility functions
|
||||
- @specialized-rules/validate-rules.mdc for validation schemas
|
||||
- @specialized-rules/integration-channel-rules.mdc for channel integrations
|
||||
- @specialized-rules/integration-chatbot-rules.mdc for chatbot integrations
|
||||
- @specialized-rules/integration-storage-rules.mdc for storage integrations
|
||||
- @specialized-rules/integration-event-rules.mdc for event integrations
|
||||
- **TypeScript/Node.js**: Node.js 20+ + TypeScript 5+ best practices
|
||||
- **Express/Prisma**: Express.js + Prisma ORM patterns
|
||||
- **WhatsApp Integrations**: Baileys + Meta Business API patterns
|
||||
|
||||
## Senior Engineer Context - Evolution API Platform
|
||||
- You are a senior software engineer working on a WhatsApp API platform
|
||||
- Focus on Node.js + TypeScript + Express.js full-stack development
|
||||
- Specialized in real-time messaging, WhatsApp integrations, and event-driven architecture
|
||||
- Apply scalable patterns for multi-tenant API platform
|
||||
- Consider WhatsApp integration workflow implications and performance at scale
|
||||
|
||||
## Fundamental Principles
|
||||
|
||||
### Code Quality Standards
|
||||
- **Simplicity First**: Always prefer simple solutions over complex ones
|
||||
- **DRY Principle**: Avoid code duplication - check for existing similar functionality before implementing
|
||||
- **Single Responsibility**: Each function/class should have one clear purpose
|
||||
- **Readable Code**: Write code that tells a story - clear naming and structure
|
||||
|
||||
### Problem Resolution Approach
|
||||
- **Follow Existing Patterns**: Use established Service patterns, DTOs, and Integration patterns
|
||||
- **Event-Driven First**: Leverage EventEmitter2 for event publishing when adding new features
|
||||
- **Integration Pattern**: Follow existing WhatsApp integration patterns for new channels
|
||||
- **Conservative Changes**: Prefer extending existing services over creating new architecture
|
||||
- **Clean Migration**: Remove deprecated patterns when introducing new ones
|
||||
- **Incremental Changes**: Break large changes into smaller, testable increments with proper migrations
|
||||
|
||||
### File and Function Organization - Node.js/TypeScript Structure
|
||||
- **Services**: Keep services focused and under 200 lines
|
||||
- **Controllers**: Keep controllers thin - only routing and validation
|
||||
- **DTOs**: Use JSONSchema7 for all input validation
|
||||
- **Integrations**: Follow `src/api/integrations/` structure for new integrations
|
||||
- **Utils**: Extract common functionality into well-named utilities
|
||||
- **Types**: Define clear TypeScript interfaces and types
|
||||
|
||||
### Code Analysis and Reflection
|
||||
- After writing code, deeply reflect on scalability and maintainability
|
||||
- Provide 1-2 paragraph analysis of code changes
|
||||
- Suggest improvements or next steps based on reflection
|
||||
- Consider performance, security, and maintenance implications
|
||||
|
||||
## Development Standards
|
||||
|
||||
### TypeScript Standards
|
||||
- **Strict Mode**: Always use TypeScript strict mode
|
||||
- **No Any**: Avoid `any` type - use proper typing
|
||||
- **Interfaces**: Define clear contracts with interfaces
|
||||
- **Enums**: Use enums for constants and status values
|
||||
- **Generics**: Use generics for reusable components
|
||||
|
||||
### Error Handling Standards
|
||||
- **HTTP Exceptions**: Use appropriate HTTP status codes
|
||||
- **Logging**: Structured logging with context
|
||||
- **Retry Logic**: Implement retry for external services
|
||||
- **Graceful Degradation**: Handle service failures gracefully
|
||||
|
||||
### Security Standards
|
||||
- **Input Validation**: Validate all inputs with JSONSchema7
|
||||
- **Authentication**: Use API keys and JWT tokens
|
||||
- **Rate Limiting**: Implement rate limiting for APIs
|
||||
- **Data Sanitization**: Sanitize sensitive data in logs
|
||||
|
||||
### Performance Standards
|
||||
- **Caching**: Use Redis for frequently accessed data
|
||||
- **Database**: Optimize Prisma queries with proper indexing
|
||||
- **Memory**: Monitor memory usage and implement cleanup
|
||||
- **Async**: Use async/await properly with error handling
|
||||
|
||||
## Communication Standards
|
||||
|
||||
### Language Requirements
|
||||
- **User Communication**: Always respond in Portuguese (PT-BR)
|
||||
- **Code Comments**: English for technical documentation
|
||||
- **API Documentation**: English for consistency
|
||||
- **Error Messages**: Portuguese for user-facing errors
|
||||
|
||||
### Documentation Standards
|
||||
- **Code Comments**: Document complex business logic
|
||||
- **API Documentation**: Document all public endpoints
|
||||
- **README**: Keep project documentation updated
|
||||
- **Changelog**: Document breaking changes
|
||||
|
||||
## Quality Assurance
|
||||
|
||||
### Testing Standards
|
||||
- **Unit Tests**: Test business logic in services
|
||||
- **Integration Tests**: Test API endpoints
|
||||
- **Mocks**: Mock external dependencies
|
||||
- **Coverage**: Aim for 70%+ test coverage
|
||||
|
||||
### Code Review Standards
|
||||
- **Peer Review**: All code must be reviewed
|
||||
- **Automated Checks**: ESLint, Prettier, TypeScript
|
||||
- **Security Review**: Check for security vulnerabilities
|
||||
- **Performance Review**: Check for performance issues
|
||||
|
||||
### Commit Standards (Conventional Commits)
|
||||
- **Format**: `type(scope): subject` (max 100 characters)
|
||||
- **Types**:
|
||||
- `feat` - New feature
|
||||
- `fix` - Bug fix
|
||||
- `docs` - Documentation changes
|
||||
- `style` - Code style changes (formatting, etc)
|
||||
- `refactor` - Code refactoring
|
||||
- `perf` - Performance improvements
|
||||
- `test` - Adding or updating tests
|
||||
- `chore` - Maintenance tasks
|
||||
- `ci` - CI/CD changes
|
||||
- `build` - Build system changes
|
||||
- `revert` - Reverting changes
|
||||
- `security` - Security fixes
|
||||
- **Examples**:
|
||||
- `feat(api): add WhatsApp message status endpoint`
|
||||
- `fix(baileys): resolve connection timeout issue`
|
||||
- `docs(readme): update installation instructions`
|
||||
- `refactor(service): extract common message validation logic`
|
||||
- **Tools**: Use `npm run commit` (Commitizen) for guided commits
|
||||
- **Validation**: Enforced by commitlint on commit-msg hook
|
||||
|
||||
## Evolution API Specific Patterns
|
||||
|
||||
### WhatsApp Integration Patterns
|
||||
- **Connection Management**: One connection per instance
|
||||
- **Event Handling**: Proper event listeners for Baileys
|
||||
- **Message Processing**: Queue-based message processing
|
||||
- **Error Recovery**: Automatic reconnection logic
|
||||
|
||||
### Multi-Database Support
|
||||
- **Schema Compatibility**: Support PostgreSQL and MySQL
|
||||
- **Migration Sync**: Keep migrations synchronized
|
||||
- **Type Safety**: Use Prisma generated types
|
||||
- **Connection Pooling**: Proper database connection management
|
||||
|
||||
### Cache Strategy
|
||||
- **Redis Primary**: Use Redis for distributed caching
|
||||
- **Local Fallback**: Node-cache for local fallback
|
||||
- **TTL Strategy**: Appropriate TTL for different data types
|
||||
- **Cache Invalidation**: Proper cache invalidation patterns
|
||||
|
||||
### Event System
|
||||
- **EventEmitter2**: Use for internal events
|
||||
- **WebSocket**: Socket.io for real-time updates
|
||||
- **Queue Systems**: RabbitMQ/SQS for async processing
|
||||
- **Webhook Processing**: Proper webhook validation and processing
|
||||
179
.cursor/rules/cursor.json
Normal file
179
.cursor/rules/cursor.json
Normal file
@@ -0,0 +1,179 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"description": "Cursor IDE configuration for Evolution API project",
|
||||
"rules": {
|
||||
"general": {
|
||||
"max_line_length": 120,
|
||||
"indent_size": 2,
|
||||
"end_of_line": "lf",
|
||||
"charset": "utf-8",
|
||||
"trim_trailing_whitespace": true,
|
||||
"insert_final_newline": true
|
||||
},
|
||||
"typescript": {
|
||||
"quotes": "single",
|
||||
"semi": true,
|
||||
"trailing_comma": "es5",
|
||||
"bracket_spacing": true,
|
||||
"arrow_parens": "avoid",
|
||||
"print_width": 120,
|
||||
"tab_width": 2,
|
||||
"use_tabs": false,
|
||||
"single_quote": true,
|
||||
"end_of_line": "lf",
|
||||
"strict": true,
|
||||
"no_implicit_any": true,
|
||||
"strict_null_checks": true
|
||||
},
|
||||
"javascript": {
|
||||
"quotes": "single",
|
||||
"semi": true,
|
||||
"trailing_comma": "es5",
|
||||
"bracket_spacing": true,
|
||||
"arrow_parens": "avoid",
|
||||
"print_width": 120,
|
||||
"tab_width": 2,
|
||||
"use_tabs": false,
|
||||
"single_quote": true,
|
||||
"end_of_line": "lf",
|
||||
"style_guide": "eslint-airbnb"
|
||||
},
|
||||
"json": {
|
||||
"tab_width": 2,
|
||||
"use_tabs": false,
|
||||
"parser": "json"
|
||||
},
|
||||
"ignore": {
|
||||
"files": [
|
||||
"node_modules/**",
|
||||
"dist/**",
|
||||
"build/**",
|
||||
".git/**",
|
||||
"*.min.js",
|
||||
"*.min.css",
|
||||
".env",
|
||||
".env.*",
|
||||
".env.example",
|
||||
"coverage/**",
|
||||
"*.log",
|
||||
"*.lock",
|
||||
"pnpm-lock.yaml",
|
||||
"package-lock.json",
|
||||
"yarn.lock",
|
||||
"log/**",
|
||||
"tmp/**",
|
||||
"instances/**",
|
||||
"public/uploads/**",
|
||||
"*.dump",
|
||||
"*.rdb",
|
||||
"*.mmdb",
|
||||
".DS_Store",
|
||||
"*.swp",
|
||||
"*.swo",
|
||||
"*.un~",
|
||||
".jest-cache",
|
||||
".idea/**",
|
||||
".vscode/**",
|
||||
".yalc/**",
|
||||
"yalc.lock",
|
||||
"*.local",
|
||||
"prisma/migrations/**",
|
||||
"prisma/mysql-migrations/**",
|
||||
"prisma/postgresql-migrations/**"
|
||||
]
|
||||
},
|
||||
"search": {
|
||||
"exclude_patterns": [
|
||||
"**/node_modules/**",
|
||||
"**/dist/**",
|
||||
"**/build/**",
|
||||
"**/.git/**",
|
||||
"**/coverage/**",
|
||||
"**/log/**",
|
||||
"**/tmp/**",
|
||||
"**/instances/**",
|
||||
"**/public/uploads/**",
|
||||
"**/*.min.js",
|
||||
"**/*.min.css",
|
||||
"**/*.log",
|
||||
"**/*.lock",
|
||||
"**/pnpm-lock.yaml",
|
||||
"**/package-lock.json",
|
||||
"**/yarn.lock",
|
||||
"**/*.dump",
|
||||
"**/*.rdb",
|
||||
"**/*.mmdb",
|
||||
"**/.DS_Store",
|
||||
"**/*.swp",
|
||||
"**/*.swo",
|
||||
"**/*.un~",
|
||||
"**/.jest-cache",
|
||||
"**/.idea/**",
|
||||
"**/.vscode/**",
|
||||
"**/.yalc/**",
|
||||
"**/yalc.lock",
|
||||
"**/*.local",
|
||||
"**/prisma/migrations/**",
|
||||
"**/prisma/mysql-migrations/**",
|
||||
"**/prisma/postgresql-migrations/**"
|
||||
]
|
||||
},
|
||||
"evolution_api": {
|
||||
"project_type": "nodejs_typescript_api",
|
||||
"backend_framework": "express_prisma",
|
||||
"database": ["postgresql", "mysql"],
|
||||
"cache": ["redis", "node_cache"],
|
||||
"queue": ["rabbitmq", "sqs"],
|
||||
"real_time": "socket_io",
|
||||
"file_storage": ["aws_s3", "minio"],
|
||||
"validation": "class_validator",
|
||||
"logging": "pino",
|
||||
"main_directories": {
|
||||
"source": "src/",
|
||||
"api": "src/api/",
|
||||
"controllers": "src/api/controllers/",
|
||||
"services": "src/api/services/",
|
||||
"integrations": "src/api/integrations/",
|
||||
"dto": "src/api/dto/",
|
||||
"types": "src/api/types/",
|
||||
"guards": "src/api/guards/",
|
||||
"routes": "src/api/routes/",
|
||||
"cache": "src/cache/",
|
||||
"config": "src/config/",
|
||||
"utils": "src/utils/",
|
||||
"exceptions": "src/exceptions/",
|
||||
"validate": "src/validate/",
|
||||
"prisma": "prisma/",
|
||||
"tests": "test/",
|
||||
"docs": "docs/"
|
||||
},
|
||||
"key_patterns": [
|
||||
"whatsapp_integration",
|
||||
"multi_database_support",
|
||||
"instance_management",
|
||||
"event_driven_architecture",
|
||||
"service_layer_pattern",
|
||||
"dto_validation",
|
||||
"webhook_processing",
|
||||
"message_queuing",
|
||||
"real_time_communication",
|
||||
"file_storage_integration"
|
||||
],
|
||||
"whatsapp_integrations": [
|
||||
"baileys",
|
||||
"meta_business_api",
|
||||
"whatsapp_cloud_api"
|
||||
],
|
||||
"external_integrations": [
|
||||
"chatwoot",
|
||||
"typebot",
|
||||
"openai",
|
||||
"dify",
|
||||
"rabbitmq",
|
||||
"sqs",
|
||||
"s3",
|
||||
"minio"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
174
.cursor/rules/project-context.mdc
Normal file
174
.cursor/rules/project-context.mdc
Normal file
@@ -0,0 +1,174 @@
|
||||
---
|
||||
description: Evolution API project-specific context and constraints
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Evolution API Project Context
|
||||
|
||||
## Cross-References
|
||||
- **Core Development**: @core-development.mdc for fundamental development principles
|
||||
- **Specialized Rules**: Reference specific specialized rules when working on:
|
||||
- Services: @specialized-rules/service-rules.mdc
|
||||
- Controllers: @specialized-rules/controller-rules.mdc
|
||||
- DTOs: @specialized-rules/dto-rules.mdc
|
||||
- Guards: @specialized-rules/guard-rules.mdc
|
||||
- Routes: @specialized-rules/route-rules.mdc
|
||||
- Types: @specialized-rules/type-rules.mdc
|
||||
- Utils: @specialized-rules/util-rules.mdc
|
||||
- Validation: @specialized-rules/validate-rules.mdc
|
||||
- Channel Integrations: @specialized-rules/integration-channel-rules.mdc
|
||||
- Chatbot Integrations: @specialized-rules/integration-chatbot-rules.mdc
|
||||
- Storage Integrations: @specialized-rules/integration-storage-rules.mdc
|
||||
- Event Integrations: @specialized-rules/integration-event-rules.mdc
|
||||
- **TypeScript/Node.js**: Node.js 20+ + TypeScript 5+ backend standards
|
||||
- **Express/Prisma**: Express.js + Prisma ORM patterns
|
||||
- **WhatsApp Integrations**: Baileys, Meta Business API, and other messaging platforms
|
||||
|
||||
## Technology Stack
|
||||
- **Backend**: Node.js 20+ + TypeScript 5+ + Express.js
|
||||
- **Database**: Prisma ORM (PostgreSQL/MySQL support)
|
||||
- **Cache**: Redis + Node-cache for local fallback
|
||||
- **Queue**: RabbitMQ + Amazon SQS for message processing
|
||||
- **Real-time**: Socket.io for WebSocket connections
|
||||
- **Storage**: AWS S3 + Minio for file storage
|
||||
- **Validation**: JSONSchema7 for input validation
|
||||
- **Logging**: Pino for structured logging
|
||||
- **Architecture**: Multi-tenant API with WhatsApp integrations
|
||||
|
||||
## Project-Specific Patterns
|
||||
|
||||
### WhatsApp Integration Architecture
|
||||
- **MANDATORY**: All WhatsApp integrations must follow established patterns
|
||||
- **BAILEYS**: Use `whatsapp.baileys.service.ts` patterns for WhatsApp Web
|
||||
- **META BUSINESS**: Use `whatsapp.business.service.ts` for official API
|
||||
- **CONNECTION MANAGEMENT**: One connection per instance with proper lifecycle
|
||||
- **EVENT HANDLING**: Proper event listeners and error handling
|
||||
|
||||
### Multi-Database Architecture
|
||||
- **CRITICAL**: Support both PostgreSQL and MySQL
|
||||
- **SCHEMAS**: Use appropriate schema files (postgresql-schema.prisma / mysql-schema.prisma)
|
||||
- **MIGRATIONS**: Keep migrations synchronized between databases
|
||||
- **TYPES**: Use database-specific types (@db.JsonB vs @db.Json)
|
||||
- **COMPATIBILITY**: Ensure feature parity between databases
|
||||
|
||||
### API Integration Workflow
|
||||
- **CORE FEATURE**: REST API for WhatsApp communication
|
||||
- **COMPLEXITY**: High - involves webhook processing, message routing, and instance management
|
||||
- **COMPONENTS**: Instance management, message handling, media processing
|
||||
- **INTEGRATIONS**: Baileys, Meta Business API, Chatwoot, Typebot, OpenAI, Dify
|
||||
|
||||
### Multi-Tenant Instance Architecture
|
||||
- **CRITICAL**: All operations must be scoped by instance
|
||||
- **ISOLATION**: Complete data isolation between instances
|
||||
- **SECURITY**: Validate instance ownership before operations
|
||||
- **SCALING**: Support thousands of concurrent instances
|
||||
- **AUTHENTICATION**: API key-based authentication per instance
|
||||
|
||||
## Documentation Requirements
|
||||
|
||||
### Implementation Documentation
|
||||
- **MANDATORY**: Document complex integration patterns
|
||||
- **LOCATION**: Use inline comments for business logic
|
||||
- **API DOCS**: Document all public endpoints
|
||||
- **WEBHOOK DOCS**: Document webhook payloads and signatures
|
||||
|
||||
### Change Documentation
|
||||
- **CHANGELOG**: Document breaking changes
|
||||
- **MIGRATION GUIDES**: Document database migrations
|
||||
- **INTEGRATION GUIDES**: Document new integration patterns
|
||||
|
||||
## Environment and Security
|
||||
|
||||
### Environment Variables
|
||||
- **CRITICAL**: Never hardcode sensitive values
|
||||
- **VALIDATION**: Validate required environment variables on startup
|
||||
- **SECURITY**: Use secure defaults and proper encryption
|
||||
- **DOCUMENTATION**: Document all environment variables
|
||||
|
||||
### File Organization - Node.js/TypeScript Structure
|
||||
- **CONTROLLERS**: Organized by feature (`api/controllers/`)
|
||||
- **SERVICES**: Business logic in service classes (`api/services/`)
|
||||
- **INTEGRATIONS**: External integrations (`api/integrations/`)
|
||||
- **DTOS**: Data transfer objects (`api/dto/`)
|
||||
- **TYPES**: TypeScript types (`api/types/`)
|
||||
- **UTILS**: Utility functions (`utils/`)
|
||||
|
||||
## Integration Points
|
||||
|
||||
### WhatsApp Providers
|
||||
- **BAILEYS**: WhatsApp Web integration with QR code
|
||||
- **META BUSINESS**: Official WhatsApp Business API
|
||||
- **CLOUD API**: WhatsApp Cloud API integration
|
||||
- **WEBHOOK PROCESSING**: Proper webhook validation and processing
|
||||
|
||||
### External Integrations
|
||||
- **CHATWOOT**: Customer support platform integration
|
||||
- **TYPEBOT**: Chatbot flow integration
|
||||
- **OPENAI**: AI-powered chat integration
|
||||
- **DIFY**: AI workflow integration
|
||||
- **STORAGE**: S3/Minio for media file storage
|
||||
|
||||
### Event-Driven Communication
|
||||
- **EVENTEMITTER2**: Internal event system
|
||||
- **SOCKET.IO**: Real-time WebSocket communication
|
||||
- **RABBITMQ**: Message queue for async processing
|
||||
- **SQS**: Amazon SQS for cloud-based queuing
|
||||
- **WEBHOOKS**: Outbound webhook system
|
||||
|
||||
## Development Constraints
|
||||
|
||||
### Language Requirements
|
||||
- **USER COMMUNICATION**: Always respond in Portuguese (PT-BR)
|
||||
- **CODE/COMMENTS**: English for code and technical documentation
|
||||
- **API RESPONSES**: English for consistency
|
||||
- **ERROR MESSAGES**: Portuguese for user-facing errors
|
||||
|
||||
### Performance Constraints
|
||||
- **MEMORY**: Efficient memory usage for multiple instances
|
||||
- **DATABASE**: Optimized queries with proper indexing
|
||||
- **CACHE**: Strategic caching for frequently accessed data
|
||||
- **CONNECTIONS**: Proper connection pooling and management
|
||||
|
||||
### Security Constraints
|
||||
- **AUTHENTICATION**: API key validation for all endpoints
|
||||
- **AUTHORIZATION**: Instance-based access control
|
||||
- **INPUT VALIDATION**: Validate all inputs with JSONSchema7
|
||||
- **RATE LIMITING**: Prevent abuse with rate limiting
|
||||
- **WEBHOOK SECURITY**: Validate webhook signatures
|
||||
|
||||
## Quality Standards
|
||||
- **TYPE SAFETY**: Full TypeScript coverage with strict mode
|
||||
- **ERROR HANDLING**: Comprehensive error scenarios with proper logging
|
||||
- **TESTING**: Unit and integration tests for critical paths
|
||||
- **MONITORING**: Proper logging and error tracking
|
||||
- **DOCUMENTATION**: Clear API documentation and code comments
|
||||
- **PERFORMANCE**: Optimized for high-throughput message processing
|
||||
- **SECURITY**: Secure by default with proper validation
|
||||
- **SCALABILITY**: Design for horizontal scaling
|
||||
|
||||
## Evolution API Specific Development Patterns
|
||||
|
||||
### Instance Management
|
||||
- **LIFECYCLE**: Proper instance creation, connection, and cleanup
|
||||
- **STATE MANAGEMENT**: Track connection status and health
|
||||
- **RECOVERY**: Automatic reconnection and error recovery
|
||||
- **MONITORING**: Health checks and status reporting
|
||||
|
||||
### Message Processing
|
||||
- **QUEUE-BASED**: Use queues for message processing
|
||||
- **RETRY LOGIC**: Implement exponential backoff for failures
|
||||
- **MEDIA HANDLING**: Proper media upload and processing
|
||||
- **WEBHOOK DELIVERY**: Reliable webhook delivery with retries
|
||||
|
||||
### Integration Patterns
|
||||
- **SERVICE LAYER**: Business logic in service classes
|
||||
- **DTO VALIDATION**: Input validation with JSONSchema7
|
||||
- **ERROR HANDLING**: Consistent error responses
|
||||
- **LOGGING**: Structured logging with correlation IDs
|
||||
|
||||
### Database Patterns
|
||||
- **PRISMA**: Use Prisma ORM for all database operations
|
||||
- **TRANSACTIONS**: Use transactions for multi-step operations
|
||||
- **MIGRATIONS**: Proper migration management
|
||||
- **INDEXING**: Optimize queries with appropriate indexes
|
||||
342
.cursor/rules/specialized-rules/controller-rules.mdc
Normal file
342
.cursor/rules/specialized-rules/controller-rules.mdc
Normal file
@@ -0,0 +1,342 @@
|
||||
---
|
||||
description: Controller patterns for Evolution API
|
||||
globs:
|
||||
- "src/api/controllers/**/*.ts"
|
||||
- "src/api/integrations/**/controllers/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Controller Rules
|
||||
|
||||
## Controller Structure Pattern
|
||||
|
||||
### Standard Controller Class
|
||||
```typescript
|
||||
export class ExampleController {
|
||||
constructor(private readonly exampleService: ExampleService) {}
|
||||
|
||||
public async createExample(instance: InstanceDto, data: ExampleDto) {
|
||||
return this.exampleService.create(instance, data);
|
||||
}
|
||||
|
||||
public async findExample(instance: InstanceDto) {
|
||||
return this.exampleService.find(instance);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Dependency Injection Pattern
|
||||
|
||||
### Service Injection
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern
|
||||
export class ChatController {
|
||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
||||
|
||||
public async whatsappNumber({ instanceName }: InstanceDto, data: WhatsAppNumberDto) {
|
||||
return await this.waMonitor.waInstances[instanceName].getWhatsAppNumbers(data);
|
||||
}
|
||||
}
|
||||
|
||||
// INCORRECT - Don't inject multiple services when waMonitor is sufficient
|
||||
export class ChatController {
|
||||
constructor(
|
||||
private readonly waMonitor: WAMonitoringService,
|
||||
private readonly prismaRepository: PrismaRepository, // ❌ Unnecessary if waMonitor has access
|
||||
private readonly configService: ConfigService, // ❌ Unnecessary if waMonitor has access
|
||||
) {}
|
||||
}
|
||||
```
|
||||
|
||||
## Method Signature Pattern
|
||||
|
||||
### Instance Parameter Pattern
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern (destructuring instanceName)
|
||||
public async fetchCatalog({ instanceName }: InstanceDto, data: getCatalogDto) {
|
||||
return await this.waMonitor.waInstances[instanceName].fetchCatalog(instanceName, data);
|
||||
}
|
||||
|
||||
// CORRECT - Alternative pattern for full instance (when using services)
|
||||
public async createTemplate(instance: InstanceDto, data: TemplateDto) {
|
||||
return this.templateService.create(instance, data);
|
||||
}
|
||||
|
||||
// INCORRECT - Don't use generic method names
|
||||
public async methodName(instance: InstanceDto, data: DataDto) { // ❌ Use specific names
|
||||
return this.service.performAction(instance, data);
|
||||
}
|
||||
```
|
||||
|
||||
## WAMonitor Access Pattern
|
||||
|
||||
### Direct WAMonitor Usage
|
||||
```typescript
|
||||
// CORRECT - Standard pattern in controllers
|
||||
export class CallController {
|
||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
||||
|
||||
public async offerCall({ instanceName }: InstanceDto, data: OfferCallDto) {
|
||||
return await this.waMonitor.waInstances[instanceName].offerCall(data);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Controller Registration Pattern
|
||||
|
||||
### Server Module Registration
|
||||
```typescript
|
||||
// In server.module.ts
|
||||
export const templateController = new TemplateController(templateService);
|
||||
export const businessController = new BusinessController(waMonitor);
|
||||
export const chatController = new ChatController(waMonitor);
|
||||
export const callController = new CallController(waMonitor);
|
||||
```
|
||||
|
||||
## Error Handling in Controllers
|
||||
|
||||
### Let Services Handle Errors
|
||||
```typescript
|
||||
// CORRECT - Let service handle errors
|
||||
public async fetchCatalog(instance: InstanceDto, data: getCatalogDto) {
|
||||
return await this.waMonitor.waInstances[instance.instanceName].fetchCatalog(instance.instanceName, data);
|
||||
}
|
||||
|
||||
// INCORRECT - Don't add try-catch in controllers unless specific handling needed
|
||||
public async fetchCatalog(instance: InstanceDto, data: getCatalogDto) {
|
||||
try {
|
||||
return await this.waMonitor.waInstances[instance.instanceName].fetchCatalog(instance.instanceName, data);
|
||||
} catch (error) {
|
||||
throw error; // ❌ Unnecessary try-catch
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Complex Controller Pattern
|
||||
|
||||
### Instance Controller Pattern
|
||||
```typescript
|
||||
export class InstanceController {
|
||||
constructor(
|
||||
private readonly waMonitor: WAMonitoringService,
|
||||
private readonly configService: ConfigService,
|
||||
private readonly prismaRepository: PrismaRepository,
|
||||
private readonly eventEmitter: EventEmitter2,
|
||||
private readonly chatwootService: ChatwootService,
|
||||
private readonly settingsService: SettingsService,
|
||||
private readonly proxyService: ProxyController,
|
||||
private readonly cache: CacheService,
|
||||
private readonly chatwootCache: CacheService,
|
||||
private readonly baileysCache: CacheService,
|
||||
private readonly providerFiles: ProviderFiles,
|
||||
) {}
|
||||
|
||||
private readonly logger = new Logger('InstanceController');
|
||||
|
||||
// Multiple methods handling different aspects
|
||||
public async createInstance(data: InstanceDto) {
|
||||
// Complex instance creation logic
|
||||
}
|
||||
|
||||
public async deleteInstance({ instanceName }: InstanceDto) {
|
||||
// Complex instance deletion logic
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Channel Controller Pattern
|
||||
|
||||
### Base Channel Controller
|
||||
```typescript
|
||||
export class ChannelController {
|
||||
public prismaRepository: PrismaRepository;
|
||||
public waMonitor: WAMonitoringService;
|
||||
|
||||
constructor(prismaRepository: PrismaRepository, waMonitor: WAMonitoringService) {
|
||||
this.prisma = prismaRepository;
|
||||
this.monitor = waMonitor;
|
||||
}
|
||||
|
||||
// Getters and setters for dependency access
|
||||
public set prisma(prisma: PrismaRepository) {
|
||||
this.prismaRepository = prisma;
|
||||
}
|
||||
|
||||
public get prisma() {
|
||||
return this.prismaRepository;
|
||||
}
|
||||
|
||||
public set monitor(waMonitor: WAMonitoringService) {
|
||||
this.waMonitor = waMonitor;
|
||||
}
|
||||
|
||||
public get monitor() {
|
||||
return this.waMonitor;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Extended Channel Controller
|
||||
```typescript
|
||||
export class EvolutionController extends ChannelController implements ChannelControllerInterface {
|
||||
private readonly logger = new Logger('EvolutionController');
|
||||
|
||||
constructor(prismaRepository: PrismaRepository, waMonitor: WAMonitoringService) {
|
||||
super(prismaRepository, waMonitor);
|
||||
}
|
||||
|
||||
integrationEnabled: boolean;
|
||||
|
||||
public async receiveWebhook(data: any) {
|
||||
const numberId = data.numberId;
|
||||
|
||||
if (!numberId) {
|
||||
this.logger.error('WebhookService -> receiveWebhookEvolution -> numberId not found');
|
||||
return;
|
||||
}
|
||||
|
||||
const instance = await this.prismaRepository.instance.findFirst({
|
||||
where: { number: numberId },
|
||||
});
|
||||
|
||||
if (!instance) {
|
||||
this.logger.error('WebhookService -> receiveWebhook -> instance not found');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.waMonitor.waInstances[instance.name].connectToWhatsapp(data);
|
||||
|
||||
return {
|
||||
status: 'success',
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Chatbot Controller Pattern
|
||||
|
||||
### Base Chatbot Controller
|
||||
```typescript
|
||||
export abstract class BaseChatbotController<BotType = any, BotData extends BaseChatbotDto = BaseChatbotDto>
|
||||
extends ChatbotController
|
||||
implements ChatbotControllerInterface
|
||||
{
|
||||
public readonly logger: Logger;
|
||||
integrationEnabled: boolean;
|
||||
|
||||
// Abstract methods to be implemented
|
||||
protected abstract readonly integrationName: string;
|
||||
protected abstract processBot(/* parameters */): Promise<void>;
|
||||
protected abstract getFallbackBotId(settings: any): string | undefined;
|
||||
|
||||
constructor(prismaRepository: PrismaRepository, waMonitor: WAMonitoringService) {
|
||||
super(prismaRepository, waMonitor);
|
||||
}
|
||||
|
||||
// Base implementation methods
|
||||
public async createBot(instance: InstanceDto, data: BotData) {
|
||||
// Common bot creation logic
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Method Naming Conventions
|
||||
|
||||
### Standard Method Names
|
||||
- `create*()` - Create operations
|
||||
- `find*()` - Find operations
|
||||
- `fetch*()` - Fetch from external APIs
|
||||
- `send*()` - Send operations
|
||||
- `receive*()` - Receive webhook/data
|
||||
- `handle*()` - Handle specific actions
|
||||
- `offer*()` - Offer services (like calls)
|
||||
|
||||
## Return Patterns
|
||||
|
||||
### Direct Return Pattern
|
||||
```typescript
|
||||
// CORRECT - Direct return from service
|
||||
public async createTemplate(instance: InstanceDto, data: TemplateDto) {
|
||||
return this.templateService.create(instance, data);
|
||||
}
|
||||
|
||||
// CORRECT - Direct return from waMonitor
|
||||
public async offerCall({ instanceName }: InstanceDto, data: OfferCallDto) {
|
||||
return await this.waMonitor.waInstances[instanceName].offerCall(data);
|
||||
}
|
||||
```
|
||||
|
||||
## Controller Testing Pattern
|
||||
|
||||
### Unit Test Structure
|
||||
```typescript
|
||||
describe('ExampleController', () => {
|
||||
let controller: ExampleController;
|
||||
let service: jest.Mocked<ExampleService>;
|
||||
|
||||
beforeEach(() => {
|
||||
const mockService = {
|
||||
create: jest.fn(),
|
||||
find: jest.fn(),
|
||||
};
|
||||
|
||||
controller = new ExampleController(mockService as any);
|
||||
service = mockService as any;
|
||||
});
|
||||
|
||||
describe('createExample', () => {
|
||||
it('should call service create method', async () => {
|
||||
const instance = { instanceName: 'test' };
|
||||
const data = { test: 'data' };
|
||||
const expectedResult = { success: true };
|
||||
|
||||
service.create.mockResolvedValue(expectedResult);
|
||||
|
||||
const result = await controller.createExample(instance, data);
|
||||
|
||||
expect(service.create).toHaveBeenCalledWith(instance, data);
|
||||
expect(result).toEqual(expectedResult);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Interface Implementation
|
||||
|
||||
### Controller Interface Pattern
|
||||
```typescript
|
||||
export interface ChannelControllerInterface {
|
||||
integrationEnabled: boolean;
|
||||
}
|
||||
|
||||
export interface ChatbotControllerInterface {
|
||||
integrationEnabled: boolean;
|
||||
createBot(instance: InstanceDto, data: any): Promise<any>;
|
||||
findBot(instance: InstanceDto): Promise<any>;
|
||||
// ... other methods
|
||||
}
|
||||
```
|
||||
|
||||
## Controller Organization
|
||||
|
||||
### File Naming Convention
|
||||
- `*.controller.ts` - Main controllers
|
||||
- `*/*.controller.ts` - Integration-specific controllers
|
||||
|
||||
### Method Organization
|
||||
1. Constructor
|
||||
2. Public methods (alphabetical order)
|
||||
3. Private methods (if any)
|
||||
|
||||
### Import Organization
|
||||
```typescript
|
||||
// DTOs first
|
||||
import { InstanceDto } from '@api/dto/instance.dto';
|
||||
import { ExampleDto } from '@api/dto/example.dto';
|
||||
|
||||
// Services
|
||||
import { ExampleService } from '@api/services/example.service';
|
||||
|
||||
// Types
|
||||
import { WAMonitoringService } from '@api/services/monitor.service';
|
||||
```
|
||||
433
.cursor/rules/specialized-rules/dto-rules.mdc
Normal file
433
.cursor/rules/specialized-rules/dto-rules.mdc
Normal file
@@ -0,0 +1,433 @@
|
||||
---
|
||||
description: DTO patterns and validation for Evolution API
|
||||
globs:
|
||||
- "src/api/dto/**/*.ts"
|
||||
- "src/api/integrations/**/dto/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API DTO Rules
|
||||
|
||||
## DTO Structure Pattern
|
||||
|
||||
### Basic DTO Class
|
||||
```typescript
|
||||
export class ExampleDto {
|
||||
name: string;
|
||||
category: string;
|
||||
allowCategoryChange: boolean;
|
||||
language: string;
|
||||
components: any;
|
||||
webhookUrl?: string;
|
||||
}
|
||||
```
|
||||
|
||||
## Inheritance Pattern
|
||||
|
||||
### DTO Inheritance
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern
|
||||
export class InstanceDto extends IntegrationDto {
|
||||
instanceName: string;
|
||||
instanceId?: string;
|
||||
qrcode?: boolean;
|
||||
businessId?: string;
|
||||
number?: string;
|
||||
integration?: string;
|
||||
token?: string;
|
||||
status?: string;
|
||||
ownerJid?: string;
|
||||
profileName?: string;
|
||||
profilePicUrl?: string;
|
||||
|
||||
// Settings
|
||||
rejectCall?: boolean;
|
||||
msgCall?: string;
|
||||
groupsIgnore?: boolean;
|
||||
alwaysOnline?: boolean;
|
||||
readMessages?: boolean;
|
||||
readStatus?: boolean;
|
||||
syncFullHistory?: boolean;
|
||||
wavoipToken?: string;
|
||||
|
||||
// Proxy settings
|
||||
proxyHost?: string;
|
||||
proxyPort?: string;
|
||||
proxyProtocol?: string;
|
||||
proxyUsername?: string;
|
||||
proxyPassword?: string;
|
||||
|
||||
// Webhook configuration
|
||||
webhook?: {
|
||||
enabled?: boolean;
|
||||
events?: string[];
|
||||
headers?: JsonValue;
|
||||
url?: string;
|
||||
byEvents?: boolean;
|
||||
base64?: boolean;
|
||||
};
|
||||
|
||||
// Chatwoot integration
|
||||
chatwootAccountId?: string;
|
||||
chatwootConversationPending?: boolean;
|
||||
chatwootAutoCreate?: boolean;
|
||||
chatwootDaysLimitImportMessages?: number;
|
||||
chatwootImportContacts?: boolean;
|
||||
chatwootImportMessages?: boolean;
|
||||
chatwootLogo?: string;
|
||||
chatwootMergeBrazilContacts?: boolean;
|
||||
chatwootNameInbox?: string;
|
||||
chatwootOrganization?: string;
|
||||
chatwootReopenConversation?: boolean;
|
||||
chatwootSignMsg?: boolean;
|
||||
chatwootToken?: string;
|
||||
chatwootUrl?: string;
|
||||
}
|
||||
```
|
||||
|
||||
## Base DTO Pattern
|
||||
|
||||
### Base Chatbot DTO
|
||||
```typescript
|
||||
/**
|
||||
* Base DTO for all chatbot integrations
|
||||
* Contains common properties shared by all chatbot types
|
||||
*/
|
||||
export class BaseChatbotDto {
|
||||
enabled?: boolean;
|
||||
description: string;
|
||||
expire?: number;
|
||||
keywordFinish?: string;
|
||||
delayMessage?: number;
|
||||
unknownMessage?: string;
|
||||
listeningFromMe?: boolean;
|
||||
stopBotFromMe?: boolean;
|
||||
keepOpen?: boolean;
|
||||
debounceTime?: number;
|
||||
triggerType: TriggerType;
|
||||
triggerOperator?: TriggerOperator;
|
||||
triggerValue?: string;
|
||||
ignoreJids?: string[];
|
||||
splitMessages?: boolean;
|
||||
timePerChar?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base settings DTO for all chatbot integrations
|
||||
*/
|
||||
export class BaseChatbotSettingDto {
|
||||
expire?: number;
|
||||
keywordFinish?: string;
|
||||
delayMessage?: number;
|
||||
unknownMessage?: string;
|
||||
listeningFromMe?: boolean;
|
||||
stopBotFromMe?: boolean;
|
||||
keepOpen?: boolean;
|
||||
debounceTime?: number;
|
||||
ignoreJids?: string[];
|
||||
splitMessages?: boolean;
|
||||
timePerChar?: number;
|
||||
}
|
||||
```
|
||||
|
||||
## Message DTO Patterns
|
||||
|
||||
### Send Message DTOs
|
||||
```typescript
|
||||
export class Metadata {
|
||||
number: string;
|
||||
delay?: number;
|
||||
}
|
||||
|
||||
export class SendTextDto extends Metadata {
|
||||
text: string;
|
||||
linkPreview?: boolean;
|
||||
mentionsEveryOne?: boolean;
|
||||
mentioned?: string[];
|
||||
}
|
||||
|
||||
export class SendListDto extends Metadata {
|
||||
title: string;
|
||||
description: string;
|
||||
buttonText: string;
|
||||
footerText?: string;
|
||||
|
||||
sections: Section[];
|
||||
}
|
||||
|
||||
export class ContactMessage {
|
||||
fullName: string;
|
||||
wuid: string;
|
||||
phoneNumber: string;
|
||||
organization?: string;
|
||||
email?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export class SendTemplateDto extends Metadata {
|
||||
name: string;
|
||||
language: string;
|
||||
components: any;
|
||||
}
|
||||
```
|
||||
|
||||
## Simple DTO Patterns
|
||||
|
||||
### Basic DTOs
|
||||
```typescript
|
||||
export class NumberDto {
|
||||
number: string;
|
||||
}
|
||||
|
||||
export class LabelDto {
|
||||
id?: string;
|
||||
name: string;
|
||||
color: string;
|
||||
predefinedId?: string;
|
||||
}
|
||||
|
||||
export class HandleLabelDto {
|
||||
number: string;
|
||||
labelId: string;
|
||||
}
|
||||
|
||||
export class ProfileNameDto {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export class WhatsAppNumberDto {
|
||||
numbers: string[];
|
||||
}
|
||||
```
|
||||
|
||||
## Complex DTO Patterns
|
||||
|
||||
### Business DTOs
|
||||
```typescript
|
||||
export class getCatalogDto {
|
||||
number?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export class getCollectionsDto {
|
||||
number?: string;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
export class NumberBusiness {
|
||||
number: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
email?: string;
|
||||
websites?: string[];
|
||||
latitude?: number;
|
||||
longitude?: number;
|
||||
address?: string;
|
||||
profilehandle?: string;
|
||||
}
|
||||
```
|
||||
|
||||
## Settings DTO Pattern
|
||||
|
||||
### Settings Configuration
|
||||
```typescript
|
||||
export class SettingsDto {
|
||||
rejectCall?: boolean;
|
||||
msgCall?: string;
|
||||
groupsIgnore?: boolean;
|
||||
alwaysOnline?: boolean;
|
||||
readMessages?: boolean;
|
||||
readStatus?: boolean;
|
||||
syncFullHistory?: boolean;
|
||||
wavoipToken?: string;
|
||||
}
|
||||
|
||||
export class ProxyDto {
|
||||
host?: string;
|
||||
port?: string;
|
||||
protocol?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
}
|
||||
```
|
||||
|
||||
## Presence DTO Pattern
|
||||
|
||||
### WhatsApp Presence
|
||||
```typescript
|
||||
export class SetPresenceDto {
|
||||
presence: WAPresence;
|
||||
}
|
||||
|
||||
export class SendPresenceDto {
|
||||
number: string;
|
||||
presence: WAPresence;
|
||||
}
|
||||
```
|
||||
|
||||
## DTO Structure (No Decorators)
|
||||
|
||||
### Simple DTO Classes (Evolution API Pattern)
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern (no decorators)
|
||||
export class ExampleDto {
|
||||
name: string;
|
||||
description?: string;
|
||||
enabled: boolean;
|
||||
items?: string[];
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
// INCORRECT - Don't use class-validator decorators
|
||||
export class ValidatedDto {
|
||||
@IsString() // ❌ Evolution API doesn't use decorators
|
||||
name: string;
|
||||
}
|
||||
```
|
||||
|
||||
## Type Safety Patterns
|
||||
|
||||
### Prisma Type Integration
|
||||
```typescript
|
||||
import { JsonValue } from '@prisma/client/runtime/library';
|
||||
import { WAPresence } from 'baileys';
|
||||
import { TriggerOperator, TriggerType } from '@prisma/client';
|
||||
|
||||
export class TypeSafeDto {
|
||||
presence: WAPresence;
|
||||
triggerType: TriggerType;
|
||||
triggerOperator?: TriggerOperator;
|
||||
metadata?: JsonValue;
|
||||
}
|
||||
```
|
||||
|
||||
## DTO Documentation
|
||||
|
||||
### JSDoc Comments
|
||||
```typescript
|
||||
/**
|
||||
* DTO for creating WhatsApp templates
|
||||
* Used by Meta Business API integration
|
||||
*/
|
||||
export class TemplateDto {
|
||||
/** Template name - must be unique */
|
||||
name: string;
|
||||
|
||||
/** Template category (MARKETING, UTILITY, AUTHENTICATION) */
|
||||
category: string;
|
||||
|
||||
/** Whether category can be changed after creation */
|
||||
allowCategoryChange: boolean;
|
||||
|
||||
/** Language code (e.g., 'pt_BR', 'en_US') */
|
||||
language: string;
|
||||
|
||||
/** Template components (header, body, footer, buttons) */
|
||||
components: any;
|
||||
|
||||
/** Optional webhook URL for template status updates */
|
||||
webhookUrl?: string;
|
||||
}
|
||||
```
|
||||
|
||||
## DTO Naming Conventions
|
||||
|
||||
### Standard Naming Patterns
|
||||
- `*Dto` - Data transfer objects
|
||||
- `Create*Dto` - Creation DTOs
|
||||
- `Update*Dto` - Update DTOs
|
||||
- `Send*Dto` - Message sending DTOs
|
||||
- `Get*Dto` - Query DTOs
|
||||
- `Handle*Dto` - Action DTOs
|
||||
|
||||
## File Organization
|
||||
|
||||
### DTO File Structure
|
||||
```
|
||||
src/api/dto/
|
||||
├── instance.dto.ts # Main instance DTO
|
||||
├── template.dto.ts # Template management
|
||||
├── sendMessage.dto.ts # Message sending DTOs
|
||||
├── chat.dto.ts # Chat operations
|
||||
├── business.dto.ts # Business API DTOs
|
||||
├── group.dto.ts # Group management
|
||||
├── label.dto.ts # Label management
|
||||
├── proxy.dto.ts # Proxy configuration
|
||||
├── settings.dto.ts # Instance settings
|
||||
└── call.dto.ts # Call operations
|
||||
```
|
||||
|
||||
## Integration DTO Patterns
|
||||
|
||||
### Chatbot Integration DTOs
|
||||
```typescript
|
||||
// Base for all chatbot DTOs
|
||||
export class BaseChatbotDto {
|
||||
enabled?: boolean;
|
||||
description: string;
|
||||
// ... common properties
|
||||
}
|
||||
|
||||
// Specific chatbot DTOs extend base
|
||||
export class TypebotDto extends BaseChatbotDto {
|
||||
url: string;
|
||||
typebot: string;
|
||||
// ... typebot-specific properties
|
||||
}
|
||||
|
||||
export class OpenaiDto extends BaseChatbotDto {
|
||||
apiKey: string;
|
||||
model: string;
|
||||
// ... openai-specific properties
|
||||
}
|
||||
```
|
||||
|
||||
## DTO Testing Pattern
|
||||
|
||||
### DTO Validation Tests
|
||||
```typescript
|
||||
describe('ExampleDto', () => {
|
||||
it('should validate required fields', () => {
|
||||
const dto = new ExampleDto();
|
||||
dto.name = 'test';
|
||||
dto.category = 'MARKETING';
|
||||
dto.allowCategoryChange = true;
|
||||
dto.language = 'pt_BR';
|
||||
dto.components = {};
|
||||
|
||||
expect(dto.name).toBe('test');
|
||||
expect(dto.category).toBe('MARKETING');
|
||||
});
|
||||
|
||||
it('should handle optional fields', () => {
|
||||
const dto = new ExampleDto();
|
||||
dto.name = 'test';
|
||||
dto.category = 'MARKETING';
|
||||
dto.allowCategoryChange = true;
|
||||
dto.language = 'pt_BR';
|
||||
dto.components = {};
|
||||
dto.webhookUrl = 'https://example.com/webhook';
|
||||
|
||||
expect(dto.webhookUrl).toBe('https://example.com/webhook');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## DTO Transformation
|
||||
|
||||
### Request to DTO Mapping (Evolution API Pattern)
|
||||
```typescript
|
||||
// CORRECT - Evolution API uses RouterBroker dataValidate
|
||||
const response = await this.dataValidate<ExampleDto>({
|
||||
request: req,
|
||||
schema: exampleSchema, // JSONSchema7
|
||||
ClassRef: ExampleDto,
|
||||
execute: (instance, data) => controller.method(instance, data),
|
||||
});
|
||||
|
||||
// INCORRECT - Don't use class-validator
|
||||
const dto = plainToClass(ExampleDto, req.body); // ❌ Not used in Evolution API
|
||||
const errors = await validate(dto); // ❌ Not used in Evolution API
|
||||
```
|
||||
416
.cursor/rules/specialized-rules/guard-rules.mdc
Normal file
416
.cursor/rules/specialized-rules/guard-rules.mdc
Normal file
@@ -0,0 +1,416 @@
|
||||
---
|
||||
description: Guard patterns for authentication and authorization in Evolution API
|
||||
globs:
|
||||
- "src/api/guards/**/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Guard Rules
|
||||
|
||||
## Guard Structure Pattern
|
||||
|
||||
### Standard Guard Function
|
||||
```typescript
|
||||
import { NextFunction, Request, Response } from 'express';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { UnauthorizedException, ForbiddenException } from '@exceptions';
|
||||
|
||||
const logger = new Logger('GUARD');
|
||||
|
||||
async function guardFunction(req: Request, _: Response, next: NextFunction) {
|
||||
// Guard logic here
|
||||
|
||||
if (validationFails) {
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
|
||||
return next();
|
||||
}
|
||||
|
||||
export const guardName = { guardFunction };
|
||||
```
|
||||
|
||||
## Authentication Guard Pattern
|
||||
|
||||
### API Key Authentication
|
||||
```typescript
|
||||
async function apikey(req: Request, _: Response, next: NextFunction) {
|
||||
const env = configService.get<Auth>('AUTHENTICATION').API_KEY;
|
||||
const key = req.get('apikey');
|
||||
const db = configService.get<Database>('DATABASE');
|
||||
|
||||
if (!key) {
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
|
||||
// Global API key check
|
||||
if (env.KEY === key) {
|
||||
return next();
|
||||
}
|
||||
|
||||
// Special routes handling
|
||||
if ((req.originalUrl.includes('/instance/create') || req.originalUrl.includes('/instance/fetchInstances')) && !key) {
|
||||
throw new ForbiddenException('Missing global api key', 'The global api key must be set');
|
||||
}
|
||||
|
||||
const param = req.params as unknown as InstanceDto;
|
||||
|
||||
try {
|
||||
if (param?.instanceName) {
|
||||
const instance = await prismaRepository.instance.findUnique({
|
||||
where: { name: param.instanceName },
|
||||
});
|
||||
if (instance.token === key) {
|
||||
return next();
|
||||
}
|
||||
} else {
|
||||
if (req.originalUrl.includes('/instance/fetchInstances') && db.SAVE_DATA.INSTANCE) {
|
||||
const instanceByKey = await prismaRepository.instance.findFirst({
|
||||
where: { token: key },
|
||||
});
|
||||
if (instanceByKey) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
}
|
||||
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
|
||||
export const authGuard = { apikey };
|
||||
```
|
||||
|
||||
## Instance Validation Guards
|
||||
|
||||
### Instance Exists Guard
|
||||
```typescript
|
||||
async function getInstance(instanceName: string) {
|
||||
try {
|
||||
const cacheConf = configService.get<CacheConf>('CACHE');
|
||||
|
||||
const exists = !!waMonitor.waInstances[instanceName];
|
||||
|
||||
if (cacheConf.REDIS.ENABLED && cacheConf.REDIS.SAVE_INSTANCES) {
|
||||
const keyExists = await cache.has(instanceName);
|
||||
return exists || keyExists;
|
||||
}
|
||||
|
||||
return exists || (await prismaRepository.instance.findMany({ where: { name: instanceName } })).length > 0;
|
||||
} catch (error) {
|
||||
throw new InternalServerErrorException(error?.toString());
|
||||
}
|
||||
}
|
||||
|
||||
export async function instanceExistsGuard(req: Request, _: Response, next: NextFunction) {
|
||||
if (req.originalUrl.includes('/instance/create')) {
|
||||
return next();
|
||||
}
|
||||
|
||||
const param = req.params as unknown as InstanceDto;
|
||||
if (!param?.instanceName) {
|
||||
throw new BadRequestException('"instanceName" not provided.');
|
||||
}
|
||||
|
||||
if (!(await getInstance(param.instanceName))) {
|
||||
throw new NotFoundException(`The "${param.instanceName}" instance does not exist`);
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
```
|
||||
|
||||
### Instance Logged Guard
|
||||
```typescript
|
||||
export async function instanceLoggedGuard(req: Request, _: Response, next: NextFunction) {
|
||||
if (req.originalUrl.includes('/instance/create')) {
|
||||
const instance = req.body as InstanceDto;
|
||||
if (await getInstance(instance.instanceName)) {
|
||||
throw new ForbiddenException(`This name "${instance.instanceName}" is already in use.`);
|
||||
}
|
||||
|
||||
if (waMonitor.waInstances[instance.instanceName]) {
|
||||
delete waMonitor.waInstances[instance.instanceName];
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
```
|
||||
|
||||
## Telemetry Guard Pattern
|
||||
|
||||
### Telemetry Collection
|
||||
```typescript
|
||||
class Telemetry {
|
||||
public collectTelemetry(req: Request, res: Response, next: NextFunction): void {
|
||||
// Collect telemetry data
|
||||
const telemetryData = {
|
||||
route: req.originalUrl,
|
||||
method: req.method,
|
||||
timestamp: new Date(),
|
||||
userAgent: req.get('User-Agent'),
|
||||
};
|
||||
|
||||
// Send telemetry asynchronously (don't block request)
|
||||
setImmediate(() => {
|
||||
this.sendTelemetry(telemetryData);
|
||||
});
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
private async sendTelemetry(data: any): Promise<void> {
|
||||
try {
|
||||
// Send telemetry data
|
||||
} catch (error) {
|
||||
// Silently fail - don't affect main request
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Telemetry;
|
||||
```
|
||||
|
||||
## Guard Composition Pattern
|
||||
|
||||
### Multiple Guards Usage
|
||||
```typescript
|
||||
// In router setup
|
||||
const guards = [instanceExistsGuard, instanceLoggedGuard, authGuard['apikey']];
|
||||
|
||||
router
|
||||
.use('/instance', new InstanceRouter(configService, ...guards).router)
|
||||
.use('/message', new MessageRouter(...guards).router)
|
||||
.use('/chat', new ChatRouter(...guards).router);
|
||||
```
|
||||
|
||||
## Error Handling in Guards
|
||||
|
||||
### Proper Exception Throwing
|
||||
```typescript
|
||||
// CORRECT - Use proper HTTP exceptions
|
||||
if (!apiKey) {
|
||||
throw new UnauthorizedException('API key required');
|
||||
}
|
||||
|
||||
if (instanceExists) {
|
||||
throw new ForbiddenException('Instance already exists');
|
||||
}
|
||||
|
||||
if (!instanceFound) {
|
||||
throw new NotFoundException('Instance not found');
|
||||
}
|
||||
|
||||
if (validationFails) {
|
||||
throw new BadRequestException('Invalid request parameters');
|
||||
}
|
||||
|
||||
// INCORRECT - Don't use generic Error
|
||||
if (!apiKey) {
|
||||
throw new Error('API key required'); // ❌ Use specific exceptions
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration Access in Guards
|
||||
|
||||
### Config Service Usage
|
||||
```typescript
|
||||
async function configAwareGuard(req: Request, _: Response, next: NextFunction) {
|
||||
const authConfig = configService.get<Auth>('AUTHENTICATION');
|
||||
const cacheConfig = configService.get<CacheConf>('CACHE');
|
||||
const dbConfig = configService.get<Database>('DATABASE');
|
||||
|
||||
// Use configuration for guard logic
|
||||
if (authConfig.API_KEY.KEY === providedKey) {
|
||||
return next();
|
||||
}
|
||||
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
```
|
||||
|
||||
## Database Access in Guards
|
||||
|
||||
### Prisma Repository Usage
|
||||
```typescript
|
||||
async function databaseGuard(req: Request, _: Response, next: NextFunction) {
|
||||
try {
|
||||
const param = req.params as unknown as InstanceDto;
|
||||
|
||||
const instance = await prismaRepository.instance.findUnique({
|
||||
where: { name: param.instanceName },
|
||||
});
|
||||
|
||||
if (!instance) {
|
||||
throw new NotFoundException('Instance not found');
|
||||
}
|
||||
|
||||
// Additional validation logic
|
||||
if (instance.status !== 'active') {
|
||||
throw new ForbiddenException('Instance not active');
|
||||
}
|
||||
|
||||
return next();
|
||||
} catch (error) {
|
||||
logger.error('Database guard error:', error);
|
||||
throw new InternalServerErrorException('Database access failed');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Cache Integration in Guards
|
||||
|
||||
### Cache Service Usage
|
||||
```typescript
|
||||
async function cacheAwareGuard(req: Request, _: Response, next: NextFunction) {
|
||||
const cacheConf = configService.get<CacheConf>('CACHE');
|
||||
|
||||
if (cacheConf.REDIS.ENABLED) {
|
||||
const cached = await cache.get(`guard:${req.params.instanceName}`);
|
||||
if (cached) {
|
||||
// Use cached validation result
|
||||
return next();
|
||||
}
|
||||
}
|
||||
|
||||
// Perform validation and cache result
|
||||
const isValid = await performValidation(req.params.instanceName);
|
||||
|
||||
if (cacheConf.REDIS.ENABLED) {
|
||||
await cache.set(`guard:${req.params.instanceName}`, isValid, 300); // 5 min TTL
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
return next();
|
||||
}
|
||||
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
```
|
||||
|
||||
## Logging in Guards
|
||||
|
||||
### Structured Logging
|
||||
```typescript
|
||||
const logger = new Logger('GUARD');
|
||||
|
||||
async function loggedGuard(req: Request, _: Response, next: NextFunction) {
|
||||
logger.log(`Guard validation started for ${req.originalUrl}`);
|
||||
|
||||
try {
|
||||
// Guard logic
|
||||
const isValid = await validateRequest(req);
|
||||
|
||||
if (isValid) {
|
||||
logger.log(`Guard validation successful for ${req.params.instanceName}`);
|
||||
return next();
|
||||
}
|
||||
|
||||
logger.warn(`Guard validation failed for ${req.params.instanceName}`);
|
||||
throw new UnauthorizedException();
|
||||
} catch (error) {
|
||||
logger.error(`Guard validation error: ${error.message}`, error.stack);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Guard Testing Pattern
|
||||
|
||||
### Unit Test Structure
|
||||
```typescript
|
||||
describe('authGuard', () => {
|
||||
let req: Partial<Request>;
|
||||
let res: Partial<Response>;
|
||||
let next: NextFunction;
|
||||
|
||||
beforeEach(() => {
|
||||
req = {
|
||||
get: jest.fn(),
|
||||
params: {},
|
||||
originalUrl: '/test',
|
||||
};
|
||||
res = {};
|
||||
next = jest.fn();
|
||||
});
|
||||
|
||||
describe('apikey', () => {
|
||||
it('should pass with valid global API key', async () => {
|
||||
(req.get as jest.Mock).mockReturnValue('valid-global-key');
|
||||
|
||||
await authGuard.apikey(req as Request, res as Response, next);
|
||||
|
||||
expect(next).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should throw UnauthorizedException with no API key', async () => {
|
||||
(req.get as jest.Mock).mockReturnValue(undefined);
|
||||
|
||||
await expect(
|
||||
authGuard.apikey(req as Request, res as Response, next)
|
||||
).rejects.toThrow(UnauthorizedException);
|
||||
});
|
||||
|
||||
it('should pass with valid instance token', async () => {
|
||||
(req.get as jest.Mock).mockReturnValue('instance-token');
|
||||
req.params = { instanceName: 'test-instance' };
|
||||
|
||||
// Mock prisma repository
|
||||
jest.spyOn(prismaRepository.instance, 'findUnique').mockResolvedValue({
|
||||
token: 'instance-token',
|
||||
} as any);
|
||||
|
||||
await authGuard.apikey(req as Request, res as Response, next);
|
||||
|
||||
expect(next).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Guard Performance Considerations
|
||||
|
||||
### Efficient Validation
|
||||
```typescript
|
||||
// CORRECT - Efficient guard with early returns
|
||||
async function efficientGuard(req: Request, _: Response, next: NextFunction) {
|
||||
// Quick checks first
|
||||
if (req.originalUrl.includes('/public')) {
|
||||
return next(); // Skip validation for public routes
|
||||
}
|
||||
|
||||
const apiKey = req.get('apikey');
|
||||
if (!apiKey) {
|
||||
throw new UnauthorizedException(); // Fail fast
|
||||
}
|
||||
|
||||
// More expensive checks only if needed
|
||||
if (apiKey === globalKey) {
|
||||
return next(); // Skip database check
|
||||
}
|
||||
|
||||
// Database check only as last resort
|
||||
const isValid = await validateInDatabase(apiKey);
|
||||
if (isValid) {
|
||||
return next();
|
||||
}
|
||||
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
|
||||
// INCORRECT - Inefficient guard
|
||||
async function inefficientGuard(req: Request, _: Response, next: NextFunction) {
|
||||
// Always do expensive database check first
|
||||
const dbResult = await expensiveDatabaseQuery(); // ❌ Expensive operation first
|
||||
|
||||
const apiKey = req.get('apikey');
|
||||
if (!apiKey && dbResult) { // ❌ Complex logic
|
||||
throw new UnauthorizedException();
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
```
|
||||
552
.cursor/rules/specialized-rules/integration-channel-rules.mdc
Normal file
552
.cursor/rules/specialized-rules/integration-channel-rules.mdc
Normal file
@@ -0,0 +1,552 @@
|
||||
---
|
||||
description: Channel integration patterns for Evolution API
|
||||
globs:
|
||||
- "src/api/integrations/channel/**/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Channel Integration Rules
|
||||
|
||||
## Channel Controller Pattern
|
||||
|
||||
### Base Channel Controller
|
||||
```typescript
|
||||
export interface ChannelControllerInterface {
|
||||
integrationEnabled: boolean;
|
||||
}
|
||||
|
||||
export class ChannelController {
|
||||
public prismaRepository: PrismaRepository;
|
||||
public waMonitor: WAMonitoringService;
|
||||
|
||||
constructor(prismaRepository: PrismaRepository, waMonitor: WAMonitoringService) {
|
||||
this.prisma = prismaRepository;
|
||||
this.monitor = waMonitor;
|
||||
}
|
||||
|
||||
public set prisma(prisma: PrismaRepository) {
|
||||
this.prismaRepository = prisma;
|
||||
}
|
||||
|
||||
public get prisma() {
|
||||
return this.prismaRepository;
|
||||
}
|
||||
|
||||
public set monitor(waMonitor: WAMonitoringService) {
|
||||
this.waMonitor = waMonitor;
|
||||
}
|
||||
|
||||
public get monitor() {
|
||||
return this.waMonitor;
|
||||
}
|
||||
|
||||
public init(instanceData: InstanceDto, data: ChannelDataType) {
|
||||
if (!instanceData.token && instanceData.integration === Integration.WHATSAPP_BUSINESS) {
|
||||
throw new BadRequestException('token is required');
|
||||
}
|
||||
|
||||
if (instanceData.integration === Integration.WHATSAPP_BUSINESS) {
|
||||
return new BusinessStartupService(/* dependencies */);
|
||||
}
|
||||
|
||||
if (instanceData.integration === Integration.EVOLUTION) {
|
||||
return new EvolutionStartupService(/* dependencies */);
|
||||
}
|
||||
|
||||
if (instanceData.integration === Integration.WHATSAPP_BAILEYS) {
|
||||
return new BaileysStartupService(/* dependencies */);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Extended Channel Controller
|
||||
```typescript
|
||||
export class EvolutionController extends ChannelController implements ChannelControllerInterface {
|
||||
private readonly logger = new Logger('EvolutionController');
|
||||
|
||||
constructor(prismaRepository: PrismaRepository, waMonitor: WAMonitoringService) {
|
||||
super(prismaRepository, waMonitor);
|
||||
}
|
||||
|
||||
integrationEnabled: boolean;
|
||||
|
||||
public async receiveWebhook(data: any) {
|
||||
const numberId = data.numberId;
|
||||
|
||||
if (!numberId) {
|
||||
this.logger.error('WebhookService -> receiveWebhookEvolution -> numberId not found');
|
||||
return;
|
||||
}
|
||||
|
||||
const instance = await this.prismaRepository.instance.findFirst({
|
||||
where: { number: numberId },
|
||||
});
|
||||
|
||||
if (!instance) {
|
||||
this.logger.error('WebhookService -> receiveWebhook -> instance not found');
|
||||
return;
|
||||
}
|
||||
|
||||
await this.waMonitor.waInstances[instance.name].connectToWhatsapp(data);
|
||||
|
||||
return {
|
||||
status: 'success',
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Channel Service Pattern
|
||||
|
||||
### Base Channel Service
|
||||
```typescript
|
||||
export class ChannelStartupService {
|
||||
constructor(
|
||||
private readonly configService: ConfigService,
|
||||
private readonly eventEmitter: EventEmitter2,
|
||||
private readonly prismaRepository: PrismaRepository,
|
||||
public readonly cache: CacheService,
|
||||
public readonly chatwootCache: CacheService,
|
||||
) {}
|
||||
|
||||
public readonly logger = new Logger('ChannelStartupService');
|
||||
|
||||
public client: WASocket;
|
||||
public readonly instance: wa.Instance = {};
|
||||
public readonly localChatwoot: wa.LocalChatwoot = {};
|
||||
public readonly localProxy: wa.LocalProxy = {};
|
||||
public readonly localSettings: wa.LocalSettings = {};
|
||||
public readonly localWebhook: wa.LocalWebHook = {};
|
||||
|
||||
public setInstance(instance: InstanceDto) {
|
||||
this.logger.setInstance(instance.instanceName);
|
||||
|
||||
this.instance.name = instance.instanceName;
|
||||
this.instance.id = instance.instanceId;
|
||||
this.instance.integration = instance.integration;
|
||||
this.instance.number = instance.number;
|
||||
this.instance.token = instance.token;
|
||||
this.instance.businessId = instance.businessId;
|
||||
|
||||
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot?.enabled) {
|
||||
this.chatwootService.eventWhatsapp(
|
||||
Events.STATUS_INSTANCE,
|
||||
{ instanceName: this.instance.name },
|
||||
{
|
||||
instance: this.instance.name,
|
||||
status: 'created',
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public set instanceName(name: string) {
|
||||
this.logger.setInstance(name);
|
||||
this.instance.name = name;
|
||||
}
|
||||
|
||||
public get instanceName() {
|
||||
return this.instance.name;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Extended Channel Service
|
||||
```typescript
|
||||
export class EvolutionStartupService extends ChannelStartupService {
|
||||
constructor(
|
||||
configService: ConfigService,
|
||||
eventEmitter: EventEmitter2,
|
||||
prismaRepository: PrismaRepository,
|
||||
cache: CacheService,
|
||||
chatwootCache: CacheService,
|
||||
) {
|
||||
super(configService, eventEmitter, prismaRepository, cache, chatwootCache);
|
||||
}
|
||||
|
||||
public async sendMessage(data: SendTextDto): Promise<any> {
|
||||
// Evolution-specific message sending logic
|
||||
const response = await this.evolutionApiCall('/send-message', data);
|
||||
return response;
|
||||
}
|
||||
|
||||
public async connectToWhatsapp(data: any): Promise<void> {
|
||||
// Evolution-specific connection logic
|
||||
this.logger.log('Connecting to Evolution API');
|
||||
|
||||
// Set up webhook listeners
|
||||
this.setupWebhookHandlers();
|
||||
|
||||
// Initialize connection
|
||||
await this.initializeConnection(data);
|
||||
}
|
||||
|
||||
private async evolutionApiCall(endpoint: string, data: any): Promise<any> {
|
||||
const config = this.configService.get<Evolution>('EVOLUTION');
|
||||
|
||||
try {
|
||||
const response = await axios.post(`${config.API_URL}${endpoint}`, data, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${this.instance.token}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
this.logger.error(`Evolution API call failed: ${error.message}`);
|
||||
throw new InternalServerErrorException('Evolution API call failed');
|
||||
}
|
||||
}
|
||||
|
||||
private setupWebhookHandlers(): void {
|
||||
// Set up webhook event handlers
|
||||
}
|
||||
|
||||
private async initializeConnection(data: any): Promise<void> {
|
||||
// Initialize connection with Evolution API
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Business API Service Pattern
|
||||
|
||||
### Meta Business Service
|
||||
```typescript
|
||||
export class BusinessStartupService extends ChannelStartupService {
|
||||
constructor(
|
||||
configService: ConfigService,
|
||||
eventEmitter: EventEmitter2,
|
||||
prismaRepository: PrismaRepository,
|
||||
cache: CacheService,
|
||||
chatwootCache: CacheService,
|
||||
baileysCache: CacheService,
|
||||
providerFiles: ProviderFiles,
|
||||
) {
|
||||
super(configService, eventEmitter, prismaRepository, cache, chatwootCache);
|
||||
}
|
||||
|
||||
public async sendMessage(data: SendTextDto): Promise<any> {
|
||||
const businessConfig = this.configService.get<WaBusiness>('WA_BUSINESS');
|
||||
|
||||
const payload = {
|
||||
messaging_product: 'whatsapp',
|
||||
to: data.number,
|
||||
type: 'text',
|
||||
text: {
|
||||
body: data.text,
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${businessConfig.URL}/${businessConfig.VERSION}/${this.instance.businessId}/messages`,
|
||||
payload,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': `Bearer ${this.instance.token}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
this.logger.error(`Business API call failed: ${error.message}`);
|
||||
throw new BadRequestException('Failed to send message via Business API');
|
||||
}
|
||||
}
|
||||
|
||||
public async receiveWebhook(data: any): Promise<void> {
|
||||
// Process incoming webhook from Meta Business API
|
||||
const { entry } = data;
|
||||
|
||||
for (const entryItem of entry) {
|
||||
const { changes } = entryItem;
|
||||
|
||||
for (const change of changes) {
|
||||
if (change.field === 'messages') {
|
||||
await this.processMessage(change.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async processMessage(messageData: any): Promise<void> {
|
||||
// Process incoming message from Business API
|
||||
const { messages, contacts } = messageData;
|
||||
|
||||
if (messages) {
|
||||
for (const message of messages) {
|
||||
await this.handleIncomingMessage(message, contacts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async handleIncomingMessage(message: any, contacts: any[]): Promise<void> {
|
||||
// Handle individual message
|
||||
const contact = contacts?.find(c => c.wa_id === message.from);
|
||||
|
||||
// Emit event for message processing
|
||||
this.eventEmitter.emit(Events.MESSAGES_UPSERT, {
|
||||
instanceName: this.instance.name,
|
||||
message,
|
||||
contact,
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Baileys Service Pattern
|
||||
|
||||
### Baileys Integration Service
|
||||
```typescript
|
||||
export class BaileysStartupService extends ChannelStartupService {
|
||||
constructor(
|
||||
configService: ConfigService,
|
||||
eventEmitter: EventEmitter2,
|
||||
prismaRepository: PrismaRepository,
|
||||
cache: CacheService,
|
||||
chatwootCache: CacheService,
|
||||
baileysCache: CacheService,
|
||||
providerFiles: ProviderFiles,
|
||||
) {
|
||||
super(configService, eventEmitter, prismaRepository, cache, chatwootCache);
|
||||
}
|
||||
|
||||
public async connectToWhatsapp(): Promise<void> {
|
||||
const authPath = path.join(INSTANCE_DIR, this.instance.name);
|
||||
const { state, saveCreds } = await useMultiFileAuthState(authPath);
|
||||
|
||||
this.client = makeWASocket({
|
||||
auth: state,
|
||||
logger: P({ level: 'error' }),
|
||||
printQRInTerminal: false,
|
||||
browser: ['Evolution API', 'Chrome', '4.0.0'],
|
||||
defaultQueryTimeoutMs: 60000,
|
||||
});
|
||||
|
||||
this.setupEventHandlers();
|
||||
this.client.ev.on('creds.update', saveCreds);
|
||||
}
|
||||
|
||||
private setupEventHandlers(): void {
|
||||
this.client.ev.on('connection.update', (update) => {
|
||||
this.handleConnectionUpdate(update);
|
||||
});
|
||||
|
||||
this.client.ev.on('messages.upsert', ({ messages, type }) => {
|
||||
this.handleIncomingMessages(messages, type);
|
||||
});
|
||||
|
||||
this.client.ev.on('messages.update', (updates) => {
|
||||
this.handleMessageUpdates(updates);
|
||||
});
|
||||
|
||||
this.client.ev.on('contacts.upsert', (contacts) => {
|
||||
this.handleContactsUpdate(contacts);
|
||||
});
|
||||
|
||||
this.client.ev.on('chats.upsert', (chats) => {
|
||||
this.handleChatsUpdate(chats);
|
||||
});
|
||||
}
|
||||
|
||||
private async handleConnectionUpdate(update: ConnectionUpdate): Promise<void> {
|
||||
const { connection, lastDisconnect, qr } = update;
|
||||
|
||||
if (qr) {
|
||||
this.instance.qrcode = {
|
||||
count: this.instance.qrcode?.count ? this.instance.qrcode.count + 1 : 1,
|
||||
base64: qr,
|
||||
};
|
||||
|
||||
this.eventEmitter.emit(Events.QRCODE_UPDATED, {
|
||||
instanceName: this.instance.name,
|
||||
qrcode: this.instance.qrcode,
|
||||
});
|
||||
}
|
||||
|
||||
if (connection === 'close') {
|
||||
const shouldReconnect = (lastDisconnect?.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut;
|
||||
|
||||
if (shouldReconnect) {
|
||||
this.logger.log('Connection closed, reconnecting...');
|
||||
await this.connectToWhatsapp();
|
||||
} else {
|
||||
this.logger.log('Connection closed, logged out');
|
||||
this.eventEmitter.emit(Events.LOGOUT_INSTANCE, {
|
||||
instanceName: this.instance.name,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (connection === 'open') {
|
||||
this.logger.log('Connection opened successfully');
|
||||
this.instance.wuid = this.client.user?.id;
|
||||
|
||||
this.eventEmitter.emit(Events.CONNECTION_UPDATE, {
|
||||
instanceName: this.instance.name,
|
||||
state: 'open',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public async sendMessage(data: SendTextDto): Promise<any> {
|
||||
const jid = createJid(data.number);
|
||||
|
||||
const message = {
|
||||
text: data.text,
|
||||
};
|
||||
|
||||
if (data.linkPreview !== undefined) {
|
||||
message.linkPreview = data.linkPreview;
|
||||
}
|
||||
|
||||
if (data.mentionsEveryOne) {
|
||||
// Handle mentions
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await this.client.sendMessage(jid, message);
|
||||
return response;
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to send message: ${error.message}`);
|
||||
throw new BadRequestException('Failed to send message');
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Channel Router Pattern
|
||||
|
||||
### Channel Router Structure
|
||||
```typescript
|
||||
export class ChannelRouter {
|
||||
public readonly router: Router;
|
||||
|
||||
constructor(configService: any, ...guards: any[]) {
|
||||
this.router = Router();
|
||||
|
||||
this.router.use('/', new EvolutionRouter(configService).router);
|
||||
this.router.use('/', new MetaRouter(configService).router);
|
||||
this.router.use('/baileys', new BaileysRouter(...guards).router);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Specific Channel Router
|
||||
```typescript
|
||||
export class EvolutionRouter extends RouterBroker {
|
||||
constructor(private readonly configService: ConfigService) {
|
||||
super();
|
||||
this.router
|
||||
.post(this.routerPath('webhook'), async (req, res) => {
|
||||
const response = await evolutionController.receiveWebhook(req.body);
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
});
|
||||
}
|
||||
|
||||
public readonly router: Router = Router();
|
||||
}
|
||||
```
|
||||
|
||||
## Integration Types
|
||||
|
||||
### Channel Data Types
|
||||
```typescript
|
||||
type ChannelDataType = {
|
||||
configService: ConfigService;
|
||||
eventEmitter: EventEmitter2;
|
||||
prismaRepository: PrismaRepository;
|
||||
cache: CacheService;
|
||||
chatwootCache: CacheService;
|
||||
baileysCache: CacheService;
|
||||
providerFiles: ProviderFiles;
|
||||
};
|
||||
|
||||
export enum Integration {
|
||||
WHATSAPP_BUSINESS = 'WHATSAPP-BUSINESS',
|
||||
WHATSAPP_BAILEYS = 'WHATSAPP-BAILEYS',
|
||||
EVOLUTION = 'EVOLUTION',
|
||||
}
|
||||
```
|
||||
|
||||
## Error Handling in Channels
|
||||
|
||||
### Channel-Specific Error Handling
|
||||
```typescript
|
||||
// CORRECT - Channel-specific error handling
|
||||
public async sendMessage(data: SendTextDto): Promise<any> {
|
||||
try {
|
||||
const response = await this.channelSpecificSend(data);
|
||||
return response;
|
||||
} catch (error) {
|
||||
this.logger.error(`${this.constructor.name} send failed: ${error.message}`);
|
||||
|
||||
if (error.response?.status === 401) {
|
||||
throw new UnauthorizedException('Invalid token for channel');
|
||||
}
|
||||
|
||||
if (error.response?.status === 429) {
|
||||
throw new BadRequestException('Rate limit exceeded');
|
||||
}
|
||||
|
||||
throw new InternalServerErrorException('Channel communication failed');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Channel Testing Pattern
|
||||
|
||||
### Channel Service Testing
|
||||
```typescript
|
||||
describe('EvolutionStartupService', () => {
|
||||
let service: EvolutionStartupService;
|
||||
let configService: jest.Mocked<ConfigService>;
|
||||
let eventEmitter: jest.Mocked<EventEmitter2>;
|
||||
|
||||
beforeEach(() => {
|
||||
const mockConfig = {
|
||||
get: jest.fn().mockReturnValue({
|
||||
API_URL: 'https://api.evolution.com',
|
||||
}),
|
||||
};
|
||||
|
||||
service = new EvolutionStartupService(
|
||||
mockConfig as any,
|
||||
eventEmitter,
|
||||
prismaRepository,
|
||||
cache,
|
||||
chatwootCache,
|
||||
);
|
||||
});
|
||||
|
||||
describe('sendMessage', () => {
|
||||
it('should send message successfully', async () => {
|
||||
const data = { number: '5511999999999', text: 'Test message' };
|
||||
|
||||
// Mock axios response
|
||||
jest.spyOn(axios, 'post').mockResolvedValue({
|
||||
data: { success: true, messageId: '123' },
|
||||
});
|
||||
|
||||
const result = await service.sendMessage(data);
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
expect(axios.post).toHaveBeenCalledWith(
|
||||
expect.stringContaining('/send-message'),
|
||||
data,
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
'Authorization': expect.stringContaining('Bearer'),
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
597
.cursor/rules/specialized-rules/integration-chatbot-rules.mdc
Normal file
597
.cursor/rules/specialized-rules/integration-chatbot-rules.mdc
Normal file
@@ -0,0 +1,597 @@
|
||||
---
|
||||
description: Chatbot integration patterns for Evolution API
|
||||
globs:
|
||||
- "src/api/integrations/chatbot/**/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Chatbot Integration Rules
|
||||
|
||||
## Base Chatbot Pattern
|
||||
|
||||
### Base Chatbot DTO
|
||||
```typescript
|
||||
/**
|
||||
* Base DTO for all chatbot integrations
|
||||
* Contains common properties shared by all chatbot types
|
||||
*/
|
||||
export class BaseChatbotDto {
|
||||
enabled?: boolean;
|
||||
description: string;
|
||||
expire?: number;
|
||||
keywordFinish?: string;
|
||||
delayMessage?: number;
|
||||
unknownMessage?: string;
|
||||
listeningFromMe?: boolean;
|
||||
stopBotFromMe?: boolean;
|
||||
keepOpen?: boolean;
|
||||
debounceTime?: number;
|
||||
triggerType: TriggerType;
|
||||
triggerOperator?: TriggerOperator;
|
||||
triggerValue?: string;
|
||||
ignoreJids?: string[];
|
||||
splitMessages?: boolean;
|
||||
timePerChar?: number;
|
||||
}
|
||||
```
|
||||
|
||||
### Base Chatbot Controller
|
||||
```typescript
|
||||
export abstract class BaseChatbotController<BotType = any, BotData extends BaseChatbotDto = BaseChatbotDto>
|
||||
extends ChatbotController
|
||||
implements ChatbotControllerInterface
|
||||
{
|
||||
public readonly logger: Logger;
|
||||
integrationEnabled: boolean;
|
||||
botRepository: any;
|
||||
settingsRepository: any;
|
||||
sessionRepository: any;
|
||||
userMessageDebounce: { [key: string]: { message: string; timeoutId: NodeJS.Timeout } } = {};
|
||||
|
||||
// Abstract methods to be implemented by specific chatbots
|
||||
protected abstract readonly integrationName: string;
|
||||
protected abstract processBot(
|
||||
waInstance: any,
|
||||
remoteJid: string,
|
||||
bot: BotType,
|
||||
session: any,
|
||||
settings: ChatbotSettings,
|
||||
content: string,
|
||||
pushName?: string,
|
||||
msg?: any,
|
||||
): Promise<void>;
|
||||
protected abstract getFallbackBotId(settings: any): string | undefined;
|
||||
|
||||
constructor(prismaRepository: PrismaRepository, waMonitor: WAMonitoringService) {
|
||||
super(prismaRepository, waMonitor);
|
||||
this.sessionRepository = this.prismaRepository.integrationSession;
|
||||
}
|
||||
|
||||
// Base implementation methods
|
||||
public async createBot(instance: InstanceDto, data: BotData) {
|
||||
if (!data.enabled) {
|
||||
throw new BadRequestException(`${this.integrationName} is disabled`);
|
||||
}
|
||||
|
||||
// Common bot creation logic
|
||||
const bot = await this.botRepository.create({
|
||||
data: {
|
||||
...data,
|
||||
instanceId: instance.instanceId,
|
||||
},
|
||||
});
|
||||
|
||||
return bot;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Base Chatbot Service
|
||||
```typescript
|
||||
/**
|
||||
* Base class for all chatbot service implementations
|
||||
* Contains common methods shared across different chatbot integrations
|
||||
*/
|
||||
export abstract class BaseChatbotService<BotType = any, SettingsType = any> {
|
||||
protected readonly logger: Logger;
|
||||
protected readonly waMonitor: WAMonitoringService;
|
||||
protected readonly prismaRepository: PrismaRepository;
|
||||
protected readonly configService?: ConfigService;
|
||||
|
||||
constructor(
|
||||
waMonitor: WAMonitoringService,
|
||||
prismaRepository: PrismaRepository,
|
||||
loggerName: string,
|
||||
configService?: ConfigService,
|
||||
) {
|
||||
this.waMonitor = waMonitor;
|
||||
this.prismaRepository = prismaRepository;
|
||||
this.logger = new Logger(loggerName);
|
||||
this.configService = configService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a message contains an image
|
||||
*/
|
||||
protected isImageMessage(content: string): boolean {
|
||||
return content.includes('imageMessage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract text content from message
|
||||
*/
|
||||
protected getMessageContent(msg: any): string {
|
||||
return getConversationMessage(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send typing indicator
|
||||
*/
|
||||
protected async sendTyping(instanceName: string, remoteJid: string): Promise<void> {
|
||||
await this.waMonitor.waInstances[instanceName].sendPresence(remoteJid, 'composing');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Typebot Integration Pattern
|
||||
|
||||
### Typebot Service
|
||||
```typescript
|
||||
export class TypebotService extends BaseChatbotService<TypebotModel, any> {
|
||||
constructor(
|
||||
waMonitor: WAMonitoringService,
|
||||
configService: ConfigService,
|
||||
prismaRepository: PrismaRepository,
|
||||
private readonly openaiService: OpenaiService,
|
||||
) {
|
||||
super(waMonitor, prismaRepository, 'TypebotService', configService);
|
||||
}
|
||||
|
||||
public async sendTypebotMessage(
|
||||
instanceName: string,
|
||||
remoteJid: string,
|
||||
typebot: TypebotModel,
|
||||
content: string,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${typebot.url}/api/v1/typebots/${typebot.typebot}/startChat`,
|
||||
{
|
||||
message: content,
|
||||
sessionId: `${instanceName}-${remoteJid}`,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const { messages } = response.data;
|
||||
|
||||
for (const message of messages) {
|
||||
await this.processTypebotMessage(instanceName, remoteJid, message);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Typebot API error: ${error.message}`);
|
||||
throw new InternalServerErrorException('Typebot communication failed');
|
||||
}
|
||||
}
|
||||
|
||||
private async processTypebotMessage(
|
||||
instanceName: string,
|
||||
remoteJid: string,
|
||||
message: any,
|
||||
): Promise<void> {
|
||||
const waInstance = this.waMonitor.waInstances[instanceName];
|
||||
|
||||
if (message.type === 'text') {
|
||||
await waInstance.sendMessage({
|
||||
number: remoteJid.split('@')[0],
|
||||
text: message.content.richText[0].children[0].text,
|
||||
});
|
||||
}
|
||||
|
||||
if (message.type === 'image') {
|
||||
await waInstance.sendMessage({
|
||||
number: remoteJid.split('@')[0],
|
||||
mediaMessage: {
|
||||
mediatype: 'image',
|
||||
media: message.content.url,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## OpenAI Integration Pattern
|
||||
|
||||
### OpenAI Service
|
||||
```typescript
|
||||
export class OpenaiService extends BaseChatbotService<OpenaiModel, any> {
|
||||
constructor(
|
||||
waMonitor: WAMonitoringService,
|
||||
prismaRepository: PrismaRepository,
|
||||
configService: ConfigService,
|
||||
) {
|
||||
super(waMonitor, prismaRepository, 'OpenaiService', configService);
|
||||
}
|
||||
|
||||
public async sendOpenaiMessage(
|
||||
instanceName: string,
|
||||
remoteJid: string,
|
||||
openai: OpenaiModel,
|
||||
content: string,
|
||||
pushName?: string,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const openaiConfig = this.configService.get<Openai>('OPENAI');
|
||||
|
||||
const response = await axios.post(
|
||||
'https://api.openai.com/v1/chat/completions',
|
||||
{
|
||||
model: openai.model || 'gpt-3.5-turbo',
|
||||
messages: [
|
||||
{
|
||||
role: 'system',
|
||||
content: openai.systemMessage || 'You are a helpful assistant.',
|
||||
},
|
||||
{
|
||||
role: 'user',
|
||||
content: content,
|
||||
},
|
||||
],
|
||||
max_tokens: openai.maxTokens || 1000,
|
||||
temperature: openai.temperature || 0.7,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Authorization': `Bearer ${openai.apiKey || openaiConfig.API_KEY}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const aiResponse = response.data.choices[0].message.content;
|
||||
|
||||
await this.waMonitor.waInstances[instanceName].sendMessage({
|
||||
number: remoteJid.split('@')[0],
|
||||
text: aiResponse,
|
||||
});
|
||||
} catch (error) {
|
||||
this.logger.error(`OpenAI API error: ${error.message}`);
|
||||
|
||||
// Send fallback message
|
||||
await this.waMonitor.waInstances[instanceName].sendMessage({
|
||||
number: remoteJid.split('@')[0],
|
||||
text: openai.unknownMessage || 'Desculpe, não consegui processar sua mensagem.',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Chatwoot Integration Pattern
|
||||
|
||||
### Chatwoot Service
|
||||
```typescript
|
||||
export class ChatwootService extends BaseChatbotService<any, any> {
|
||||
constructor(
|
||||
waMonitor: WAMonitoringService,
|
||||
configService: ConfigService,
|
||||
prismaRepository: PrismaRepository,
|
||||
private readonly chatwootCache: CacheService,
|
||||
) {
|
||||
super(waMonitor, prismaRepository, 'ChatwootService', configService);
|
||||
}
|
||||
|
||||
public async eventWhatsapp(
|
||||
event: Events,
|
||||
instanceName: { instanceName: string },
|
||||
data: any,
|
||||
): Promise<void> {
|
||||
const chatwootConfig = this.configService.get<Chatwoot>('CHATWOOT');
|
||||
|
||||
if (!chatwootConfig.ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const instance = await this.prismaRepository.instance.findUnique({
|
||||
where: { name: instanceName.instanceName },
|
||||
});
|
||||
|
||||
if (!instance?.chatwootAccountId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const webhook = {
|
||||
event,
|
||||
instance: instanceName.instanceName,
|
||||
data,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
|
||||
await axios.post(
|
||||
`${instance.chatwootUrl}/api/v1/accounts/${instance.chatwootAccountId}/webhooks`,
|
||||
webhook,
|
||||
{
|
||||
headers: {
|
||||
'Authorization': `Bearer ${instance.chatwootToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
this.logger.error(`Chatwoot webhook error: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
public async createConversation(
|
||||
instanceName: string,
|
||||
contact: any,
|
||||
message: any,
|
||||
): Promise<void> {
|
||||
// Create conversation in Chatwoot
|
||||
const instance = await this.prismaRepository.instance.findUnique({
|
||||
where: { name: instanceName },
|
||||
});
|
||||
|
||||
if (!instance?.chatwootAccountId) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const conversation = await axios.post(
|
||||
`${instance.chatwootUrl}/api/v1/accounts/${instance.chatwootAccountId}/conversations`,
|
||||
{
|
||||
source_id: contact.id,
|
||||
inbox_id: instance.chatwootInboxId,
|
||||
contact_id: contact.chatwootContactId,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Authorization': `Bearer ${instance.chatwootToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Cache conversation
|
||||
await this.chatwootCache.set(
|
||||
`conversation:${instanceName}:${contact.id}`,
|
||||
conversation.data,
|
||||
3600
|
||||
);
|
||||
} catch (error) {
|
||||
this.logger.error(`Chatwoot conversation creation error: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Dify Integration Pattern
|
||||
|
||||
### Dify Service
|
||||
```typescript
|
||||
export class DifyService extends BaseChatbotService<DifyModel, any> {
|
||||
constructor(
|
||||
waMonitor: WAMonitoringService,
|
||||
prismaRepository: PrismaRepository,
|
||||
configService: ConfigService,
|
||||
private readonly openaiService: OpenaiService,
|
||||
) {
|
||||
super(waMonitor, prismaRepository, 'DifyService', configService);
|
||||
}
|
||||
|
||||
public async sendDifyMessage(
|
||||
instanceName: string,
|
||||
remoteJid: string,
|
||||
dify: DifyModel,
|
||||
content: string,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${dify.apiUrl}/v1/chat-messages`,
|
||||
{
|
||||
inputs: {},
|
||||
query: content,
|
||||
user: remoteJid,
|
||||
conversation_id: `${instanceName}-${remoteJid}`,
|
||||
response_mode: 'blocking',
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Authorization': `Bearer ${dify.apiKey}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const aiResponse = response.data.answer;
|
||||
|
||||
await this.waMonitor.waInstances[instanceName].sendMessage({
|
||||
number: remoteJid.split('@')[0],
|
||||
text: aiResponse,
|
||||
});
|
||||
} catch (error) {
|
||||
this.logger.error(`Dify API error: ${error.message}`);
|
||||
|
||||
// Fallback to OpenAI if configured
|
||||
if (dify.fallbackOpenai && this.openaiService) {
|
||||
await this.openaiService.sendOpenaiMessage(instanceName, remoteJid, dify.openaiBot, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Chatbot Router Pattern
|
||||
|
||||
### Chatbot Router Structure (Evolution API Real Pattern)
|
||||
```typescript
|
||||
export class ChatbotRouter {
|
||||
public readonly router: Router;
|
||||
|
||||
constructor(...guards: any[]) {
|
||||
this.router = Router();
|
||||
|
||||
// Real Evolution API chatbot integrations
|
||||
this.router.use('/evolutionBot', new EvolutionBotRouter(...guards).router);
|
||||
this.router.use('/chatwoot', new ChatwootRouter(...guards).router);
|
||||
this.router.use('/typebot', new TypebotRouter(...guards).router);
|
||||
this.router.use('/openai', new OpenaiRouter(...guards).router);
|
||||
this.router.use('/dify', new DifyRouter(...guards).router);
|
||||
this.router.use('/flowise', new FlowiseRouter(...guards).router);
|
||||
this.router.use('/n8n', new N8nRouter(...guards).router);
|
||||
this.router.use('/evoai', new EvoaiRouter(...guards).router);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Chatbot Validation Patterns
|
||||
|
||||
### Chatbot Schema Validation (Evolution API Pattern)
|
||||
```typescript
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
const isNotEmpty = (...fields: string[]) => {
|
||||
const properties = {};
|
||||
fields.forEach((field) => {
|
||||
properties[field] = {
|
||||
if: { properties: { [field]: { type: 'string' } } },
|
||||
then: { properties: { [field]: { minLength: 1 } } },
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
allOf: Object.values(properties),
|
||||
};
|
||||
};
|
||||
|
||||
export const evolutionBotSchema: JSONSchema7 = {
|
||||
$id: v4(),
|
||||
type: 'object',
|
||||
properties: {
|
||||
enabled: { type: 'boolean' },
|
||||
description: { type: 'string' },
|
||||
apiUrl: { type: 'string' },
|
||||
apiKey: { type: 'string' },
|
||||
triggerType: { type: 'string', enum: ['all', 'keyword', 'none', 'advanced'] },
|
||||
triggerOperator: { type: 'string', enum: ['equals', 'contains', 'startsWith', 'endsWith', 'regex'] },
|
||||
triggerValue: { type: 'string' },
|
||||
expire: { type: 'integer' },
|
||||
keywordFinish: { type: 'string' },
|
||||
delayMessage: { type: 'integer' },
|
||||
unknownMessage: { type: 'string' },
|
||||
listeningFromMe: { type: 'boolean' },
|
||||
stopBotFromMe: { type: 'boolean' },
|
||||
keepOpen: { type: 'boolean' },
|
||||
debounceTime: { type: 'integer' },
|
||||
ignoreJids: { type: 'array', items: { type: 'string' } },
|
||||
splitMessages: { type: 'boolean' },
|
||||
timePerChar: { type: 'integer' },
|
||||
},
|
||||
required: ['enabled', 'apiUrl', 'triggerType'],
|
||||
...isNotEmpty('enabled', 'apiUrl', 'triggerType'),
|
||||
};
|
||||
|
||||
function validateKeywordTrigger(
|
||||
content: string,
|
||||
operator: TriggerOperator,
|
||||
value: string,
|
||||
): boolean {
|
||||
const normalizedContent = content.toLowerCase().trim();
|
||||
const normalizedValue = value.toLowerCase().trim();
|
||||
|
||||
switch (operator) {
|
||||
case TriggerOperator.EQUALS:
|
||||
return normalizedContent === normalizedValue;
|
||||
case TriggerOperator.CONTAINS:
|
||||
return normalizedContent.includes(normalizedValue);
|
||||
case TriggerOperator.STARTS_WITH:
|
||||
return normalizedContent.startsWith(normalizedValue);
|
||||
case TriggerOperator.ENDS_WITH:
|
||||
return normalizedContent.endsWith(normalizedValue);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Session Management Pattern
|
||||
|
||||
### Chatbot Session Handling
|
||||
```typescript
|
||||
export class ChatbotSessionManager {
|
||||
constructor(
|
||||
private readonly prismaRepository: PrismaRepository,
|
||||
private readonly cache: CacheService,
|
||||
) {}
|
||||
|
||||
public async getSession(
|
||||
instanceName: string,
|
||||
remoteJid: string,
|
||||
botId: string,
|
||||
): Promise<IntegrationSession | null> {
|
||||
const cacheKey = `session:${instanceName}:${remoteJid}:${botId}`;
|
||||
|
||||
// Try cache first
|
||||
let session = await this.cache.get(cacheKey);
|
||||
if (session) {
|
||||
return session;
|
||||
}
|
||||
|
||||
// Query database
|
||||
session = await this.prismaRepository.integrationSession.findFirst({
|
||||
where: {
|
||||
instanceId: instanceName,
|
||||
remoteJid,
|
||||
botId,
|
||||
status: 'opened',
|
||||
},
|
||||
});
|
||||
|
||||
// Cache result
|
||||
if (session) {
|
||||
await this.cache.set(cacheKey, session, 300); // 5 min TTL
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
public async createSession(
|
||||
instanceName: string,
|
||||
remoteJid: string,
|
||||
botId: string,
|
||||
): Promise<IntegrationSession> {
|
||||
const session = await this.prismaRepository.integrationSession.create({
|
||||
data: {
|
||||
instanceId: instanceName,
|
||||
remoteJid,
|
||||
botId,
|
||||
status: 'opened',
|
||||
createdAt: new Date(),
|
||||
},
|
||||
});
|
||||
|
||||
// Cache new session
|
||||
const cacheKey = `session:${instanceName}:${remoteJid}:${botId}`;
|
||||
await this.cache.set(cacheKey, session, 300);
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
public async closeSession(sessionId: string): Promise<void> {
|
||||
await this.prismaRepository.integrationSession.update({
|
||||
where: { id: sessionId },
|
||||
data: { status: 'closed', updatedAt: new Date() },
|
||||
});
|
||||
|
||||
// Invalidate cache
|
||||
// Note: In a real implementation, you'd need to track cache keys by session ID
|
||||
}
|
||||
}
|
||||
```
|
||||
851
.cursor/rules/specialized-rules/integration-event-rules.mdc
Normal file
851
.cursor/rules/specialized-rules/integration-event-rules.mdc
Normal file
@@ -0,0 +1,851 @@
|
||||
---
|
||||
description: Event integration patterns for Evolution API
|
||||
globs:
|
||||
- "src/api/integrations/event/**/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Event Integration Rules
|
||||
|
||||
## Event Manager Pattern
|
||||
|
||||
### Event Manager Structure
|
||||
```typescript
|
||||
import { PrismaRepository } from '@api/repository/repository.service';
|
||||
import { ConfigService } from '@config/env.config';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { Server } from 'http';
|
||||
|
||||
export class EventManager {
|
||||
private prismaRepository: PrismaRepository;
|
||||
private configService: ConfigService;
|
||||
private logger = new Logger('EventManager');
|
||||
|
||||
// Event integrations
|
||||
private webhook: WebhookController;
|
||||
private websocket: WebsocketController;
|
||||
private rabbitmq: RabbitmqController;
|
||||
private nats: NatsController;
|
||||
private sqs: SqsController;
|
||||
private pusher: PusherController;
|
||||
|
||||
constructor(
|
||||
prismaRepository: PrismaRepository,
|
||||
configService: ConfigService,
|
||||
server?: Server,
|
||||
) {
|
||||
this.prismaRepository = prismaRepository;
|
||||
this.configService = configService;
|
||||
|
||||
// Initialize event controllers
|
||||
this.webhook = new WebhookController(prismaRepository, configService);
|
||||
this.websocket = new WebsocketController(prismaRepository, configService, server);
|
||||
this.rabbitmq = new RabbitmqController(prismaRepository, configService);
|
||||
this.nats = new NatsController(prismaRepository, configService);
|
||||
this.sqs = new SqsController(prismaRepository, configService);
|
||||
this.pusher = new PusherController(prismaRepository, configService);
|
||||
}
|
||||
|
||||
public async emit(eventData: {
|
||||
instanceName: string;
|
||||
origin: string;
|
||||
event: string;
|
||||
data: Object;
|
||||
serverUrl: string;
|
||||
dateTime: string;
|
||||
sender: string;
|
||||
apiKey?: string;
|
||||
local?: boolean;
|
||||
integration?: string[];
|
||||
}): Promise<void> {
|
||||
this.logger.log(`Emitting event ${eventData.event} for instance ${eventData.instanceName}`);
|
||||
|
||||
// Emit to all configured integrations
|
||||
await Promise.allSettled([
|
||||
this.webhook.emit(eventData),
|
||||
this.websocket.emit(eventData),
|
||||
this.rabbitmq.emit(eventData),
|
||||
this.nats.emit(eventData),
|
||||
this.sqs.emit(eventData),
|
||||
this.pusher.emit(eventData),
|
||||
]);
|
||||
}
|
||||
|
||||
public async setInstance(instanceName: string, data: any): Promise<any> {
|
||||
const promises = [];
|
||||
|
||||
if (data.websocket) {
|
||||
promises.push(
|
||||
this.websocket.set(instanceName, {
|
||||
websocket: {
|
||||
enabled: true,
|
||||
events: data.websocket?.events,
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (data.rabbitmq) {
|
||||
promises.push(
|
||||
this.rabbitmq.set(instanceName, {
|
||||
rabbitmq: {
|
||||
enabled: true,
|
||||
events: data.rabbitmq?.events,
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (data.webhook) {
|
||||
promises.push(
|
||||
this.webhook.set(instanceName, {
|
||||
webhook: {
|
||||
enabled: true,
|
||||
events: data.webhook?.events,
|
||||
url: data.webhook?.url,
|
||||
headers: data.webhook?.headers,
|
||||
base64: data.webhook?.base64,
|
||||
byEvents: data.webhook?.byEvents,
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// Set other integrations...
|
||||
|
||||
await Promise.allSettled(promises);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Base Event Controller Pattern
|
||||
|
||||
### Abstract Event Controller
|
||||
```typescript
|
||||
import { PrismaRepository } from '@api/repository/repository.service';
|
||||
import { ConfigService } from '@config/env.config';
|
||||
import { Logger } from '@config/logger.config';
|
||||
|
||||
export type EmitData = {
|
||||
instanceName: string;
|
||||
origin: string;
|
||||
event: string;
|
||||
data: Object;
|
||||
serverUrl: string;
|
||||
dateTime: string;
|
||||
sender: string;
|
||||
apiKey?: string;
|
||||
local?: boolean;
|
||||
integration?: string[];
|
||||
};
|
||||
|
||||
export interface EventControllerInterface {
|
||||
integrationEnabled: boolean;
|
||||
emit(data: EmitData): Promise<void>;
|
||||
set(instanceName: string, data: any): Promise<any>;
|
||||
}
|
||||
|
||||
export abstract class EventController implements EventControllerInterface {
|
||||
protected readonly logger: Logger;
|
||||
protected readonly prismaRepository: PrismaRepository;
|
||||
protected readonly configService: ConfigService;
|
||||
|
||||
public integrationEnabled: boolean = false;
|
||||
|
||||
// Available events for all integrations
|
||||
public static readonly events = [
|
||||
'APPLICATION_STARTUP',
|
||||
'INSTANCE_CREATE',
|
||||
'INSTANCE_DELETE',
|
||||
'QRCODE_UPDATED',
|
||||
'CONNECTION_UPDATE',
|
||||
'STATUS_INSTANCE',
|
||||
'MESSAGES_SET',
|
||||
'MESSAGES_UPSERT',
|
||||
'MESSAGES_EDITED',
|
||||
'MESSAGES_UPDATE',
|
||||
'MESSAGES_DELETE',
|
||||
'SEND_MESSAGE',
|
||||
'CONTACTS_SET',
|
||||
'CONTACTS_UPSERT',
|
||||
'CONTACTS_UPDATE',
|
||||
'PRESENCE_UPDATE',
|
||||
'CHATS_SET',
|
||||
'CHATS_UPDATE',
|
||||
'CHATS_UPSERT',
|
||||
'CHATS_DELETE',
|
||||
'GROUPS_UPSERT',
|
||||
'GROUPS_UPDATE',
|
||||
'GROUP_PARTICIPANTS_UPDATE',
|
||||
'CALL',
|
||||
'TYPEBOT_START',
|
||||
'TYPEBOT_CHANGE_STATUS',
|
||||
'LABELS_EDIT',
|
||||
'LABELS_ASSOCIATION',
|
||||
'CREDS_UPDATE',
|
||||
'MESSAGING_HISTORY_SET',
|
||||
'REMOVE_INSTANCE',
|
||||
'LOGOUT_INSTANCE',
|
||||
];
|
||||
|
||||
constructor(
|
||||
prismaRepository: PrismaRepository,
|
||||
configService: ConfigService,
|
||||
loggerName: string,
|
||||
) {
|
||||
this.prismaRepository = prismaRepository;
|
||||
this.configService = configService;
|
||||
this.logger = new Logger(loggerName);
|
||||
}
|
||||
|
||||
// Abstract methods to be implemented by specific integrations
|
||||
public abstract emit(data: EmitData): Promise<void>;
|
||||
public abstract set(instanceName: string, data: any): Promise<any>;
|
||||
|
||||
// Helper method to check if event should be processed
|
||||
protected shouldProcessEvent(eventName: string, configuredEvents?: string[]): boolean {
|
||||
if (!configuredEvents || configuredEvents.length === 0) {
|
||||
return true; // Process all events if none specified
|
||||
}
|
||||
return configuredEvents.includes(eventName);
|
||||
}
|
||||
|
||||
// Helper method to get instance configuration
|
||||
protected async getInstanceConfig(instanceName: string): Promise<any> {
|
||||
try {
|
||||
const instance = await this.prismaRepository.instance.findUnique({
|
||||
where: { name: instanceName },
|
||||
});
|
||||
return instance;
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to get instance config for ${instanceName}:`, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Webhook Integration Pattern
|
||||
|
||||
### Webhook Controller Implementation
|
||||
```typescript
|
||||
export class WebhookController extends EventController {
|
||||
constructor(
|
||||
prismaRepository: PrismaRepository,
|
||||
configService: ConfigService,
|
||||
) {
|
||||
super(prismaRepository, configService, 'WebhookController');
|
||||
}
|
||||
|
||||
public async emit(data: EmitData): Promise<void> {
|
||||
try {
|
||||
const instance = await this.getInstanceConfig(data.instanceName);
|
||||
if (!instance?.webhook?.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const webhookConfig = instance.webhook;
|
||||
|
||||
if (!this.shouldProcessEvent(data.event, webhookConfig.events)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
event: data.event,
|
||||
instance: data.instanceName,
|
||||
data: data.data,
|
||||
timestamp: data.dateTime,
|
||||
sender: data.sender,
|
||||
server: {
|
||||
version: process.env.npm_package_version,
|
||||
url: data.serverUrl,
|
||||
},
|
||||
};
|
||||
|
||||
// Encode data as base64 if configured
|
||||
if (webhookConfig.base64) {
|
||||
payload.data = Buffer.from(JSON.stringify(payload.data)).toString('base64');
|
||||
}
|
||||
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent': 'Evolution-API-Webhook',
|
||||
...webhookConfig.headers,
|
||||
};
|
||||
|
||||
if (webhookConfig.byEvents) {
|
||||
// Send to event-specific endpoint
|
||||
const eventUrl = `${webhookConfig.url}/${data.event.toLowerCase()}`;
|
||||
await this.sendWebhook(eventUrl, payload, headers);
|
||||
} else {
|
||||
// Send to main webhook URL
|
||||
await this.sendWebhook(webhookConfig.url, payload, headers);
|
||||
}
|
||||
|
||||
this.logger.log(`Webhook sent for event ${data.event} to instance ${data.instanceName}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Webhook emission failed for ${data.instanceName}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
public async set(instanceName: string, data: any): Promise<any> {
|
||||
try {
|
||||
const webhookData = data.webhook;
|
||||
|
||||
await this.prismaRepository.instance.update({
|
||||
where: { name: instanceName },
|
||||
data: {
|
||||
webhook: webhookData,
|
||||
},
|
||||
});
|
||||
|
||||
this.logger.log(`Webhook configuration set for instance ${instanceName}`);
|
||||
return { webhook: webhookData };
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to set webhook config for ${instanceName}:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
private async sendWebhook(url: string, payload: any, headers: any): Promise<void> {
|
||||
try {
|
||||
const response = await axios.post(url, payload, {
|
||||
headers,
|
||||
timeout: 30000,
|
||||
maxRedirects: 3,
|
||||
});
|
||||
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
this.logger.log(`Webhook delivered successfully to ${url}`);
|
||||
} else {
|
||||
this.logger.warn(`Webhook returned status ${response.status} for ${url}`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Webhook delivery failed to ${url}:`, error.message);
|
||||
|
||||
// Implement retry logic here if needed
|
||||
if (error.response?.status >= 500) {
|
||||
// Server error - might be worth retrying
|
||||
this.logger.log(`Server error detected, webhook might be retried later`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## WebSocket Integration Pattern
|
||||
|
||||
### WebSocket Controller Implementation
|
||||
```typescript
|
||||
import { Server as SocketIOServer } from 'socket.io';
|
||||
import { Server } from 'http';
|
||||
|
||||
export class WebsocketController extends EventController {
|
||||
private io: SocketIOServer;
|
||||
|
||||
constructor(
|
||||
prismaRepository: PrismaRepository,
|
||||
configService: ConfigService,
|
||||
server?: Server,
|
||||
) {
|
||||
super(prismaRepository, configService, 'WebsocketController');
|
||||
|
||||
if (server) {
|
||||
this.io = new SocketIOServer(server, {
|
||||
cors: {
|
||||
origin: "*",
|
||||
methods: ["GET", "POST"],
|
||||
},
|
||||
});
|
||||
|
||||
this.setupSocketHandlers();
|
||||
}
|
||||
}
|
||||
|
||||
private setupSocketHandlers(): void {
|
||||
this.io.on('connection', (socket) => {
|
||||
this.logger.log(`WebSocket client connected: ${socket.id}`);
|
||||
|
||||
socket.on('join-instance', (instanceName: string) => {
|
||||
socket.join(`instance:${instanceName}`);
|
||||
this.logger.log(`Client ${socket.id} joined instance ${instanceName}`);
|
||||
});
|
||||
|
||||
socket.on('leave-instance', (instanceName: string) => {
|
||||
socket.leave(`instance:${instanceName}`);
|
||||
this.logger.log(`Client ${socket.id} left instance ${instanceName}`);
|
||||
});
|
||||
|
||||
socket.on('disconnect', () => {
|
||||
this.logger.log(`WebSocket client disconnected: ${socket.id}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public async emit(data: EmitData): Promise<void> {
|
||||
if (!this.io) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const instance = await this.getInstanceConfig(data.instanceName);
|
||||
if (!instance?.websocket?.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const websocketConfig = instance.websocket;
|
||||
|
||||
if (!this.shouldProcessEvent(data.event, websocketConfig.events)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
event: data.event,
|
||||
instance: data.instanceName,
|
||||
data: data.data,
|
||||
timestamp: data.dateTime,
|
||||
sender: data.sender,
|
||||
};
|
||||
|
||||
// Emit to specific instance room
|
||||
this.io.to(`instance:${data.instanceName}`).emit('evolution-event', payload);
|
||||
|
||||
// Also emit to global room for monitoring
|
||||
this.io.emit('global-event', payload);
|
||||
|
||||
this.logger.log(`WebSocket event ${data.event} emitted for instance ${data.instanceName}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`WebSocket emission failed for ${data.instanceName}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
public async set(instanceName: string, data: any): Promise<any> {
|
||||
try {
|
||||
const websocketData = data.websocket;
|
||||
|
||||
await this.prismaRepository.instance.update({
|
||||
where: { name: instanceName },
|
||||
data: {
|
||||
websocket: websocketData,
|
||||
},
|
||||
});
|
||||
|
||||
this.logger.log(`WebSocket configuration set for instance ${instanceName}`);
|
||||
return { websocket: websocketData };
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to set WebSocket config for ${instanceName}:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Queue Integration Patterns
|
||||
|
||||
### RabbitMQ Controller Implementation
|
||||
```typescript
|
||||
import amqp from 'amqplib';
|
||||
|
||||
export class RabbitmqController extends EventController {
|
||||
private connection: amqp.Connection | null = null;
|
||||
private channel: amqp.Channel | null = null;
|
||||
|
||||
constructor(
|
||||
prismaRepository: PrismaRepository,
|
||||
configService: ConfigService,
|
||||
) {
|
||||
super(prismaRepository, configService, 'RabbitmqController');
|
||||
this.initializeConnection();
|
||||
}
|
||||
|
||||
private async initializeConnection(): Promise<void> {
|
||||
try {
|
||||
const rabbitmqConfig = this.configService.get('RABBITMQ');
|
||||
if (!rabbitmqConfig?.ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.connection = await amqp.connect(rabbitmqConfig.URI);
|
||||
this.channel = await this.connection.createChannel();
|
||||
|
||||
// Declare exchange for Evolution API events
|
||||
await this.channel.assertExchange('evolution-events', 'topic', { durable: true });
|
||||
|
||||
this.logger.log('RabbitMQ connection established');
|
||||
} catch (error) {
|
||||
this.logger.error('Failed to initialize RabbitMQ connection:', error);
|
||||
}
|
||||
}
|
||||
|
||||
public async emit(data: EmitData): Promise<void> {
|
||||
if (!this.channel) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const instance = await this.getInstanceConfig(data.instanceName);
|
||||
if (!instance?.rabbitmq?.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rabbitmqConfig = instance.rabbitmq;
|
||||
|
||||
if (!this.shouldProcessEvent(data.event, rabbitmqConfig.events)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
event: data.event,
|
||||
instance: data.instanceName,
|
||||
data: data.data,
|
||||
timestamp: data.dateTime,
|
||||
sender: data.sender,
|
||||
};
|
||||
|
||||
const routingKey = `evolution.${data.instanceName}.${data.event.toLowerCase()}`;
|
||||
|
||||
await this.channel.publish(
|
||||
'evolution-events',
|
||||
routingKey,
|
||||
Buffer.from(JSON.stringify(payload)),
|
||||
{
|
||||
persistent: true,
|
||||
timestamp: Date.now(),
|
||||
messageId: `${data.instanceName}-${Date.now()}`,
|
||||
}
|
||||
);
|
||||
|
||||
this.logger.log(`RabbitMQ message published for event ${data.event} to instance ${data.instanceName}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`RabbitMQ emission failed for ${data.instanceName}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
public async set(instanceName: string, data: any): Promise<any> {
|
||||
try {
|
||||
const rabbitmqData = data.rabbitmq;
|
||||
|
||||
await this.prismaRepository.instance.update({
|
||||
where: { name: instanceName },
|
||||
data: {
|
||||
rabbitmq: rabbitmqData,
|
||||
},
|
||||
});
|
||||
|
||||
this.logger.log(`RabbitMQ configuration set for instance ${instanceName}`);
|
||||
return { rabbitmq: rabbitmqData };
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to set RabbitMQ config for ${instanceName}:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### SQS Controller Implementation
|
||||
```typescript
|
||||
import { SQSClient, SendMessageCommand } from '@aws-sdk/client-sqs';
|
||||
|
||||
export class SqsController extends EventController {
|
||||
private sqsClient: SQSClient | null = null;
|
||||
|
||||
constructor(
|
||||
prismaRepository: PrismaRepository,
|
||||
configService: ConfigService,
|
||||
) {
|
||||
super(prismaRepository, configService, 'SqsController');
|
||||
this.initializeSQSClient();
|
||||
}
|
||||
|
||||
private initializeSQSClient(): void {
|
||||
try {
|
||||
const sqsConfig = this.configService.get('SQS');
|
||||
if (!sqsConfig?.ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.sqsClient = new SQSClient({
|
||||
region: sqsConfig.REGION,
|
||||
credentials: {
|
||||
accessKeyId: sqsConfig.ACCESS_KEY_ID,
|
||||
secretAccessKey: sqsConfig.SECRET_ACCESS_KEY,
|
||||
},
|
||||
});
|
||||
|
||||
this.logger.log('SQS client initialized');
|
||||
} catch (error) {
|
||||
this.logger.error('Failed to initialize SQS client:', error);
|
||||
}
|
||||
}
|
||||
|
||||
public async emit(data: EmitData): Promise<void> {
|
||||
if (!this.sqsClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const instance = await this.getInstanceConfig(data.instanceName);
|
||||
if (!instance?.sqs?.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sqsConfig = instance.sqs;
|
||||
|
||||
if (!this.shouldProcessEvent(data.event, sqsConfig.events)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
event: data.event,
|
||||
instance: data.instanceName,
|
||||
data: data.data,
|
||||
timestamp: data.dateTime,
|
||||
sender: data.sender,
|
||||
};
|
||||
|
||||
const command = new SendMessageCommand({
|
||||
QueueUrl: sqsConfig.queueUrl,
|
||||
MessageBody: JSON.stringify(payload),
|
||||
MessageAttributes: {
|
||||
event: {
|
||||
DataType: 'String',
|
||||
StringValue: data.event,
|
||||
},
|
||||
instance: {
|
||||
DataType: 'String',
|
||||
StringValue: data.instanceName,
|
||||
},
|
||||
},
|
||||
MessageGroupId: data.instanceName, // For FIFO queues
|
||||
MessageDeduplicationId: `${data.instanceName}-${Date.now()}`, // For FIFO queues
|
||||
});
|
||||
|
||||
await this.sqsClient.send(command);
|
||||
|
||||
this.logger.log(`SQS message sent for event ${data.event} to instance ${data.instanceName}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`SQS emission failed for ${data.instanceName}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
public async set(instanceName: string, data: any): Promise<any> {
|
||||
try {
|
||||
const sqsData = data.sqs;
|
||||
|
||||
await this.prismaRepository.instance.update({
|
||||
where: { name: instanceName },
|
||||
data: {
|
||||
sqs: sqsData,
|
||||
},
|
||||
});
|
||||
|
||||
this.logger.log(`SQS configuration set for instance ${instanceName}`);
|
||||
return { sqs: sqsData };
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to set SQS config for ${instanceName}:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Event DTO Pattern
|
||||
|
||||
### Event Configuration DTO
|
||||
```typescript
|
||||
import { JsonValue } from '@prisma/client/runtime/library';
|
||||
|
||||
export class EventDto {
|
||||
webhook?: {
|
||||
enabled?: boolean;
|
||||
events?: string[];
|
||||
url?: string;
|
||||
headers?: JsonValue;
|
||||
byEvents?: boolean;
|
||||
base64?: boolean;
|
||||
};
|
||||
|
||||
websocket?: {
|
||||
enabled?: boolean;
|
||||
events?: string[];
|
||||
};
|
||||
|
||||
sqs?: {
|
||||
enabled?: boolean;
|
||||
events?: string[];
|
||||
queueUrl?: string;
|
||||
};
|
||||
|
||||
rabbitmq?: {
|
||||
enabled?: boolean;
|
||||
events?: string[];
|
||||
exchange?: string;
|
||||
};
|
||||
|
||||
nats?: {
|
||||
enabled?: boolean;
|
||||
events?: string[];
|
||||
subject?: string;
|
||||
};
|
||||
|
||||
pusher?: {
|
||||
enabled?: boolean;
|
||||
appId?: string;
|
||||
key?: string;
|
||||
secret?: string;
|
||||
cluster?: string;
|
||||
useTLS?: boolean;
|
||||
events?: string[];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Event Router Pattern
|
||||
|
||||
### Event Router Structure
|
||||
```typescript
|
||||
import { NatsRouter } from '@api/integrations/event/nats/nats.router';
|
||||
import { PusherRouter } from '@api/integrations/event/pusher/pusher.router';
|
||||
import { RabbitmqRouter } from '@api/integrations/event/rabbitmq/rabbitmq.router';
|
||||
import { SqsRouter } from '@api/integrations/event/sqs/sqs.router';
|
||||
import { WebhookRouter } from '@api/integrations/event/webhook/webhook.router';
|
||||
import { WebsocketRouter } from '@api/integrations/event/websocket/websocket.router';
|
||||
import { Router } from 'express';
|
||||
|
||||
export class EventRouter {
|
||||
public readonly router: Router;
|
||||
|
||||
constructor(configService: any, ...guards: any[]) {
|
||||
this.router = Router();
|
||||
|
||||
this.router.use('/webhook', new WebhookRouter(configService, ...guards).router);
|
||||
this.router.use('/websocket', new WebsocketRouter(...guards).router);
|
||||
this.router.use('/rabbitmq', new RabbitmqRouter(...guards).router);
|
||||
this.router.use('/nats', new NatsRouter(...guards).router);
|
||||
this.router.use('/pusher', new PusherRouter(...guards).router);
|
||||
this.router.use('/sqs', new SqsRouter(...guards).router);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Event Validation Schema
|
||||
|
||||
### Event Configuration Validation
|
||||
```typescript
|
||||
import Joi from 'joi';
|
||||
import { EventController } from '@api/integrations/event/event.controller';
|
||||
|
||||
const eventListSchema = Joi.array().items(
|
||||
Joi.string().valid(...EventController.events)
|
||||
).optional();
|
||||
|
||||
export const webhookSchema = Joi.object({
|
||||
enabled: Joi.boolean().required(),
|
||||
url: Joi.string().when('enabled', {
|
||||
is: true,
|
||||
then: Joi.required().uri({ scheme: ['http', 'https'] }),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
events: eventListSchema,
|
||||
headers: Joi.object().pattern(Joi.string(), Joi.string()).optional(),
|
||||
byEvents: Joi.boolean().optional().default(false),
|
||||
base64: Joi.boolean().optional().default(false),
|
||||
}).required();
|
||||
|
||||
export const websocketSchema = Joi.object({
|
||||
enabled: Joi.boolean().required(),
|
||||
events: eventListSchema,
|
||||
}).required();
|
||||
|
||||
export const rabbitmqSchema = Joi.object({
|
||||
enabled: Joi.boolean().required(),
|
||||
events: eventListSchema,
|
||||
exchange: Joi.string().optional().default('evolution-events'),
|
||||
}).required();
|
||||
|
||||
export const sqsSchema = Joi.object({
|
||||
enabled: Joi.boolean().required(),
|
||||
events: eventListSchema,
|
||||
queueUrl: Joi.string().when('enabled', {
|
||||
is: true,
|
||||
then: Joi.required().uri(),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
}).required();
|
||||
|
||||
export const eventSchema = Joi.object({
|
||||
webhook: webhookSchema.optional(),
|
||||
websocket: websocketSchema.optional(),
|
||||
rabbitmq: rabbitmqSchema.optional(),
|
||||
sqs: sqsSchema.optional(),
|
||||
nats: Joi.object({
|
||||
enabled: Joi.boolean().required(),
|
||||
events: eventListSchema,
|
||||
subject: Joi.string().optional().default('evolution.events'),
|
||||
}).optional(),
|
||||
pusher: Joi.object({
|
||||
enabled: Joi.boolean().required(),
|
||||
appId: Joi.string().when('enabled', { is: true, then: Joi.required() }),
|
||||
key: Joi.string().when('enabled', { is: true, then: Joi.required() }),
|
||||
secret: Joi.string().when('enabled', { is: true, then: Joi.required() }),
|
||||
cluster: Joi.string().when('enabled', { is: true, then: Joi.required() }),
|
||||
useTLS: Joi.boolean().optional().default(true),
|
||||
events: eventListSchema,
|
||||
}).optional(),
|
||||
}).min(1).required();
|
||||
```
|
||||
|
||||
## Event Testing Pattern
|
||||
|
||||
### Event Controller Testing
|
||||
```typescript
|
||||
describe('WebhookController', () => {
|
||||
let controller: WebhookController;
|
||||
let prismaRepository: jest.Mocked<PrismaRepository>;
|
||||
let configService: jest.Mocked<ConfigService>;
|
||||
|
||||
beforeEach(() => {
|
||||
controller = new WebhookController(prismaRepository, configService);
|
||||
});
|
||||
|
||||
describe('emit', () => {
|
||||
it('should send webhook when enabled', async () => {
|
||||
const mockInstance = {
|
||||
webhook: {
|
||||
enabled: true,
|
||||
url: 'https://example.com/webhook',
|
||||
events: ['MESSAGES_UPSERT'],
|
||||
},
|
||||
};
|
||||
|
||||
prismaRepository.instance.findUnique.mockResolvedValue(mockInstance);
|
||||
jest.spyOn(axios, 'post').mockResolvedValue({ status: 200 });
|
||||
|
||||
const eventData = {
|
||||
instanceName: 'test-instance',
|
||||
event: 'MESSAGES_UPSERT',
|
||||
data: { message: 'test' },
|
||||
origin: 'test',
|
||||
serverUrl: 'http://localhost',
|
||||
dateTime: new Date().toISOString(),
|
||||
sender: 'test',
|
||||
};
|
||||
|
||||
await controller.emit(eventData);
|
||||
|
||||
expect(axios.post).toHaveBeenCalledWith(
|
||||
'https://example.com/webhook',
|
||||
expect.objectContaining({
|
||||
event: 'MESSAGES_UPSERT',
|
||||
instance: 'test-instance',
|
||||
}),
|
||||
expect.objectContaining({
|
||||
headers: expect.objectContaining({
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
608
.cursor/rules/specialized-rules/integration-storage-rules.mdc
Normal file
608
.cursor/rules/specialized-rules/integration-storage-rules.mdc
Normal file
@@ -0,0 +1,608 @@
|
||||
---
|
||||
description: Storage integration patterns for Evolution API
|
||||
globs:
|
||||
- "src/api/integrations/storage/**/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Storage Integration Rules
|
||||
|
||||
## Storage Service Pattern
|
||||
|
||||
### Base Storage Service Structure
|
||||
```typescript
|
||||
import { InstanceDto } from '@api/dto/instance.dto';
|
||||
import { PrismaRepository } from '@api/repository/repository.service';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { BadRequestException } from '@exceptions';
|
||||
|
||||
export class StorageService {
|
||||
constructor(private readonly prismaRepository: PrismaRepository) {}
|
||||
|
||||
private readonly logger = new Logger('StorageService');
|
||||
|
||||
public async getMedia(instance: InstanceDto, query?: MediaDto) {
|
||||
try {
|
||||
const where: any = {
|
||||
instanceId: instance.instanceId,
|
||||
...query,
|
||||
};
|
||||
|
||||
const media = await this.prismaRepository.media.findMany({
|
||||
where,
|
||||
select: {
|
||||
id: true,
|
||||
fileName: true,
|
||||
type: true,
|
||||
mimetype: true,
|
||||
createdAt: true,
|
||||
Message: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!media || media.length === 0) {
|
||||
throw 'Media not found';
|
||||
}
|
||||
|
||||
return media;
|
||||
} catch (error) {
|
||||
throw new BadRequestException(error);
|
||||
}
|
||||
}
|
||||
|
||||
public async getMediaUrl(instance: InstanceDto, data: MediaDto) {
|
||||
const media = (await this.getMedia(instance, { id: data.id }))[0];
|
||||
const mediaUrl = await this.generateUrl(media.fileName, data.expiry);
|
||||
return {
|
||||
mediaUrl,
|
||||
...media,
|
||||
};
|
||||
}
|
||||
|
||||
protected abstract generateUrl(fileName: string, expiry?: number): Promise<string>;
|
||||
}
|
||||
```
|
||||
|
||||
## S3/MinIO Integration Pattern
|
||||
|
||||
### MinIO Client Setup
|
||||
```typescript
|
||||
import { ConfigService, S3 } from '@config/env.config';
|
||||
import { Logger } from '@config/logger.config';
|
||||
import { BadRequestException } from '@exceptions';
|
||||
import * as MinIo from 'minio';
|
||||
import { join } from 'path';
|
||||
import { Readable, Transform } from 'stream';
|
||||
|
||||
const logger = new Logger('S3 Service');
|
||||
const BUCKET = new ConfigService().get<S3>('S3');
|
||||
|
||||
interface Metadata extends MinIo.ItemBucketMetadata {
|
||||
instanceId: string;
|
||||
messageId?: string;
|
||||
}
|
||||
|
||||
const minioClient = (() => {
|
||||
if (BUCKET?.ENABLE) {
|
||||
return new MinIo.Client({
|
||||
endPoint: BUCKET.ENDPOINT,
|
||||
port: BUCKET.PORT,
|
||||
useSSL: BUCKET.USE_SSL,
|
||||
accessKey: BUCKET.ACCESS_KEY,
|
||||
secretKey: BUCKET.SECRET_KEY,
|
||||
region: BUCKET.REGION,
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
const bucketName = process.env.S3_BUCKET;
|
||||
```
|
||||
|
||||
### Bucket Management Functions
|
||||
```typescript
|
||||
const bucketExists = async (): Promise<boolean> => {
|
||||
if (minioClient) {
|
||||
try {
|
||||
const list = await minioClient.listBuckets();
|
||||
return !!list.find((bucket) => bucket.name === bucketName);
|
||||
} catch (error) {
|
||||
logger.error('Error checking bucket existence:', error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const setBucketPolicy = async (): Promise<void> => {
|
||||
if (minioClient && bucketName) {
|
||||
try {
|
||||
const policy = {
|
||||
Version: '2012-10-17',
|
||||
Statement: [
|
||||
{
|
||||
Effect: 'Allow',
|
||||
Principal: { AWS: ['*'] },
|
||||
Action: ['s3:GetObject'],
|
||||
Resource: [`arn:aws:s3:::${bucketName}/*`],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
await minioClient.setBucketPolicy(bucketName, JSON.stringify(policy));
|
||||
logger.log('Bucket policy set successfully');
|
||||
} catch (error) {
|
||||
logger.error('Error setting bucket policy:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const createBucket = async (): Promise<void> => {
|
||||
if (minioClient && bucketName) {
|
||||
try {
|
||||
const exists = await bucketExists();
|
||||
if (!exists) {
|
||||
await minioClient.makeBucket(bucketName, BUCKET.REGION || 'us-east-1');
|
||||
await setBucketPolicy();
|
||||
logger.log(`Bucket ${bucketName} created successfully`);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('Error creating bucket:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### File Upload Functions
|
||||
```typescript
|
||||
export const uploadFile = async (
|
||||
fileName: string,
|
||||
buffer: Buffer,
|
||||
mimetype: string,
|
||||
metadata?: Metadata,
|
||||
): Promise<string> => {
|
||||
if (!minioClient || !bucketName) {
|
||||
throw new BadRequestException('S3 storage not configured');
|
||||
}
|
||||
|
||||
try {
|
||||
await createBucket();
|
||||
|
||||
const uploadMetadata = {
|
||||
'Content-Type': mimetype,
|
||||
...metadata,
|
||||
};
|
||||
|
||||
await minioClient.putObject(bucketName, fileName, buffer, buffer.length, uploadMetadata);
|
||||
|
||||
logger.log(`File ${fileName} uploaded successfully`);
|
||||
return fileName;
|
||||
} catch (error) {
|
||||
logger.error(`Error uploading file ${fileName}:`, error);
|
||||
throw new BadRequestException(`Failed to upload file: ${error.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const uploadStream = async (
|
||||
fileName: string,
|
||||
stream: Readable,
|
||||
size: number,
|
||||
mimetype: string,
|
||||
metadata?: Metadata,
|
||||
): Promise<string> => {
|
||||
if (!minioClient || !bucketName) {
|
||||
throw new BadRequestException('S3 storage not configured');
|
||||
}
|
||||
|
||||
try {
|
||||
await createBucket();
|
||||
|
||||
const uploadMetadata = {
|
||||
'Content-Type': mimetype,
|
||||
...metadata,
|
||||
};
|
||||
|
||||
await minioClient.putObject(bucketName, fileName, stream, size, uploadMetadata);
|
||||
|
||||
logger.log(`Stream ${fileName} uploaded successfully`);
|
||||
return fileName;
|
||||
} catch (error) {
|
||||
logger.error(`Error uploading stream ${fileName}:`, error);
|
||||
throw new BadRequestException(`Failed to upload stream: ${error.message}`);
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### File Download Functions
|
||||
```typescript
|
||||
export const getObject = async (fileName: string): Promise<Buffer> => {
|
||||
if (!minioClient || !bucketName) {
|
||||
throw new BadRequestException('S3 storage not configured');
|
||||
}
|
||||
|
||||
try {
|
||||
const stream = await minioClient.getObject(bucketName, fileName);
|
||||
const chunks: Buffer[] = [];
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
stream.on('data', (chunk) => chunks.push(chunk));
|
||||
stream.on('end', () => resolve(Buffer.concat(chunks)));
|
||||
stream.on('error', reject);
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(`Error getting object ${fileName}:`, error);
|
||||
throw new BadRequestException(`Failed to get object: ${error.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const getObjectUrl = async (fileName: string, expiry: number = 3600): Promise<string> => {
|
||||
if (!minioClient || !bucketName) {
|
||||
throw new BadRequestException('S3 storage not configured');
|
||||
}
|
||||
|
||||
try {
|
||||
const url = await minioClient.presignedGetObject(bucketName, fileName, expiry);
|
||||
logger.log(`Generated URL for ${fileName} with expiry ${expiry}s`);
|
||||
return url;
|
||||
} catch (error) {
|
||||
logger.error(`Error generating URL for ${fileName}:`, error);
|
||||
throw new BadRequestException(`Failed to generate URL: ${error.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const getObjectStream = async (fileName: string): Promise<Readable> => {
|
||||
if (!minioClient || !bucketName) {
|
||||
throw new BadRequestException('S3 storage not configured');
|
||||
}
|
||||
|
||||
try {
|
||||
const stream = await minioClient.getObject(bucketName, fileName);
|
||||
return stream;
|
||||
} catch (error) {
|
||||
logger.error(`Error getting object stream ${fileName}:`, error);
|
||||
throw new BadRequestException(`Failed to get object stream: ${error.message}`);
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### File Management Functions
|
||||
```typescript
|
||||
export const deleteObject = async (fileName: string): Promise<void> => {
|
||||
if (!minioClient || !bucketName) {
|
||||
throw new BadRequestException('S3 storage not configured');
|
||||
}
|
||||
|
||||
try {
|
||||
await minioClient.removeObject(bucketName, fileName);
|
||||
logger.log(`File ${fileName} deleted successfully`);
|
||||
} catch (error) {
|
||||
logger.error(`Error deleting file ${fileName}:`, error);
|
||||
throw new BadRequestException(`Failed to delete file: ${error.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const listObjects = async (prefix?: string): Promise<MinIo.BucketItem[]> => {
|
||||
if (!minioClient || !bucketName) {
|
||||
throw new BadRequestException('S3 storage not configured');
|
||||
}
|
||||
|
||||
try {
|
||||
const objects: MinIo.BucketItem[] = [];
|
||||
const stream = minioClient.listObjects(bucketName, prefix, true);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
stream.on('data', (obj) => objects.push(obj));
|
||||
stream.on('end', () => resolve(objects));
|
||||
stream.on('error', reject);
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error('Error listing objects:', error);
|
||||
throw new BadRequestException(`Failed to list objects: ${error.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const objectExists = async (fileName: string): Promise<boolean> => {
|
||||
if (!minioClient || !bucketName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
await minioClient.statObject(bucketName, fileName);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Storage Controller Pattern
|
||||
|
||||
### S3 Controller Implementation
|
||||
```typescript
|
||||
import { InstanceDto } from '@api/dto/instance.dto';
|
||||
import { MediaDto } from '@api/integrations/storage/s3/dto/media.dto';
|
||||
import { S3Service } from '@api/integrations/storage/s3/services/s3.service';
|
||||
|
||||
export class S3Controller {
|
||||
constructor(private readonly s3Service: S3Service) {}
|
||||
|
||||
public async getMedia(instance: InstanceDto, data: MediaDto) {
|
||||
return this.s3Service.getMedia(instance, data);
|
||||
}
|
||||
|
||||
public async getMediaUrl(instance: InstanceDto, data: MediaDto) {
|
||||
return this.s3Service.getMediaUrl(instance, data);
|
||||
}
|
||||
|
||||
public async uploadMedia(instance: InstanceDto, data: UploadMediaDto) {
|
||||
return this.s3Service.uploadMedia(instance, data);
|
||||
}
|
||||
|
||||
public async deleteMedia(instance: InstanceDto, data: MediaDto) {
|
||||
return this.s3Service.deleteMedia(instance, data);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Storage Router Pattern
|
||||
|
||||
### Storage Router Structure
|
||||
```typescript
|
||||
import { S3Router } from '@api/integrations/storage/s3/routes/s3.router';
|
||||
import { Router } from 'express';
|
||||
|
||||
export class StorageRouter {
|
||||
public readonly router: Router;
|
||||
|
||||
constructor(...guards: any[]) {
|
||||
this.router = Router();
|
||||
|
||||
this.router.use('/s3', new S3Router(...guards).router);
|
||||
// Add other storage providers here
|
||||
// this.router.use('/gcs', new GCSRouter(...guards).router);
|
||||
// this.router.use('/azure', new AzureRouter(...guards).router);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### S3 Specific Router
|
||||
```typescript
|
||||
import { RouterBroker } from '@api/abstract/abstract.router';
|
||||
import { MediaDto } from '@api/integrations/storage/s3/dto/media.dto';
|
||||
import { s3Schema, s3UrlSchema } from '@api/integrations/storage/s3/validate/s3.schema';
|
||||
import { HttpStatus } from '@api/routes/index.router';
|
||||
import { s3Controller } from '@api/server.module';
|
||||
import { RequestHandler, Router } from 'express';
|
||||
|
||||
export class S3Router extends RouterBroker {
|
||||
constructor(...guards: RequestHandler[]) {
|
||||
super();
|
||||
this.router
|
||||
.post(this.routerPath('getMedia'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<MediaDto>({
|
||||
request: req,
|
||||
schema: s3Schema,
|
||||
ClassRef: MediaDto,
|
||||
execute: (instance, data) => s3Controller.getMedia(instance, data),
|
||||
});
|
||||
|
||||
res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
.post(this.routerPath('getMediaUrl'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<MediaDto>({
|
||||
request: req,
|
||||
schema: s3UrlSchema,
|
||||
ClassRef: MediaDto,
|
||||
execute: (instance, data) => s3Controller.getMediaUrl(instance, data),
|
||||
});
|
||||
|
||||
res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
.post(this.routerPath('uploadMedia'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<UploadMediaDto>({
|
||||
request: req,
|
||||
schema: uploadSchema,
|
||||
ClassRef: UploadMediaDto,
|
||||
execute: (instance, data) => s3Controller.uploadMedia(instance, data),
|
||||
});
|
||||
|
||||
res.status(HttpStatus.CREATED).json(response);
|
||||
})
|
||||
.delete(this.routerPath('deleteMedia'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<MediaDto>({
|
||||
request: req,
|
||||
schema: s3Schema,
|
||||
ClassRef: MediaDto,
|
||||
execute: (instance, data) => s3Controller.deleteMedia(instance, data),
|
||||
});
|
||||
|
||||
res.status(HttpStatus.OK).json(response);
|
||||
});
|
||||
}
|
||||
|
||||
public readonly router: Router = Router();
|
||||
}
|
||||
```
|
||||
|
||||
## Storage DTO Pattern
|
||||
|
||||
### Media DTO
|
||||
```typescript
|
||||
export class MediaDto {
|
||||
id?: string;
|
||||
fileName?: string;
|
||||
type?: string;
|
||||
mimetype?: string;
|
||||
expiry?: number;
|
||||
}
|
||||
|
||||
export class UploadMediaDto {
|
||||
fileName: string;
|
||||
mimetype: string;
|
||||
buffer?: Buffer;
|
||||
base64?: string;
|
||||
url?: string;
|
||||
metadata?: {
|
||||
instanceId: string;
|
||||
messageId?: string;
|
||||
contactId?: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Storage Validation Schema
|
||||
|
||||
### S3 Validation Schemas
|
||||
```typescript
|
||||
import Joi from 'joi';
|
||||
|
||||
export const s3Schema = Joi.object({
|
||||
id: Joi.string().optional(),
|
||||
fileName: Joi.string().optional(),
|
||||
type: Joi.string().optional().valid('image', 'video', 'audio', 'document'),
|
||||
mimetype: Joi.string().optional(),
|
||||
expiry: Joi.number().optional().min(60).max(604800).default(3600), // 1 min to 7 days
|
||||
}).min(1).required();
|
||||
|
||||
export const s3UrlSchema = Joi.object({
|
||||
id: Joi.string().required(),
|
||||
expiry: Joi.number().optional().min(60).max(604800).default(3600),
|
||||
}).required();
|
||||
|
||||
export const uploadSchema = Joi.object({
|
||||
fileName: Joi.string().required().max(255),
|
||||
mimetype: Joi.string().required(),
|
||||
buffer: Joi.binary().optional(),
|
||||
base64: Joi.string().base64().optional(),
|
||||
url: Joi.string().uri().optional(),
|
||||
metadata: Joi.object({
|
||||
instanceId: Joi.string().required(),
|
||||
messageId: Joi.string().optional(),
|
||||
contactId: Joi.string().optional(),
|
||||
}).optional(),
|
||||
}).xor('buffer', 'base64', 'url').required(); // Exactly one of these must be present
|
||||
```
|
||||
|
||||
## Error Handling in Storage
|
||||
|
||||
### Storage-Specific Error Handling
|
||||
```typescript
|
||||
// CORRECT - Storage-specific error handling
|
||||
public async uploadFile(fileName: string, buffer: Buffer): Promise<string> {
|
||||
try {
|
||||
const result = await this.storageClient.upload(fileName, buffer);
|
||||
return result;
|
||||
} catch (error) {
|
||||
this.logger.error(`Storage upload failed: ${error.message}`);
|
||||
|
||||
if (error.code === 'NoSuchBucket') {
|
||||
throw new BadRequestException('Storage bucket not found');
|
||||
}
|
||||
|
||||
if (error.code === 'AccessDenied') {
|
||||
throw new UnauthorizedException('Storage access denied');
|
||||
}
|
||||
|
||||
if (error.code === 'EntityTooLarge') {
|
||||
throw new BadRequestException('File too large');
|
||||
}
|
||||
|
||||
throw new InternalServerErrorException('Storage operation failed');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Storage Configuration Pattern
|
||||
|
||||
### Environment Configuration
|
||||
```typescript
|
||||
export interface S3Config {
|
||||
ENABLE: boolean;
|
||||
ENDPOINT: string;
|
||||
PORT: number;
|
||||
USE_SSL: boolean;
|
||||
ACCESS_KEY: string;
|
||||
SECRET_KEY: string;
|
||||
REGION: string;
|
||||
BUCKET: string;
|
||||
}
|
||||
|
||||
// Usage in service
|
||||
const s3Config = this.configService.get<S3Config>('S3');
|
||||
if (!s3Config.ENABLE) {
|
||||
throw new BadRequestException('S3 storage is disabled');
|
||||
}
|
||||
```
|
||||
|
||||
## Storage Testing Pattern
|
||||
|
||||
### Storage Service Testing
|
||||
```typescript
|
||||
describe('S3Service', () => {
|
||||
let service: S3Service;
|
||||
let prismaRepository: jest.Mocked<PrismaRepository>;
|
||||
|
||||
beforeEach(() => {
|
||||
service = new S3Service(prismaRepository);
|
||||
});
|
||||
|
||||
describe('getMedia', () => {
|
||||
it('should return media list', async () => {
|
||||
const instance = { instanceId: 'test-instance' };
|
||||
const mockMedia = [
|
||||
{ id: '1', fileName: 'test.jpg', type: 'image', mimetype: 'image/jpeg' },
|
||||
];
|
||||
|
||||
prismaRepository.media.findMany.mockResolvedValue(mockMedia);
|
||||
|
||||
const result = await service.getMedia(instance);
|
||||
|
||||
expect(result).toEqual(mockMedia);
|
||||
expect(prismaRepository.media.findMany).toHaveBeenCalledWith({
|
||||
where: { instanceId: 'test-instance' },
|
||||
select: expect.objectContaining({
|
||||
id: true,
|
||||
fileName: true,
|
||||
type: true,
|
||||
mimetype: true,
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw error when no media found', async () => {
|
||||
const instance = { instanceId: 'test-instance' };
|
||||
prismaRepository.media.findMany.mockResolvedValue([]);
|
||||
|
||||
await expect(service.getMedia(instance)).rejects.toThrow(BadRequestException);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Storage Performance Considerations
|
||||
|
||||
### Efficient File Handling
|
||||
```typescript
|
||||
// CORRECT - Stream-based upload for large files
|
||||
public async uploadLargeFile(fileName: string, stream: Readable, size: number): Promise<string> {
|
||||
const uploadStream = new Transform({
|
||||
transform(chunk, encoding, callback) {
|
||||
// Optional: Add compression, encryption, etc.
|
||||
callback(null, chunk);
|
||||
},
|
||||
});
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
stream
|
||||
.pipe(uploadStream)
|
||||
.on('error', reject)
|
||||
.on('finish', () => resolve(fileName));
|
||||
});
|
||||
}
|
||||
|
||||
// INCORRECT - Loading entire file into memory
|
||||
public async uploadLargeFile(fileName: string, filePath: string): Promise<string> {
|
||||
const buffer = fs.readFileSync(filePath); // ❌ Memory intensive for large files
|
||||
return await this.uploadFile(fileName, buffer);
|
||||
}
|
||||
```
|
||||
416
.cursor/rules/specialized-rules/route-rules.mdc
Normal file
416
.cursor/rules/specialized-rules/route-rules.mdc
Normal file
@@ -0,0 +1,416 @@
|
||||
---
|
||||
description: Router patterns for Evolution API
|
||||
globs:
|
||||
- "src/api/routes/**/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Route Rules
|
||||
|
||||
## Router Base Pattern
|
||||
|
||||
### RouterBroker Extension
|
||||
```typescript
|
||||
import { RouterBroker } from '@api/abstract/abstract.router';
|
||||
import { RequestHandler, Router } from 'express';
|
||||
import { HttpStatus } from './index.router';
|
||||
|
||||
export class ExampleRouter extends RouterBroker {
|
||||
constructor(...guards: RequestHandler[]) {
|
||||
super();
|
||||
this.router
|
||||
.get(this.routerPath('findExample'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<ExampleDto>({
|
||||
request: req,
|
||||
schema: null,
|
||||
ClassRef: ExampleDto,
|
||||
execute: (instance) => exampleController.find(instance),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
.post(this.routerPath('createExample'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<ExampleDto>({
|
||||
request: req,
|
||||
schema: exampleSchema,
|
||||
ClassRef: ExampleDto,
|
||||
execute: (instance, data) => exampleController.create(instance, data),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.CREATED).json(response);
|
||||
});
|
||||
}
|
||||
|
||||
public readonly router: Router = Router();
|
||||
}
|
||||
```
|
||||
|
||||
## Main Router Pattern
|
||||
|
||||
### Index Router Structure
|
||||
```typescript
|
||||
import { Router } from 'express';
|
||||
import { authGuard } from '@api/guards/auth.guard';
|
||||
import { instanceExistsGuard, instanceLoggedGuard } from '@api/guards/instance.guard';
|
||||
import Telemetry from '@api/guards/telemetry.guard';
|
||||
|
||||
enum HttpStatus {
|
||||
OK = 200,
|
||||
CREATED = 201,
|
||||
NOT_FOUND = 404,
|
||||
FORBIDDEN = 403,
|
||||
BAD_REQUEST = 400,
|
||||
UNAUTHORIZED = 401,
|
||||
INTERNAL_SERVER_ERROR = 500,
|
||||
}
|
||||
|
||||
const router: Router = Router();
|
||||
const guards = [instanceExistsGuard, instanceLoggedGuard, authGuard['apikey']];
|
||||
const telemetry = new Telemetry();
|
||||
|
||||
router
|
||||
.use((req, res, next) => telemetry.collectTelemetry(req, res, next))
|
||||
.get('/', async (req, res) => {
|
||||
res.status(HttpStatus.OK).json({
|
||||
status: HttpStatus.OK,
|
||||
message: 'Welcome to the Evolution API, it is working!',
|
||||
version: packageJson.version,
|
||||
clientName: process.env.DATABASE_CONNECTION_CLIENT_NAME,
|
||||
manager: !serverConfig.DISABLE_MANAGER ? `${req.protocol}://${req.get('host')}/manager` : undefined,
|
||||
documentation: `https://doc.evolution-api.com`,
|
||||
whatsappWebVersion: (await fetchLatestWaWebVersion({})).version.join('.'),
|
||||
});
|
||||
})
|
||||
.use('/instance', new InstanceRouter(configService, ...guards).router)
|
||||
.use('/message', new MessageRouter(...guards).router)
|
||||
.use('/chat', new ChatRouter(...guards).router)
|
||||
.use('/business', new BusinessRouter(...guards).router);
|
||||
|
||||
export { HttpStatus, router };
|
||||
```
|
||||
|
||||
## Data Validation Pattern
|
||||
|
||||
### RouterBroker dataValidate Usage
|
||||
```typescript
|
||||
// CORRECT - Standard validation pattern
|
||||
.post(this.routerPath('createTemplate'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<TemplateDto>({
|
||||
request: req,
|
||||
schema: templateSchema,
|
||||
ClassRef: TemplateDto,
|
||||
execute: (instance, data) => templateController.create(instance, data),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.CREATED).json(response);
|
||||
})
|
||||
|
||||
// CORRECT - No schema validation (for simple DTOs)
|
||||
.get(this.routerPath('findTemplate'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<InstanceDto>({
|
||||
request: req,
|
||||
schema: null,
|
||||
ClassRef: InstanceDto,
|
||||
execute: (instance) => templateController.find(instance),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
```
|
||||
|
||||
## Error Handling in Routes
|
||||
|
||||
### Try-Catch Pattern
|
||||
```typescript
|
||||
// CORRECT - Error handling with utility function
|
||||
.post(this.routerPath('getCatalog'), ...guards, async (req, res) => {
|
||||
try {
|
||||
const response = await this.dataValidate<NumberDto>({
|
||||
request: req,
|
||||
schema: catalogSchema,
|
||||
ClassRef: NumberDto,
|
||||
execute: (instance, data) => businessController.fetchCatalog(instance, data),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
} catch (error) {
|
||||
// Log error for debugging
|
||||
console.error('Business catalog error:', error);
|
||||
|
||||
// Use utility function to create standardized error response
|
||||
const errorResponse = createMetaErrorResponse(error, 'business_catalog');
|
||||
return res.status(errorResponse.status).json(errorResponse);
|
||||
}
|
||||
})
|
||||
|
||||
// INCORRECT - Let RouterBroker handle errors (when possible)
|
||||
.post(this.routerPath('simpleOperation'), ...guards, async (req, res) => {
|
||||
try {
|
||||
const response = await this.dataValidate<SimpleDto>({
|
||||
request: req,
|
||||
schema: simpleSchema,
|
||||
ClassRef: SimpleDto,
|
||||
execute: (instance, data) => controller.simpleOperation(instance, data),
|
||||
});
|
||||
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
} catch (error) {
|
||||
throw error; // ❌ Unnecessary - RouterBroker handles this
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Route Path Pattern
|
||||
|
||||
### routerPath Usage
|
||||
```typescript
|
||||
// CORRECT - Use routerPath for consistent naming
|
||||
.get(this.routerPath('findLabels'), ...guards, async (req, res) => {
|
||||
// Implementation
|
||||
})
|
||||
.post(this.routerPath('handleLabel'), ...guards, async (req, res) => {
|
||||
// Implementation
|
||||
})
|
||||
|
||||
// INCORRECT - Hardcoded paths
|
||||
.get('/labels', ...guards, async (req, res) => { // ❌ Use routerPath
|
||||
// Implementation
|
||||
})
|
||||
```
|
||||
|
||||
## Guard Application Pattern
|
||||
|
||||
### Guards Usage
|
||||
```typescript
|
||||
// CORRECT - Apply guards to protected routes
|
||||
export class ProtectedRouter extends RouterBroker {
|
||||
constructor(...guards: RequestHandler[]) {
|
||||
super();
|
||||
this.router
|
||||
.get(this.routerPath('protectedAction'), ...guards, async (req, res) => {
|
||||
// Protected action
|
||||
})
|
||||
.post(this.routerPath('anotherAction'), ...guards, async (req, res) => {
|
||||
// Another protected action
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// CORRECT - No guards for public routes
|
||||
export class PublicRouter extends RouterBroker {
|
||||
constructor() {
|
||||
super();
|
||||
this.router
|
||||
.get('/health', async (req, res) => {
|
||||
res.status(HttpStatus.OK).json({ status: 'healthy' });
|
||||
})
|
||||
.get('/version', async (req, res) => {
|
||||
res.status(HttpStatus.OK).json({ version: packageJson.version });
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Static File Serving Pattern
|
||||
|
||||
### Static Assets Route
|
||||
```typescript
|
||||
// CORRECT - Secure static file serving
|
||||
router.get('/assets/*', (req, res) => {
|
||||
const fileName = req.params[0];
|
||||
|
||||
// Security: Reject paths containing traversal patterns
|
||||
if (!fileName || fileName.includes('..') || fileName.includes('\\') || path.isAbsolute(fileName)) {
|
||||
return res.status(403).send('Forbidden');
|
||||
}
|
||||
|
||||
const basePath = path.join(process.cwd(), 'manager', 'dist');
|
||||
const assetsPath = path.join(basePath, 'assets');
|
||||
const filePath = path.join(assetsPath, fileName);
|
||||
|
||||
// Security: Ensure the resolved path is within the assets directory
|
||||
const resolvedPath = path.resolve(filePath);
|
||||
const resolvedAssetsPath = path.resolve(assetsPath);
|
||||
|
||||
if (!resolvedPath.startsWith(resolvedAssetsPath + path.sep) && resolvedPath !== resolvedAssetsPath) {
|
||||
return res.status(403).send('Forbidden');
|
||||
}
|
||||
|
||||
if (fs.existsSync(resolvedPath)) {
|
||||
res.set('Content-Type', mimeTypes.lookup(resolvedPath) || 'text/css');
|
||||
res.send(fs.readFileSync(resolvedPath));
|
||||
} else {
|
||||
res.status(404).send('File not found');
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Special Route Patterns
|
||||
|
||||
### Manager Route Pattern
|
||||
```typescript
|
||||
export class ViewsRouter extends RouterBroker {
|
||||
public readonly router: Router;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.router = Router();
|
||||
|
||||
const basePath = path.join(process.cwd(), 'manager', 'dist');
|
||||
const indexPath = path.join(basePath, 'index.html');
|
||||
|
||||
this.router.use(express.static(basePath));
|
||||
|
||||
this.router.get('*', (req, res) => {
|
||||
res.sendFile(indexPath);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Webhook Route Pattern
|
||||
```typescript
|
||||
// CORRECT - Webhook without guards
|
||||
.post('/webhook/evolution', async (req, res) => {
|
||||
const response = await evolutionController.receiveWebhook(req.body);
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
|
||||
// CORRECT - Webhook with signature validation
|
||||
.post('/webhook/meta', validateWebhookSignature, async (req, res) => {
|
||||
const response = await metaController.receiveWebhook(req.body);
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
})
|
||||
```
|
||||
|
||||
## Response Pattern
|
||||
|
||||
### Standard Response Format
|
||||
```typescript
|
||||
// CORRECT - Standard success response
|
||||
return res.status(HttpStatus.OK).json(response);
|
||||
|
||||
// CORRECT - Created response
|
||||
return res.status(HttpStatus.CREATED).json(response);
|
||||
|
||||
// CORRECT - Custom response with additional data
|
||||
return res.status(HttpStatus.OK).json({
|
||||
...response,
|
||||
timestamp: new Date().toISOString(),
|
||||
instanceName: req.params.instanceName,
|
||||
});
|
||||
```
|
||||
|
||||
## Route Organization
|
||||
|
||||
### File Structure
|
||||
```
|
||||
src/api/routes/
|
||||
├── index.router.ts # Main router with all route registrations
|
||||
├── instance.router.ts # Instance management routes
|
||||
├── sendMessage.router.ts # Message sending routes
|
||||
├── chat.router.ts # Chat operations routes
|
||||
├── business.router.ts # Business API routes
|
||||
├── group.router.ts # Group management routes
|
||||
├── label.router.ts # Label management routes
|
||||
├── proxy.router.ts # Proxy configuration routes
|
||||
├── settings.router.ts # Instance settings routes
|
||||
├── template.router.ts # Template management routes
|
||||
├── call.router.ts # Call operations routes
|
||||
└── view.router.ts # Frontend views routes
|
||||
```
|
||||
|
||||
## Route Testing Pattern
|
||||
|
||||
### Router Testing
|
||||
```typescript
|
||||
describe('ExampleRouter', () => {
|
||||
let app: express.Application;
|
||||
let router: ExampleRouter;
|
||||
|
||||
beforeEach(() => {
|
||||
app = express();
|
||||
router = new ExampleRouter();
|
||||
app.use('/api', router.router);
|
||||
app.use(express.json());
|
||||
});
|
||||
|
||||
describe('GET /findExample', () => {
|
||||
it('should return example data', async () => {
|
||||
const response = await request(app)
|
||||
.get('/api/findExample/test-instance')
|
||||
.set('apikey', 'test-key')
|
||||
.expect(200);
|
||||
|
||||
expect(response.body).toBeDefined();
|
||||
expect(response.body.instanceName).toBe('test-instance');
|
||||
});
|
||||
|
||||
it('should return 401 without API key', async () => {
|
||||
await request(app)
|
||||
.get('/api/findExample/test-instance')
|
||||
.expect(401);
|
||||
});
|
||||
});
|
||||
|
||||
describe('POST /createExample', () => {
|
||||
it('should create example successfully', async () => {
|
||||
const data = {
|
||||
name: 'Test Example',
|
||||
description: 'Test Description',
|
||||
};
|
||||
|
||||
const response = await request(app)
|
||||
.post('/api/createExample/test-instance')
|
||||
.set('apikey', 'test-key')
|
||||
.send(data)
|
||||
.expect(201);
|
||||
|
||||
expect(response.body.name).toBe(data.name);
|
||||
});
|
||||
|
||||
it('should validate required fields', async () => {
|
||||
const data = {
|
||||
description: 'Test Description',
|
||||
// Missing required 'name' field
|
||||
};
|
||||
|
||||
await request(app)
|
||||
.post('/api/createExample/test-instance')
|
||||
.set('apikey', 'test-key')
|
||||
.send(data)
|
||||
.expect(400);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Route Documentation
|
||||
|
||||
### JSDoc for Routes
|
||||
```typescript
|
||||
/**
|
||||
* @route GET /api/template/findTemplate/:instanceName
|
||||
* @description Find template for instance
|
||||
* @param {string} instanceName - Instance name
|
||||
* @returns {TemplateDto} Template data
|
||||
* @throws {404} Template not found
|
||||
* @throws {401} Unauthorized
|
||||
*/
|
||||
.get(this.routerPath('findTemplate'), ...guards, async (req, res) => {
|
||||
// Implementation
|
||||
})
|
||||
|
||||
/**
|
||||
* @route POST /api/template/createTemplate/:instanceName
|
||||
* @description Create new template
|
||||
* @param {string} instanceName - Instance name
|
||||
* @body {TemplateDto} Template data
|
||||
* @returns {TemplateDto} Created template
|
||||
* @throws {400} Validation error
|
||||
* @throws {401} Unauthorized
|
||||
*/
|
||||
.post(this.routerPath('createTemplate'), ...guards, async (req, res) => {
|
||||
// Implementation
|
||||
})
|
||||
```
|
||||
294
.cursor/rules/specialized-rules/service-rules.mdc
Normal file
294
.cursor/rules/specialized-rules/service-rules.mdc
Normal file
@@ -0,0 +1,294 @@
|
||||
---
|
||||
description: Service layer patterns for Evolution API
|
||||
globs:
|
||||
- "src/api/services/**/*.ts"
|
||||
- "src/api/integrations/**/services/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Service Rules
|
||||
|
||||
## Service Structure Pattern
|
||||
|
||||
### Standard Service Class
|
||||
```typescript
|
||||
export class ExampleService {
|
||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
||||
|
||||
private readonly logger = new Logger('ExampleService');
|
||||
|
||||
public async create(instance: InstanceDto, data: ExampleDto) {
|
||||
await this.waMonitor.waInstances[instance.instanceName].setData(data);
|
||||
return { example: { ...instance, data } };
|
||||
}
|
||||
|
||||
public async find(instance: InstanceDto): Promise<ExampleDto> {
|
||||
try {
|
||||
const result = await this.waMonitor.waInstances[instance.instanceName].findData();
|
||||
|
||||
if (Object.keys(result).length === 0) {
|
||||
throw new Error('Data not found');
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
return null; // Evolution pattern - return null on error
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Dependency Injection Pattern
|
||||
|
||||
### Constructor Pattern
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern
|
||||
constructor(
|
||||
private readonly waMonitor: WAMonitoringService,
|
||||
private readonly prismaRepository: PrismaRepository,
|
||||
private readonly configService: ConfigService,
|
||||
) {}
|
||||
|
||||
// INCORRECT - Don't use
|
||||
constructor(waMonitor, prismaRepository, configService) {} // ❌ No types
|
||||
```
|
||||
|
||||
## Logger Pattern
|
||||
|
||||
### Standard Logger Usage
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern
|
||||
private readonly logger = new Logger('ServiceName');
|
||||
|
||||
// Usage
|
||||
this.logger.log('Operation started');
|
||||
this.logger.error('Operation failed', error);
|
||||
|
||||
// INCORRECT
|
||||
console.log('Operation started'); // ❌ Use Logger
|
||||
```
|
||||
|
||||
## WAMonitor Integration Pattern
|
||||
|
||||
### Instance Access Pattern
|
||||
```typescript
|
||||
// CORRECT - Standard pattern
|
||||
public async operation(instance: InstanceDto, data: DataDto) {
|
||||
await this.waMonitor.waInstances[instance.instanceName].performAction(data);
|
||||
return { result: { ...instance, data } };
|
||||
}
|
||||
|
||||
// Instance validation
|
||||
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
||||
if (!waInstance) {
|
||||
throw new NotFoundException('Instance not found');
|
||||
}
|
||||
```
|
||||
|
||||
## Error Handling Pattern
|
||||
|
||||
### Try-Catch Pattern
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern
|
||||
public async find(instance: InstanceDto): Promise<DataDto> {
|
||||
try {
|
||||
const result = await this.waMonitor.waInstances[instance.instanceName].findData();
|
||||
|
||||
if (Object.keys(result).length === 0) {
|
||||
throw new Error('Data not found');
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
this.logger.error('Find operation failed', error);
|
||||
return null; // Return null on error (Evolution pattern)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Cache Integration Pattern
|
||||
|
||||
### Cache Service Usage
|
||||
```typescript
|
||||
export class CacheAwareService {
|
||||
constructor(
|
||||
private readonly cache: CacheService,
|
||||
private readonly chatwootCache: CacheService,
|
||||
private readonly baileysCache: CacheService,
|
||||
) {}
|
||||
|
||||
public async getCachedData(key: string): Promise<any> {
|
||||
const cached = await this.cache.get(key);
|
||||
if (cached) return cached;
|
||||
|
||||
const data = await this.fetchFromSource(key);
|
||||
await this.cache.set(key, data, 300); // 5 min TTL
|
||||
return data;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Integration Service Patterns
|
||||
|
||||
### Chatbot Service Base Pattern
|
||||
```typescript
|
||||
export class ChatbotService extends BaseChatbotService<BotType, SettingsType> {
|
||||
constructor(
|
||||
waMonitor: WAMonitoringService,
|
||||
prismaRepository: PrismaRepository,
|
||||
configService: ConfigService,
|
||||
) {
|
||||
super(waMonitor, prismaRepository, 'ChatbotService', configService);
|
||||
}
|
||||
|
||||
protected async processBot(
|
||||
waInstance: any,
|
||||
remoteJid: string,
|
||||
bot: BotType,
|
||||
session: any,
|
||||
settings: any,
|
||||
content: string,
|
||||
): Promise<void> {
|
||||
// Implementation
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Channel Service Pattern
|
||||
```typescript
|
||||
export class ChannelService extends ChannelStartupService {
|
||||
constructor(
|
||||
configService: ConfigService,
|
||||
eventEmitter: EventEmitter2,
|
||||
prismaRepository: PrismaRepository,
|
||||
cache: CacheService,
|
||||
chatwootCache: CacheService,
|
||||
baileysCache: CacheService,
|
||||
) {
|
||||
super(configService, eventEmitter, prismaRepository, cache, chatwootCache, baileysCache);
|
||||
}
|
||||
|
||||
public readonly logger = new Logger('ChannelService');
|
||||
public client: WASocket;
|
||||
public readonly instance: wa.Instance = {};
|
||||
}
|
||||
```
|
||||
|
||||
## Service Initialization Pattern
|
||||
|
||||
### Service Registration
|
||||
```typescript
|
||||
// In server.module.ts pattern
|
||||
export const templateService = new TemplateService(
|
||||
waMonitor,
|
||||
prismaRepository,
|
||||
configService,
|
||||
);
|
||||
|
||||
export const settingsService = new SettingsService(waMonitor);
|
||||
```
|
||||
|
||||
## Async Operation Patterns
|
||||
|
||||
### Promise Handling
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern
|
||||
public async sendMessage(instance: InstanceDto, data: MessageDto) {
|
||||
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
||||
return await waInstance.sendMessage(data);
|
||||
}
|
||||
|
||||
// INCORRECT - Don't use .then()
|
||||
public sendMessage(instance: InstanceDto, data: MessageDto) {
|
||||
return this.waMonitor.waInstances[instance.instanceName]
|
||||
.sendMessage(data)
|
||||
.then(result => result); // ❌ Use async/await
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration Access Pattern
|
||||
|
||||
### Config Service Usage
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern
|
||||
const serverConfig = this.configService.get<HttpServer>('SERVER');
|
||||
const authConfig = this.configService.get<Auth>('AUTHENTICATION');
|
||||
const dbConfig = this.configService.get<Database>('DATABASE');
|
||||
|
||||
// Type-safe configuration access
|
||||
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED) {
|
||||
// Chatwoot logic
|
||||
}
|
||||
```
|
||||
|
||||
## Event Emission Pattern
|
||||
|
||||
### EventEmitter2 Usage
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern
|
||||
this.eventEmitter.emit(Events.INSTANCE_CREATE, {
|
||||
instanceName: instance.name,
|
||||
status: 'created',
|
||||
});
|
||||
|
||||
// Chatwoot event pattern
|
||||
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot?.enabled) {
|
||||
this.chatwootService.eventWhatsapp(
|
||||
Events.STATUS_INSTANCE,
|
||||
{ instanceName: this.instance.name },
|
||||
{
|
||||
instance: this.instance.name,
|
||||
status: 'created',
|
||||
},
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## Service Method Naming
|
||||
|
||||
### Standard Method Names
|
||||
- `create()` - Create new resource
|
||||
- `find()` - Find single resource
|
||||
- `findAll()` - Find multiple resources
|
||||
- `update()` - Update resource
|
||||
- `delete()` - Delete resource
|
||||
- `fetch*()` - Fetch from external API
|
||||
- `send*()` - Send data/messages
|
||||
- `process*()` - Process data
|
||||
|
||||
## Service Testing Pattern
|
||||
|
||||
### Unit Test Structure
|
||||
```typescript
|
||||
describe('ExampleService', () => {
|
||||
let service: ExampleService;
|
||||
let waMonitor: jest.Mocked<WAMonitoringService>;
|
||||
let prismaRepository: jest.Mocked<PrismaRepository>;
|
||||
|
||||
beforeEach(() => {
|
||||
const mockWaMonitor = {
|
||||
waInstances: {
|
||||
'test-instance': {
|
||||
performAction: jest.fn(),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
service = new ExampleService(
|
||||
mockWaMonitor as any,
|
||||
prismaRepository,
|
||||
configService,
|
||||
);
|
||||
});
|
||||
|
||||
it('should perform action successfully', async () => {
|
||||
const instance = { instanceName: 'test-instance' };
|
||||
const data = { test: 'data' };
|
||||
|
||||
const result = await service.create(instance, data);
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(waMonitor.waInstances['test-instance'].performAction).toHaveBeenCalledWith(data);
|
||||
});
|
||||
});
|
||||
```
|
||||
490
.cursor/rules/specialized-rules/type-rules.mdc
Normal file
490
.cursor/rules/specialized-rules/type-rules.mdc
Normal file
@@ -0,0 +1,490 @@
|
||||
---
|
||||
description: Type definitions and interfaces for Evolution API
|
||||
globs:
|
||||
- "src/api/types/**/*.ts"
|
||||
- "src/@types/**/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Type Rules
|
||||
|
||||
## Namespace Pattern
|
||||
|
||||
### WhatsApp Types Namespace
|
||||
```typescript
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
import { JsonValue } from '@prisma/client/runtime/library';
|
||||
import { AuthenticationState, WAConnectionState } from 'baileys';
|
||||
|
||||
export declare namespace wa {
|
||||
export type QrCode = {
|
||||
count?: number;
|
||||
pairingCode?: string;
|
||||
base64?: string;
|
||||
code?: string;
|
||||
};
|
||||
|
||||
export type Instance = {
|
||||
id?: string;
|
||||
qrcode?: QrCode;
|
||||
pairingCode?: string;
|
||||
authState?: { state: AuthenticationState; saveCreds: () => void };
|
||||
name?: string;
|
||||
wuid?: string;
|
||||
profileName?: string;
|
||||
profilePictureUrl?: string;
|
||||
token?: string;
|
||||
number?: string;
|
||||
integration?: string;
|
||||
businessId?: string;
|
||||
};
|
||||
|
||||
export type LocalChatwoot = {
|
||||
enabled?: boolean;
|
||||
accountId?: string;
|
||||
token?: string;
|
||||
url?: string;
|
||||
nameInbox?: string;
|
||||
mergeBrazilContacts?: boolean;
|
||||
importContacts?: boolean;
|
||||
importMessages?: boolean;
|
||||
daysLimitImportMessages?: number;
|
||||
organization?: string;
|
||||
logo?: string;
|
||||
};
|
||||
|
||||
export type LocalProxy = {
|
||||
enabled?: boolean;
|
||||
host?: string;
|
||||
port?: string;
|
||||
protocol?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
};
|
||||
|
||||
export type LocalSettings = {
|
||||
rejectCall?: boolean;
|
||||
msgCall?: string;
|
||||
groupsIgnore?: boolean;
|
||||
alwaysOnline?: boolean;
|
||||
readMessages?: boolean;
|
||||
readStatus?: boolean;
|
||||
syncFullHistory?: boolean;
|
||||
};
|
||||
|
||||
export type LocalWebHook = {
|
||||
enabled?: boolean;
|
||||
url?: string;
|
||||
events?: string[];
|
||||
headers?: JsonValue;
|
||||
byEvents?: boolean;
|
||||
base64?: boolean;
|
||||
};
|
||||
|
||||
export type StatusMessage = 'ERROR' | 'PENDING' | 'SERVER_ACK' | 'DELIVERY_ACK' | 'READ' | 'DELETED' | 'PLAYED';
|
||||
}
|
||||
```
|
||||
|
||||
## Enum Definitions
|
||||
|
||||
### Events Enum
|
||||
```typescript
|
||||
export enum Events {
|
||||
APPLICATION_STARTUP = 'application.startup',
|
||||
INSTANCE_CREATE = 'instance.create',
|
||||
INSTANCE_DELETE = 'instance.delete',
|
||||
QRCODE_UPDATED = 'qrcode.updated',
|
||||
CONNECTION_UPDATE = 'connection.update',
|
||||
STATUS_INSTANCE = 'status.instance',
|
||||
MESSAGES_SET = 'messages.set',
|
||||
MESSAGES_UPSERT = 'messages.upsert',
|
||||
MESSAGES_EDITED = 'messages.edited',
|
||||
MESSAGES_UPDATE = 'messages.update',
|
||||
MESSAGES_DELETE = 'messages.delete',
|
||||
SEND_MESSAGE = 'send.message',
|
||||
SEND_MESSAGE_UPDATE = 'send.message.update',
|
||||
CONTACTS_SET = 'contacts.set',
|
||||
CONTACTS_UPSERT = 'contacts.upsert',
|
||||
CONTACTS_UPDATE = 'contacts.update',
|
||||
PRESENCE_UPDATE = 'presence.update',
|
||||
CHATS_SET = 'chats.set',
|
||||
CHATS_UPDATE = 'chats.update',
|
||||
CHATS_UPSERT = 'chats.upsert',
|
||||
CHATS_DELETE = 'chats.delete',
|
||||
GROUPS_UPSERT = 'groups.upsert',
|
||||
GROUPS_UPDATE = 'groups.update',
|
||||
GROUP_PARTICIPANTS_UPDATE = 'group-participants.update',
|
||||
CALL = 'call',
|
||||
TYPEBOT_START = 'typebot.start',
|
||||
TYPEBOT_CHANGE_STATUS = 'typebot.change-status',
|
||||
LABELS_EDIT = 'labels.edit',
|
||||
LABELS_ASSOCIATION = 'labels.association',
|
||||
CREDS_UPDATE = 'creds.update',
|
||||
MESSAGING_HISTORY_SET = 'messaging-history.set',
|
||||
REMOVE_INSTANCE = 'remove.instance',
|
||||
LOGOUT_INSTANCE = 'logout.instance',
|
||||
}
|
||||
```
|
||||
|
||||
### Integration Types
|
||||
```typescript
|
||||
export const Integration = {
|
||||
WHATSAPP_BUSINESS: 'WHATSAPP-BUSINESS',
|
||||
WHATSAPP_BAILEYS: 'WHATSAPP-BAILEYS',
|
||||
EVOLUTION: 'EVOLUTION',
|
||||
} as const;
|
||||
|
||||
export type IntegrationType = typeof Integration[keyof typeof Integration];
|
||||
```
|
||||
|
||||
## Constant Arrays
|
||||
|
||||
### Message Type Constants
|
||||
```typescript
|
||||
export const TypeMediaMessage = [
|
||||
'imageMessage',
|
||||
'documentMessage',
|
||||
'audioMessage',
|
||||
'videoMessage',
|
||||
'stickerMessage',
|
||||
'ptvMessage', // Evolution API includes this
|
||||
];
|
||||
|
||||
export const MessageSubtype = [
|
||||
'ephemeralMessage',
|
||||
'documentWithCaptionMessage',
|
||||
'viewOnceMessage',
|
||||
'viewOnceMessageV2',
|
||||
];
|
||||
|
||||
export type MediaMessageType = typeof TypeMediaMessage[number];
|
||||
export type MessageSubtypeType = typeof MessageSubtype[number];
|
||||
```
|
||||
|
||||
## Interface Definitions
|
||||
|
||||
### Service Interfaces
|
||||
```typescript
|
||||
export interface ServiceInterface {
|
||||
create(instance: InstanceDto, data: any): Promise<any>;
|
||||
find(instance: InstanceDto): Promise<any>;
|
||||
update?(instance: InstanceDto, data: any): Promise<any>;
|
||||
delete?(instance: InstanceDto): Promise<any>;
|
||||
}
|
||||
|
||||
export interface ChannelServiceInterface extends ServiceInterface {
|
||||
sendMessage(data: SendMessageDto): Promise<any>;
|
||||
connectToWhatsapp(data?: any): Promise<void>;
|
||||
receiveWebhook?(data: any): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ChatbotServiceInterface extends ServiceInterface {
|
||||
processMessage(
|
||||
instanceName: string,
|
||||
remoteJid: string,
|
||||
message: any,
|
||||
pushName?: string,
|
||||
): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration Types
|
||||
|
||||
### Environment Configuration Types
|
||||
```typescript
|
||||
export interface DatabaseConfig {
|
||||
CONNECTION: {
|
||||
URI: string;
|
||||
DB_PREFIX_NAME: string;
|
||||
CLIENT_NAME?: string;
|
||||
};
|
||||
ENABLED: boolean;
|
||||
SAVE_DATA: {
|
||||
INSTANCE: boolean;
|
||||
NEW_MESSAGE: boolean;
|
||||
MESSAGE_UPDATE: boolean;
|
||||
CONTACTS: boolean;
|
||||
CHATS: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AuthConfig {
|
||||
TYPE: 'apikey' | 'jwt';
|
||||
API_KEY: {
|
||||
KEY: string;
|
||||
};
|
||||
JWT?: {
|
||||
EXPIRIN_IN: number;
|
||||
SECRET: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface CacheConfig {
|
||||
REDIS: {
|
||||
ENABLED: boolean;
|
||||
URI: string;
|
||||
PREFIX_KEY: string;
|
||||
SAVE_INSTANCES: boolean;
|
||||
};
|
||||
LOCAL: {
|
||||
ENABLED: boolean;
|
||||
TTL: number;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Message Types
|
||||
|
||||
### Message Structure Types
|
||||
```typescript
|
||||
export interface MessageContent {
|
||||
text?: string;
|
||||
caption?: string;
|
||||
media?: Buffer | string;
|
||||
mediatype?: 'image' | 'video' | 'audio' | 'document' | 'sticker';
|
||||
fileName?: string;
|
||||
mimetype?: string;
|
||||
}
|
||||
|
||||
export interface MessageOptions {
|
||||
delay?: number;
|
||||
presence?: 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
|
||||
linkPreview?: boolean;
|
||||
mentionsEveryOne?: boolean;
|
||||
mentioned?: string[];
|
||||
quoted?: {
|
||||
key: {
|
||||
remoteJid: string;
|
||||
fromMe: boolean;
|
||||
id: string;
|
||||
};
|
||||
message: any;
|
||||
};
|
||||
}
|
||||
|
||||
export interface SendMessageRequest {
|
||||
number: string;
|
||||
content: MessageContent;
|
||||
options?: MessageOptions;
|
||||
}
|
||||
```
|
||||
|
||||
## Webhook Types
|
||||
|
||||
### Webhook Payload Types
|
||||
```typescript
|
||||
export interface WebhookPayload {
|
||||
event: Events;
|
||||
instance: string;
|
||||
data: any;
|
||||
timestamp: string;
|
||||
server?: {
|
||||
version: string;
|
||||
host: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface WebhookConfig {
|
||||
enabled: boolean;
|
||||
url: string;
|
||||
events: Events[];
|
||||
headers?: Record<string, string>;
|
||||
byEvents?: boolean;
|
||||
base64?: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
## Error Types
|
||||
|
||||
### Custom Error Types
|
||||
```typescript
|
||||
export interface ApiError {
|
||||
status: number;
|
||||
message: string;
|
||||
error?: string;
|
||||
details?: any;
|
||||
timestamp: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface ValidationError extends ApiError {
|
||||
status: 400;
|
||||
validationErrors: Array<{
|
||||
field: string;
|
||||
message: string;
|
||||
value?: any;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface AuthenticationError extends ApiError {
|
||||
status: 401;
|
||||
message: 'Unauthorized' | 'Invalid API Key' | 'Token Expired';
|
||||
}
|
||||
```
|
||||
|
||||
## Utility Types
|
||||
|
||||
### Generic Utility Types
|
||||
```typescript
|
||||
export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
||||
|
||||
export type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
||||
|
||||
export type DeepPartial<T> = {
|
||||
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
||||
};
|
||||
|
||||
export type NonEmptyArray<T> = [T, ...T[]];
|
||||
|
||||
export type StringKeys<T> = {
|
||||
[K in keyof T]: T[K] extends string ? K : never;
|
||||
}[keyof T];
|
||||
```
|
||||
|
||||
## Response Types
|
||||
|
||||
### API Response Types
|
||||
```typescript
|
||||
export interface ApiResponse<T = any> {
|
||||
success: boolean;
|
||||
data?: T;
|
||||
message?: string;
|
||||
error?: string;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> extends ApiResponse<T[]> {
|
||||
pagination: {
|
||||
page: number;
|
||||
limit: number;
|
||||
total: number;
|
||||
totalPages: number;
|
||||
hasNext: boolean;
|
||||
hasPrev: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface InstanceResponse extends ApiResponse {
|
||||
instance: {
|
||||
instanceName: string;
|
||||
status: 'connecting' | 'open' | 'close' | 'qr';
|
||||
qrcode?: string;
|
||||
profileName?: string;
|
||||
profilePicUrl?: string;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Integration-Specific Types
|
||||
|
||||
### Baileys Types Extension
|
||||
```typescript
|
||||
import { WASocket, ConnectionState, DisconnectReason } from 'baileys';
|
||||
|
||||
export interface BaileysInstance {
|
||||
client: WASocket;
|
||||
state: ConnectionState;
|
||||
qrRetry: number;
|
||||
authPath: string;
|
||||
}
|
||||
|
||||
export interface BaileysConfig {
|
||||
qrTimeout: number;
|
||||
maxQrRetries: number;
|
||||
authTimeout: number;
|
||||
reconnectInterval: number;
|
||||
}
|
||||
```
|
||||
|
||||
### Business API Types
|
||||
```typescript
|
||||
export interface BusinessApiConfig {
|
||||
version: string;
|
||||
baseUrl: string;
|
||||
timeout: number;
|
||||
retries: number;
|
||||
}
|
||||
|
||||
export interface BusinessApiMessage {
|
||||
messaging_product: 'whatsapp';
|
||||
to: string;
|
||||
type: 'text' | 'image' | 'document' | 'audio' | 'video' | 'template';
|
||||
text?: {
|
||||
body: string;
|
||||
preview_url?: boolean;
|
||||
};
|
||||
image?: {
|
||||
link?: string;
|
||||
id?: string;
|
||||
caption?: string;
|
||||
};
|
||||
template?: {
|
||||
name: string;
|
||||
language: {
|
||||
code: string;
|
||||
};
|
||||
components?: any[];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Type Guards
|
||||
|
||||
### Type Guard Functions
|
||||
```typescript
|
||||
export function isMediaMessage(message: any): message is MediaMessage {
|
||||
return message && TypeMediaMessage.some(type => message[type]);
|
||||
}
|
||||
|
||||
export function isTextMessage(message: any): message is TextMessage {
|
||||
return message && message.conversation;
|
||||
}
|
||||
|
||||
export function isValidIntegration(integration: string): integration is IntegrationType {
|
||||
return Object.values(Integration).includes(integration as IntegrationType);
|
||||
}
|
||||
|
||||
export function isValidEvent(event: string): event is Events {
|
||||
return Object.values(Events).includes(event as Events);
|
||||
}
|
||||
```
|
||||
|
||||
## Module Augmentation
|
||||
|
||||
### Express Request Extension
|
||||
```typescript
|
||||
declare global {
|
||||
namespace Express {
|
||||
interface Request {
|
||||
instanceName?: string;
|
||||
instanceData?: InstanceDto;
|
||||
user?: {
|
||||
id: string;
|
||||
apiKey: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Type Documentation
|
||||
|
||||
### JSDoc Type Documentation
|
||||
```typescript
|
||||
/**
|
||||
* WhatsApp instance configuration
|
||||
* @interface InstanceConfig
|
||||
* @property {string} name - Unique instance name
|
||||
* @property {IntegrationType} integration - Integration type
|
||||
* @property {string} [token] - API token for business integrations
|
||||
* @property {WebhookConfig} [webhook] - Webhook configuration
|
||||
* @property {ProxyConfig} [proxy] - Proxy configuration
|
||||
*/
|
||||
export interface InstanceConfig {
|
||||
name: string;
|
||||
integration: IntegrationType;
|
||||
token?: string;
|
||||
webhook?: WebhookConfig;
|
||||
proxy?: ProxyConfig;
|
||||
}
|
||||
```
|
||||
653
.cursor/rules/specialized-rules/util-rules.mdc
Normal file
653
.cursor/rules/specialized-rules/util-rules.mdc
Normal file
@@ -0,0 +1,653 @@
|
||||
---
|
||||
description: Utility functions and helpers for Evolution API
|
||||
globs:
|
||||
- "src/utils/**/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Utility Rules
|
||||
|
||||
## Utility Function Structure
|
||||
|
||||
### Standard Utility Pattern
|
||||
```typescript
|
||||
import { Logger } from '@config/logger.config';
|
||||
|
||||
const logger = new Logger('UtilityName');
|
||||
|
||||
export function utilityFunction(param: ParamType): ReturnType {
|
||||
try {
|
||||
// Utility logic
|
||||
return result;
|
||||
} catch (error) {
|
||||
logger.error(`Utility function failed: ${error.message}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export default utilityFunction;
|
||||
```
|
||||
|
||||
## Authentication Utilities
|
||||
|
||||
### Multi-File Auth State Pattern
|
||||
```typescript
|
||||
import { AuthenticationState } from 'baileys';
|
||||
import { CacheService } from '@api/services/cache.service';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
|
||||
export default async function useMultiFileAuthStatePrisma(
|
||||
sessionId: string,
|
||||
cache: CacheService,
|
||||
): Promise<{
|
||||
state: AuthenticationState;
|
||||
saveCreds: () => Promise<void>;
|
||||
}> {
|
||||
const localFolder = path.join(INSTANCE_DIR, sessionId);
|
||||
const localFile = (key: string) => path.join(localFolder, fixFileName(key) + '.json');
|
||||
await fs.mkdir(localFolder, { recursive: true });
|
||||
|
||||
async function writeData(data: any, key: string): Promise<any> {
|
||||
const dataString = JSON.stringify(data, BufferJSON.replacer);
|
||||
|
||||
if (key !== 'creds') {
|
||||
if (process.env.CACHE_REDIS_ENABLED === 'true') {
|
||||
return await cache.hSet(sessionId, key, data);
|
||||
} else {
|
||||
await fs.writeFile(localFile(key), dataString);
|
||||
return;
|
||||
}
|
||||
}
|
||||
await saveKey(sessionId, dataString);
|
||||
return;
|
||||
}
|
||||
|
||||
async function readData(key: string): Promise<any> {
|
||||
try {
|
||||
let rawData;
|
||||
|
||||
if (key !== 'creds') {
|
||||
if (process.env.CACHE_REDIS_ENABLED === 'true') {
|
||||
return await cache.hGet(sessionId, key);
|
||||
} else {
|
||||
if (!(await fileExists(localFile(key)))) return null;
|
||||
rawData = await fs.readFile(localFile(key), { encoding: 'utf-8' });
|
||||
return JSON.parse(rawData, BufferJSON.reviver);
|
||||
}
|
||||
} else {
|
||||
rawData = await getAuthKey(sessionId);
|
||||
}
|
||||
|
||||
const parsedData = JSON.parse(rawData, BufferJSON.reviver);
|
||||
return parsedData;
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function removeData(key: string): Promise<any> {
|
||||
try {
|
||||
if (key !== 'creds') {
|
||||
if (process.env.CACHE_REDIS_ENABLED === 'true') {
|
||||
return await cache.hDelete(sessionId, key);
|
||||
} else {
|
||||
await fs.unlink(localFile(key));
|
||||
}
|
||||
} else {
|
||||
await deleteAuthKey(sessionId);
|
||||
}
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let creds = await readData('creds');
|
||||
if (!creds) {
|
||||
creds = initAuthCreds();
|
||||
await writeData(creds, 'creds');
|
||||
}
|
||||
|
||||
return {
|
||||
state: {
|
||||
creds,
|
||||
keys: {
|
||||
get: async (type, ids) => {
|
||||
const data = {};
|
||||
await Promise.all(
|
||||
ids.map(async (id) => {
|
||||
let value = await readData(`${type}-${id}`);
|
||||
if (type === 'app-state-sync-key' && value) {
|
||||
value = proto.Message.AppStateSyncKeyData.fromObject(value);
|
||||
}
|
||||
data[id] = value;
|
||||
})
|
||||
);
|
||||
return data;
|
||||
},
|
||||
set: async (data) => {
|
||||
const tasks = [];
|
||||
for (const category in data) {
|
||||
for (const id in data[category]) {
|
||||
const value = data[category][id];
|
||||
const key = `${category}-${id}`;
|
||||
tasks.push(value ? writeData(value, key) : removeData(key));
|
||||
}
|
||||
}
|
||||
await Promise.all(tasks);
|
||||
},
|
||||
},
|
||||
},
|
||||
saveCreds: () => writeData(creds, 'creds'),
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Message Processing Utilities
|
||||
|
||||
### Message Content Extraction
|
||||
```typescript
|
||||
export const getConversationMessage = (msg: any): string => {
|
||||
const types = getTypeMessage(msg);
|
||||
const messageContent = getMessageContent(types);
|
||||
return messageContent;
|
||||
};
|
||||
|
||||
const getTypeMessage = (msg: any): any => {
|
||||
return Object.keys(msg?.message || msg || {})[0];
|
||||
};
|
||||
|
||||
const getMessageContent = (type: string, msg?: any): string => {
|
||||
const typeKey = type?.replace('Message', '');
|
||||
|
||||
const types = {
|
||||
conversation: msg?.message?.conversation,
|
||||
extendedTextMessage: msg?.message?.extendedTextMessage?.text,
|
||||
imageMessage: msg?.message?.imageMessage?.caption || 'Image',
|
||||
videoMessage: msg?.message?.videoMessage?.caption || 'Video',
|
||||
audioMessage: 'Audio',
|
||||
documentMessage: msg?.message?.documentMessage?.caption || 'Document',
|
||||
stickerMessage: 'Sticker',
|
||||
contactMessage: 'Contact',
|
||||
locationMessage: 'Location',
|
||||
liveLocationMessage: 'Live Location',
|
||||
viewOnceMessage: 'View Once',
|
||||
reactionMessage: 'Reaction',
|
||||
pollCreationMessage: 'Poll',
|
||||
pollUpdateMessage: 'Poll Update',
|
||||
};
|
||||
|
||||
let result = types[typeKey] || types[type] || 'Unknown';
|
||||
|
||||
if (!result || result === 'Unknown') {
|
||||
result = JSON.stringify(msg);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
```
|
||||
|
||||
### JID Creation Utility
|
||||
```typescript
|
||||
export const createJid = (number: string): string => {
|
||||
if (number.includes('@')) {
|
||||
return number;
|
||||
}
|
||||
|
||||
// Remove any non-numeric characters except +
|
||||
let cleanNumber = number.replace(/[^\d+]/g, '');
|
||||
|
||||
// Remove + if present
|
||||
if (cleanNumber.startsWith('+')) {
|
||||
cleanNumber = cleanNumber.substring(1);
|
||||
}
|
||||
|
||||
// Add country code if missing (assuming Brazil as default)
|
||||
if (cleanNumber.length === 11 && cleanNumber.startsWith('11')) {
|
||||
cleanNumber = '55' + cleanNumber;
|
||||
} else if (cleanNumber.length === 10) {
|
||||
cleanNumber = '5511' + cleanNumber;
|
||||
}
|
||||
|
||||
// Determine if it's a group or individual
|
||||
const isGroup = cleanNumber.includes('-');
|
||||
const domain = isGroup ? 'g.us' : 's.whatsapp.net';
|
||||
|
||||
return `${cleanNumber}@${domain}`;
|
||||
};
|
||||
```
|
||||
|
||||
## Cache Utilities
|
||||
|
||||
### WhatsApp Number Cache
|
||||
```typescript
|
||||
interface ISaveOnWhatsappCacheParams {
|
||||
remoteJid: string;
|
||||
lid?: string;
|
||||
}
|
||||
|
||||
function getAvailableNumbers(remoteJid: string): string[] {
|
||||
const numbersAvailable: string[] = [];
|
||||
|
||||
if (remoteJid.startsWith('+')) {
|
||||
remoteJid = remoteJid.slice(1);
|
||||
}
|
||||
|
||||
const [number, domain] = remoteJid.split('@');
|
||||
|
||||
// Brazilian numbers
|
||||
if (remoteJid.startsWith('55')) {
|
||||
const numberWithDigit =
|
||||
number.slice(4, 5) === '9' && number.length === 13 ? number : `${number.slice(0, 4)}9${number.slice(4)}`;
|
||||
const numberWithoutDigit = number.length === 12 ? number : number.slice(0, 4) + number.slice(5);
|
||||
|
||||
numbersAvailable.push(numberWithDigit);
|
||||
numbersAvailable.push(numberWithoutDigit);
|
||||
}
|
||||
// Mexican/Argentina numbers
|
||||
else if (number.startsWith('52') || number.startsWith('54')) {
|
||||
let prefix = '';
|
||||
if (number.startsWith('52')) {
|
||||
prefix = '1';
|
||||
}
|
||||
if (number.startsWith('54')) {
|
||||
prefix = '9';
|
||||
}
|
||||
|
||||
const numberWithDigit =
|
||||
number.slice(2, 3) === prefix && number.length === 13
|
||||
? number
|
||||
: `${number.slice(0, 2)}${prefix}${number.slice(2)}`;
|
||||
const numberWithoutDigit = number.length === 12 ? number : number.slice(0, 2) + number.slice(3);
|
||||
|
||||
numbersAvailable.push(numberWithDigit);
|
||||
numbersAvailable.push(numberWithoutDigit);
|
||||
}
|
||||
// Other countries
|
||||
else {
|
||||
numbersAvailable.push(remoteJid);
|
||||
}
|
||||
|
||||
return numbersAvailable.map((number) => `${number}@${domain}`);
|
||||
}
|
||||
|
||||
export async function saveOnWhatsappCache(params: ISaveOnWhatsappCacheParams): Promise<void> {
|
||||
const { remoteJid, lid } = params;
|
||||
const db = configService.get<Database>('DATABASE');
|
||||
|
||||
if (!db.SAVE_DATA.CONTACTS) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const numbersAvailable = getAvailableNumbers(remoteJid);
|
||||
|
||||
const existingContact = await prismaRepository.contact.findFirst({
|
||||
where: {
|
||||
OR: numbersAvailable.map(number => ({ id: number })),
|
||||
},
|
||||
});
|
||||
|
||||
if (!existingContact) {
|
||||
await prismaRepository.contact.create({
|
||||
data: {
|
||||
id: remoteJid,
|
||||
pushName: '',
|
||||
profilePicUrl: '',
|
||||
isOnWhatsapp: true,
|
||||
lid: lid || null,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
});
|
||||
} else {
|
||||
await prismaRepository.contact.update({
|
||||
where: { id: existingContact.id },
|
||||
data: {
|
||||
isOnWhatsapp: true,
|
||||
lid: lid || existingContact.lid,
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error saving WhatsApp cache:', error);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Search Utilities
|
||||
|
||||
### Advanced Search Operators
|
||||
```typescript
|
||||
function normalizeString(str: string): string {
|
||||
return str
|
||||
.toLowerCase()
|
||||
.normalize('NFD')
|
||||
.replace(/[\u0300-\u036f]/g, '');
|
||||
}
|
||||
|
||||
export function advancedOperatorsSearch(data: string, query: string): boolean {
|
||||
const normalizedData = normalizeString(data);
|
||||
const normalizedQuery = normalizeString(query);
|
||||
|
||||
// Exact phrase search with quotes
|
||||
if (normalizedQuery.startsWith('"') && normalizedQuery.endsWith('"')) {
|
||||
const phrase = normalizedQuery.slice(1, -1);
|
||||
return normalizedData.includes(phrase);
|
||||
}
|
||||
|
||||
// OR operator
|
||||
if (normalizedQuery.includes(' OR ')) {
|
||||
const terms = normalizedQuery.split(' OR ');
|
||||
return terms.some(term => normalizedData.includes(term.trim()));
|
||||
}
|
||||
|
||||
// AND operator (default behavior)
|
||||
if (normalizedQuery.includes(' AND ')) {
|
||||
const terms = normalizedQuery.split(' AND ');
|
||||
return terms.every(term => normalizedData.includes(term.trim()));
|
||||
}
|
||||
|
||||
// NOT operator
|
||||
if (normalizedQuery.startsWith('NOT ')) {
|
||||
const term = normalizedQuery.slice(4);
|
||||
return !normalizedData.includes(term);
|
||||
}
|
||||
|
||||
// Wildcard search
|
||||
if (normalizedQuery.includes('*')) {
|
||||
const regex = new RegExp(normalizedQuery.replace(/\*/g, '.*'), 'i');
|
||||
return regex.test(normalizedData);
|
||||
}
|
||||
|
||||
// Default: simple contains search
|
||||
return normalizedData.includes(normalizedQuery);
|
||||
}
|
||||
```
|
||||
|
||||
## Proxy Utilities
|
||||
|
||||
### Proxy Agent Creation
|
||||
```typescript
|
||||
import { HttpsProxyAgent } from 'https-proxy-agent';
|
||||
import { SocksProxyAgent } from 'socks-proxy-agent';
|
||||
|
||||
type Proxy = {
|
||||
host: string;
|
||||
port: string;
|
||||
protocol: 'http' | 'https' | 'socks4' | 'socks5';
|
||||
username?: string;
|
||||
password?: string;
|
||||
};
|
||||
|
||||
function selectProxyAgent(proxyUrl: string): HttpsProxyAgent<string> | SocksProxyAgent {
|
||||
const url = new URL(proxyUrl);
|
||||
|
||||
if (url.protocol === 'socks4:' || url.protocol === 'socks5:') {
|
||||
return new SocksProxyAgent(proxyUrl);
|
||||
} else {
|
||||
return new HttpsProxyAgent(proxyUrl);
|
||||
}
|
||||
}
|
||||
|
||||
export function makeProxyAgent(proxy: Proxy): HttpsProxyAgent<string> | SocksProxyAgent | null {
|
||||
if (!proxy.host || !proxy.port) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let proxyUrl = `${proxy.protocol}://`;
|
||||
|
||||
if (proxy.username && proxy.password) {
|
||||
proxyUrl += `${proxy.username}:${proxy.password}@`;
|
||||
}
|
||||
|
||||
proxyUrl += `${proxy.host}:${proxy.port}`;
|
||||
|
||||
try {
|
||||
return selectProxyAgent(proxyUrl);
|
||||
} catch (error) {
|
||||
console.error('Failed to create proxy agent:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Telemetry Utilities
|
||||
|
||||
### Telemetry Data Collection
|
||||
```typescript
|
||||
export interface TelemetryData {
|
||||
route: string;
|
||||
apiVersion: string;
|
||||
timestamp: Date;
|
||||
method?: string;
|
||||
statusCode?: number;
|
||||
responseTime?: number;
|
||||
userAgent?: string;
|
||||
instanceName?: string;
|
||||
}
|
||||
|
||||
export const sendTelemetry = async (route: string): Promise<void> => {
|
||||
try {
|
||||
const telemetryData: TelemetryData = {
|
||||
route,
|
||||
apiVersion: packageJson.version,
|
||||
timestamp: new Date(),
|
||||
};
|
||||
|
||||
// Only send telemetry if enabled
|
||||
if (process.env.DISABLE_TELEMETRY === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send to telemetry service (implement as needed)
|
||||
await axios.post('https://telemetry.evolution-api.com/collect', telemetryData, {
|
||||
timeout: 5000,
|
||||
});
|
||||
} catch (error) {
|
||||
// Silently fail - don't affect main application
|
||||
console.debug('Telemetry failed:', error.message);
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Internationalization Utilities
|
||||
|
||||
### i18n Setup
|
||||
```typescript
|
||||
import { ConfigService, Language } from '@config/env.config';
|
||||
import fs from 'fs';
|
||||
import i18next from 'i18next';
|
||||
import path from 'path';
|
||||
|
||||
const __dirname = path.resolve(process.cwd(), 'src', 'utils');
|
||||
const languages = ['en', 'pt-BR', 'es'];
|
||||
const translationsPath = path.join(__dirname, 'translations');
|
||||
const configService: ConfigService = new ConfigService();
|
||||
|
||||
const resources: any = {};
|
||||
|
||||
languages.forEach((language) => {
|
||||
const languagePath = path.join(translationsPath, `${language}.json`);
|
||||
if (fs.existsSync(languagePath)) {
|
||||
const translationContent = fs.readFileSync(languagePath, 'utf8');
|
||||
resources[language] = {
|
||||
translation: JSON.parse(translationContent),
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
i18next.init({
|
||||
resources,
|
||||
fallbackLng: 'en',
|
||||
lng: configService.get<Language>('LANGUAGE') || 'pt-BR',
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
});
|
||||
|
||||
export const t = i18next.t.bind(i18next);
|
||||
export default i18next;
|
||||
```
|
||||
|
||||
## Bot Trigger Utilities
|
||||
|
||||
### Bot Trigger Matching
|
||||
```typescript
|
||||
import { TriggerOperator, TriggerType } from '@prisma/client';
|
||||
|
||||
export function findBotByTrigger(
|
||||
bots: any[],
|
||||
content: string,
|
||||
remoteJid: string,
|
||||
): any | null {
|
||||
for (const bot of bots) {
|
||||
if (!bot.enabled) continue;
|
||||
|
||||
// Check ignore list
|
||||
if (bot.ignoreJids && bot.ignoreJids.includes(remoteJid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check trigger
|
||||
if (matchesTrigger(content, bot.triggerType, bot.triggerOperator, bot.triggerValue)) {
|
||||
return bot;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function matchesTrigger(
|
||||
content: string,
|
||||
triggerType: TriggerType,
|
||||
triggerOperator: TriggerOperator,
|
||||
triggerValue: string,
|
||||
): boolean {
|
||||
const normalizedContent = content.toLowerCase().trim();
|
||||
const normalizedValue = triggerValue.toLowerCase().trim();
|
||||
|
||||
switch (triggerType) {
|
||||
case TriggerType.ALL:
|
||||
return true;
|
||||
|
||||
case TriggerType.KEYWORD:
|
||||
return matchesKeyword(normalizedContent, triggerOperator, normalizedValue);
|
||||
|
||||
case TriggerType.REGEX:
|
||||
try {
|
||||
const regex = new RegExp(triggerValue, 'i');
|
||||
return regex.test(content);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function matchesKeyword(
|
||||
content: string,
|
||||
operator: TriggerOperator,
|
||||
value: string,
|
||||
): boolean {
|
||||
switch (operator) {
|
||||
case TriggerOperator.EQUALS:
|
||||
return content === value;
|
||||
case TriggerOperator.CONTAINS:
|
||||
return content.includes(value);
|
||||
case TriggerOperator.STARTS_WITH:
|
||||
return content.startsWith(value);
|
||||
case TriggerOperator.ENDS_WITH:
|
||||
return content.endsWith(value);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Server Utilities
|
||||
|
||||
### Server Status Check
|
||||
```typescript
|
||||
export class ServerUP {
|
||||
private static instance: ServerUP;
|
||||
private isServerUp: boolean = false;
|
||||
|
||||
private constructor() {}
|
||||
|
||||
public static getInstance(): ServerUP {
|
||||
if (!ServerUP.instance) {
|
||||
ServerUP.instance = new ServerUP();
|
||||
}
|
||||
return ServerUP.instance;
|
||||
}
|
||||
|
||||
public setServerStatus(status: boolean): void {
|
||||
this.isServerUp = status;
|
||||
}
|
||||
|
||||
public getServerStatus(): boolean {
|
||||
return this.isServerUp;
|
||||
}
|
||||
|
||||
public async waitForServer(timeout: number = 30000): Promise<boolean> {
|
||||
const startTime = Date.now();
|
||||
|
||||
while (!this.isServerUp && (Date.now() - startTime) < timeout) {
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
}
|
||||
|
||||
return this.isServerUp;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Error Response Utilities
|
||||
|
||||
### Standardized Error Responses
|
||||
```typescript
|
||||
export function createMetaErrorResponse(error: any, context: string) {
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
if (error.response?.data) {
|
||||
return {
|
||||
status: error.response.status || 500,
|
||||
error: {
|
||||
message: error.response.data.error?.message || 'External API error',
|
||||
type: error.response.data.error?.type || 'api_error',
|
||||
code: error.response.data.error?.code || 'unknown_error',
|
||||
context,
|
||||
timestamp,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
status: 500,
|
||||
error: {
|
||||
message: error.message || 'Internal server error',
|
||||
type: 'internal_error',
|
||||
code: 'server_error',
|
||||
context,
|
||||
timestamp,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createValidationErrorResponse(errors: any[], context: string) {
|
||||
return {
|
||||
status: 400,
|
||||
error: {
|
||||
message: 'Validation failed',
|
||||
type: 'validation_error',
|
||||
code: 'invalid_input',
|
||||
context,
|
||||
details: errors,
|
||||
timestamp: new Date().toISOString(),
|
||||
},
|
||||
};
|
||||
}
|
||||
```
|
||||
498
.cursor/rules/specialized-rules/validate-rules.mdc
Normal file
498
.cursor/rules/specialized-rules/validate-rules.mdc
Normal file
@@ -0,0 +1,498 @@
|
||||
---
|
||||
description: Validation schemas and patterns for Evolution API
|
||||
globs:
|
||||
- "src/validate/**/*.ts"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Evolution API Validation Rules
|
||||
|
||||
## Validation Schema Structure
|
||||
|
||||
### JSONSchema7 Pattern (Evolution API Standard)
|
||||
```typescript
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
const isNotEmpty = (...fields: string[]) => {
|
||||
const properties = {};
|
||||
fields.forEach((field) => {
|
||||
properties[field] = {
|
||||
if: { properties: { [field]: { type: 'string' } } },
|
||||
then: { properties: { [field]: { minLength: 1 } } },
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
allOf: Object.values(properties),
|
||||
};
|
||||
};
|
||||
|
||||
export const exampleSchema: JSONSchema7 = {
|
||||
$id: v4(),
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
enabled: { type: 'boolean' },
|
||||
settings: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
timeout: { type: 'number', minimum: 1000, maximum: 60000 },
|
||||
retries: { type: 'number', minimum: 0, maximum: 5 },
|
||||
},
|
||||
},
|
||||
tags: {
|
||||
type: 'array',
|
||||
items: { type: 'string' },
|
||||
},
|
||||
},
|
||||
required: ['name', 'enabled'],
|
||||
...isNotEmpty('name'),
|
||||
};
|
||||
```
|
||||
|
||||
## Message Validation Schemas
|
||||
|
||||
### Send Message Validation
|
||||
```typescript
|
||||
const numberDefinition = {
|
||||
type: 'string',
|
||||
pattern: '^\\d+[\\.@\\w-]+',
|
||||
description: 'Invalid number',
|
||||
};
|
||||
|
||||
export const sendTextSchema: JSONSchema7 = {
|
||||
$id: v4(),
|
||||
type: 'object',
|
||||
properties: {
|
||||
number: numberDefinition,
|
||||
text: { type: 'string', minLength: 1, maxLength: 4096 },
|
||||
delay: { type: 'number', minimum: 0, maximum: 60000 },
|
||||
linkPreview: { type: 'boolean' },
|
||||
mentionsEveryOne: { type: 'boolean' },
|
||||
mentioned: {
|
||||
type: 'array',
|
||||
items: { type: 'string' },
|
||||
},
|
||||
},
|
||||
required: ['number', 'text'],
|
||||
...isNotEmpty('number', 'text'),
|
||||
};
|
||||
|
||||
export const sendMediaSchema = Joi.object({
|
||||
number: Joi.string().required().pattern(/^\d+$/),
|
||||
mediatype: Joi.string().required().valid('image', 'video', 'audio', 'document'),
|
||||
media: Joi.alternatives().try(
|
||||
Joi.string().uri(),
|
||||
Joi.string().base64(),
|
||||
).required(),
|
||||
caption: Joi.string().optional().max(1024),
|
||||
fileName: Joi.string().optional().max(255),
|
||||
delay: Joi.number().optional().min(0).max(60000),
|
||||
}).required();
|
||||
|
||||
export const sendButtonsSchema = Joi.object({
|
||||
number: Joi.string().required().pattern(/^\d+$/),
|
||||
title: Joi.string().required().max(1024),
|
||||
description: Joi.string().optional().max(1024),
|
||||
footer: Joi.string().optional().max(60),
|
||||
buttons: Joi.array().items(
|
||||
Joi.object({
|
||||
type: Joi.string().required().valid('replyButton', 'urlButton', 'callButton'),
|
||||
displayText: Joi.string().required().max(20),
|
||||
id: Joi.string().when('type', {
|
||||
is: 'replyButton',
|
||||
then: Joi.required().max(256),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
url: Joi.string().when('type', {
|
||||
is: 'urlButton',
|
||||
then: Joi.required().uri(),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
phoneNumber: Joi.string().when('type', {
|
||||
is: 'callButton',
|
||||
then: Joi.required().pattern(/^\+?\d+$/),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
})
|
||||
).min(1).max(3).required(),
|
||||
}).required();
|
||||
```
|
||||
|
||||
## Instance Validation Schemas
|
||||
|
||||
### Instance Creation Validation
|
||||
```typescript
|
||||
export const instanceSchema = Joi.object({
|
||||
instanceName: Joi.string().required().min(1).max(100).pattern(/^[a-zA-Z0-9_-]+$/),
|
||||
integration: Joi.string().required().valid('WHATSAPP-BAILEYS', 'WHATSAPP-BUSINESS', 'EVOLUTION'),
|
||||
token: Joi.string().when('integration', {
|
||||
is: Joi.valid('WHATSAPP-BUSINESS', 'EVOLUTION'),
|
||||
then: Joi.required().min(10),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
qrcode: Joi.boolean().optional().default(false),
|
||||
number: Joi.string().optional().pattern(/^\d+$/),
|
||||
businessId: Joi.string().when('integration', {
|
||||
is: 'WHATSAPP-BUSINESS',
|
||||
then: Joi.required(),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
}).required();
|
||||
|
||||
export const settingsSchema = Joi.object({
|
||||
rejectCall: Joi.boolean().optional(),
|
||||
msgCall: Joi.string().optional().max(500),
|
||||
groupsIgnore: Joi.boolean().optional(),
|
||||
alwaysOnline: Joi.boolean().optional(),
|
||||
readMessages: Joi.boolean().optional(),
|
||||
readStatus: Joi.boolean().optional(),
|
||||
syncFullHistory: Joi.boolean().optional(),
|
||||
wavoipToken: Joi.string().optional(),
|
||||
}).optional();
|
||||
|
||||
export const proxySchema = Joi.object({
|
||||
host: Joi.string().required().hostname(),
|
||||
port: Joi.string().required().pattern(/^\d+$/).custom((value) => {
|
||||
const port = parseInt(value);
|
||||
if (port < 1 || port > 65535) {
|
||||
throw new Error('Port must be between 1 and 65535');
|
||||
}
|
||||
return value;
|
||||
}),
|
||||
protocol: Joi.string().required().valid('http', 'https', 'socks4', 'socks5'),
|
||||
username: Joi.string().optional(),
|
||||
password: Joi.string().optional(),
|
||||
}).optional();
|
||||
```
|
||||
|
||||
## Webhook Validation Schemas
|
||||
|
||||
### Webhook Configuration Validation
|
||||
```typescript
|
||||
export const webhookSchema = Joi.object({
|
||||
enabled: Joi.boolean().required(),
|
||||
url: Joi.string().when('enabled', {
|
||||
is: true,
|
||||
then: Joi.required().uri({ scheme: ['http', 'https'] }),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
events: Joi.array().items(
|
||||
Joi.string().valid(
|
||||
'APPLICATION_STARTUP',
|
||||
'INSTANCE_CREATE',
|
||||
'INSTANCE_DELETE',
|
||||
'QRCODE_UPDATED',
|
||||
'CONNECTION_UPDATE',
|
||||
'STATUS_INSTANCE',
|
||||
'MESSAGES_SET',
|
||||
'MESSAGES_UPSERT',
|
||||
'MESSAGES_UPDATE',
|
||||
'MESSAGES_DELETE',
|
||||
'CONTACTS_SET',
|
||||
'CONTACTS_UPSERT',
|
||||
'CONTACTS_UPDATE',
|
||||
'CHATS_SET',
|
||||
'CHATS_UPDATE',
|
||||
'CHATS_UPSERT',
|
||||
'CHATS_DELETE',
|
||||
'GROUPS_UPSERT',
|
||||
'GROUPS_UPDATE',
|
||||
'GROUP_PARTICIPANTS_UPDATE',
|
||||
'CALL'
|
||||
)
|
||||
).min(1).when('enabled', {
|
||||
is: true,
|
||||
then: Joi.required(),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
headers: Joi.object().pattern(
|
||||
Joi.string(),
|
||||
Joi.string()
|
||||
).optional(),
|
||||
byEvents: Joi.boolean().optional().default(false),
|
||||
base64: Joi.boolean().optional().default(false),
|
||||
}).required();
|
||||
```
|
||||
|
||||
## Chatbot Validation Schemas
|
||||
|
||||
### Base Chatbot Validation
|
||||
```typescript
|
||||
export const baseChatbotSchema = Joi.object({
|
||||
enabled: Joi.boolean().required(),
|
||||
description: Joi.string().required().min(1).max(500),
|
||||
expire: Joi.number().optional().min(0).max(86400), // 24 hours in seconds
|
||||
keywordFinish: Joi.string().optional().max(100),
|
||||
delayMessage: Joi.number().optional().min(0).max(10000),
|
||||
unknownMessage: Joi.string().optional().max(1000),
|
||||
listeningFromMe: Joi.boolean().optional().default(false),
|
||||
stopBotFromMe: Joi.boolean().optional().default(false),
|
||||
keepOpen: Joi.boolean().optional().default(false),
|
||||
debounceTime: Joi.number().optional().min(0).max(60000),
|
||||
triggerType: Joi.string().required().valid('ALL', 'KEYWORD', 'REGEX'),
|
||||
triggerOperator: Joi.string().when('triggerType', {
|
||||
is: 'KEYWORD',
|
||||
then: Joi.required().valid('EQUALS', 'CONTAINS', 'STARTS_WITH', 'ENDS_WITH'),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
triggerValue: Joi.string().when('triggerType', {
|
||||
is: Joi.valid('KEYWORD', 'REGEX'),
|
||||
then: Joi.required().min(1).max(500),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
ignoreJids: Joi.array().items(Joi.string()).optional(),
|
||||
splitMessages: Joi.boolean().optional().default(false),
|
||||
timePerChar: Joi.number().optional().min(10).max(1000).default(100),
|
||||
}).required();
|
||||
|
||||
export const typebotSchema = baseChatbotSchema.keys({
|
||||
url: Joi.string().required().uri({ scheme: ['http', 'https'] }),
|
||||
typebot: Joi.string().required().min(1).max(100),
|
||||
apiVersion: Joi.string().optional().valid('v1', 'v2').default('v1'),
|
||||
}).required();
|
||||
|
||||
export const openaiSchema = baseChatbotSchema.keys({
|
||||
apiKey: Joi.string().required().min(10),
|
||||
model: Joi.string().optional().valid(
|
||||
'gpt-3.5-turbo',
|
||||
'gpt-3.5-turbo-16k',
|
||||
'gpt-4',
|
||||
'gpt-4-32k',
|
||||
'gpt-4-turbo-preview'
|
||||
).default('gpt-3.5-turbo'),
|
||||
systemMessage: Joi.string().optional().max(2000),
|
||||
maxTokens: Joi.number().optional().min(1).max(4000).default(1000),
|
||||
temperature: Joi.number().optional().min(0).max(2).default(0.7),
|
||||
}).required();
|
||||
```
|
||||
|
||||
## Business API Validation Schemas
|
||||
|
||||
### Template Validation
|
||||
```typescript
|
||||
export const templateSchema = Joi.object({
|
||||
name: Joi.string().required().min(1).max(512).pattern(/^[a-z0-9_]+$/),
|
||||
category: Joi.string().required().valid('MARKETING', 'UTILITY', 'AUTHENTICATION'),
|
||||
allowCategoryChange: Joi.boolean().required(),
|
||||
language: Joi.string().required().pattern(/^[a-z]{2}_[A-Z]{2}$/), // e.g., pt_BR, en_US
|
||||
components: Joi.array().items(
|
||||
Joi.object({
|
||||
type: Joi.string().required().valid('HEADER', 'BODY', 'FOOTER', 'BUTTONS'),
|
||||
format: Joi.string().when('type', {
|
||||
is: 'HEADER',
|
||||
then: Joi.valid('TEXT', 'IMAGE', 'VIDEO', 'DOCUMENT'),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
text: Joi.string().when('type', {
|
||||
is: Joi.valid('HEADER', 'BODY', 'FOOTER'),
|
||||
then: Joi.required().min(1).max(1024),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
buttons: Joi.array().when('type', {
|
||||
is: 'BUTTONS',
|
||||
then: Joi.items(
|
||||
Joi.object({
|
||||
type: Joi.string().required().valid('QUICK_REPLY', 'URL', 'PHONE_NUMBER'),
|
||||
text: Joi.string().required().min(1).max(25),
|
||||
url: Joi.string().when('type', {
|
||||
is: 'URL',
|
||||
then: Joi.required().uri(),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
phone_number: Joi.string().when('type', {
|
||||
is: 'PHONE_NUMBER',
|
||||
then: Joi.required().pattern(/^\+?\d+$/),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
})
|
||||
).min(1).max(10),
|
||||
otherwise: Joi.optional(),
|
||||
}),
|
||||
})
|
||||
).min(1).required(),
|
||||
webhookUrl: Joi.string().optional().uri({ scheme: ['http', 'https'] }),
|
||||
}).required();
|
||||
|
||||
export const catalogSchema = Joi.object({
|
||||
number: Joi.string().optional().pattern(/^\d+$/),
|
||||
limit: Joi.number().optional().min(1).max(1000).default(10),
|
||||
cursor: Joi.string().optional(),
|
||||
}).optional();
|
||||
```
|
||||
|
||||
## Group Validation Schemas
|
||||
|
||||
### Group Management Validation
|
||||
```typescript
|
||||
export const createGroupSchema = Joi.object({
|
||||
subject: Joi.string().required().min(1).max(100),
|
||||
description: Joi.string().optional().max(500),
|
||||
participants: Joi.array().items(
|
||||
Joi.string().pattern(/^\d+$/)
|
||||
).min(1).max(256).required(),
|
||||
promoteParticipants: Joi.boolean().optional().default(false),
|
||||
}).required();
|
||||
|
||||
export const updateGroupSchema = Joi.object({
|
||||
subject: Joi.string().optional().min(1).max(100),
|
||||
description: Joi.string().optional().max(500),
|
||||
}).min(1).required();
|
||||
|
||||
export const groupParticipantsSchema = Joi.object({
|
||||
participants: Joi.array().items(
|
||||
Joi.string().pattern(/^\d+$/)
|
||||
).min(1).max(50).required(),
|
||||
action: Joi.string().required().valid('add', 'remove', 'promote', 'demote'),
|
||||
}).required();
|
||||
```
|
||||
|
||||
## Label Validation Schemas
|
||||
|
||||
### Label Management Validation
|
||||
```typescript
|
||||
export const labelSchema = Joi.object({
|
||||
name: Joi.string().required().min(1).max(100),
|
||||
color: Joi.string().required().pattern(/^#[0-9A-Fa-f]{6}$/), // Hex color
|
||||
predefinedId: Joi.string().optional(),
|
||||
}).required();
|
||||
|
||||
export const handleLabelSchema = Joi.object({
|
||||
number: Joi.string().required().pattern(/^\d+$/),
|
||||
labelId: Joi.string().required(),
|
||||
action: Joi.string().required().valid('add', 'remove'),
|
||||
}).required();
|
||||
```
|
||||
|
||||
## Custom Validation Functions
|
||||
|
||||
### Phone Number Validation
|
||||
```typescript
|
||||
export function validatePhoneNumber(number: string): boolean {
|
||||
// Remove any non-digit characters
|
||||
const cleaned = number.replace(/\D/g, '');
|
||||
|
||||
// Check minimum and maximum length
|
||||
if (cleaned.length < 10 || cleaned.length > 15) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for valid country codes (basic validation)
|
||||
const validCountryCodes = ['1', '7', '20', '27', '30', '31', '32', '33', '34', '36', '39', '40', '41', '43', '44', '45', '46', '47', '48', '49', '51', '52', '53', '54', '55', '56', '57', '58', '60', '61', '62', '63', '64', '65', '66', '81', '82', '84', '86', '90', '91', '92', '93', '94', '95', '98'];
|
||||
|
||||
// Check if starts with valid country code
|
||||
const startsWithValidCode = validCountryCodes.some(code => cleaned.startsWith(code));
|
||||
|
||||
return startsWithValidCode;
|
||||
}
|
||||
|
||||
export const phoneNumberValidator = Joi.string().custom((value, helpers) => {
|
||||
if (!validatePhoneNumber(value)) {
|
||||
return helpers.error('any.invalid');
|
||||
}
|
||||
return value;
|
||||
}, 'Phone number validation');
|
||||
```
|
||||
|
||||
### Base64 Validation
|
||||
```typescript
|
||||
export function validateBase64(base64: string): boolean {
|
||||
try {
|
||||
// Check if it's a valid base64 string
|
||||
const decoded = Buffer.from(base64, 'base64').toString('base64');
|
||||
return decoded === base64;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export const base64Validator = Joi.string().custom((value, helpers) => {
|
||||
if (!validateBase64(value)) {
|
||||
return helpers.error('any.invalid');
|
||||
}
|
||||
return value;
|
||||
}, 'Base64 validation');
|
||||
```
|
||||
|
||||
### URL Validation with Protocol Check
|
||||
```typescript
|
||||
export function validateWebhookUrl(url: string): boolean {
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
return ['http:', 'https:'].includes(parsed.protocol);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export const webhookUrlValidator = Joi.string().custom((value, helpers) => {
|
||||
if (!validateWebhookUrl(value)) {
|
||||
return helpers.error('any.invalid');
|
||||
}
|
||||
return value;
|
||||
}, 'Webhook URL validation');
|
||||
```
|
||||
|
||||
## Validation Error Handling
|
||||
|
||||
### Error Message Customization
|
||||
```typescript
|
||||
export const validationMessages = {
|
||||
'any.required': 'O campo {#label} é obrigatório',
|
||||
'string.empty': 'O campo {#label} não pode estar vazio',
|
||||
'string.min': 'O campo {#label} deve ter pelo menos {#limit} caracteres',
|
||||
'string.max': 'O campo {#label} deve ter no máximo {#limit} caracteres',
|
||||
'string.pattern.base': 'O campo {#label} possui formato inválido',
|
||||
'number.min': 'O campo {#label} deve ser maior ou igual a {#limit}',
|
||||
'number.max': 'O campo {#label} deve ser menor ou igual a {#limit}',
|
||||
'array.min': 'O campo {#label} deve ter pelo menos {#limit} itens',
|
||||
'array.max': 'O campo {#label} deve ter no máximo {#limit} itens',
|
||||
'any.only': 'O campo {#label} deve ser um dos valores: {#valids}',
|
||||
};
|
||||
|
||||
export function formatValidationError(error: Joi.ValidationError): any {
|
||||
return {
|
||||
message: 'Dados de entrada inválidos',
|
||||
details: error.details.map(detail => ({
|
||||
field: detail.path.join('.'),
|
||||
message: detail.message,
|
||||
value: detail.context?.value,
|
||||
})),
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Schema Composition
|
||||
|
||||
### Reusable Schema Components
|
||||
```typescript
|
||||
export const commonFields = {
|
||||
instanceName: Joi.string().required().min(1).max(100).pattern(/^[a-zA-Z0-9_-]+$/),
|
||||
number: phoneNumberValidator.required(),
|
||||
delay: Joi.number().optional().min(0).max(60000),
|
||||
enabled: Joi.boolean().optional().default(true),
|
||||
};
|
||||
|
||||
export const mediaFields = {
|
||||
mediatype: Joi.string().required().valid('image', 'video', 'audio', 'document'),
|
||||
media: Joi.alternatives().try(
|
||||
Joi.string().uri(),
|
||||
base64Validator,
|
||||
).required(),
|
||||
caption: Joi.string().optional().max(1024),
|
||||
fileName: Joi.string().optional().max(255),
|
||||
};
|
||||
|
||||
// Compose schemas using common fields
|
||||
export const quickMessageSchema = Joi.object({
|
||||
...commonFields,
|
||||
text: Joi.string().required().min(1).max(4096),
|
||||
}).required();
|
||||
|
||||
export const quickMediaSchema = Joi.object({
|
||||
...commonFields,
|
||||
...mediaFields,
|
||||
}).required();
|
||||
```
|
||||
@@ -1,5 +1,6 @@
|
||||
.git
|
||||
*Dockerfile*
|
||||
*docker-compose*
|
||||
.env
|
||||
node_modules
|
||||
dist
|
||||
403
.env.example
Normal file
403
.env.example
Normal file
@@ -0,0 +1,403 @@
|
||||
SERVER_NAME=evolution
|
||||
SERVER_TYPE=http
|
||||
SERVER_PORT=8080
|
||||
# Server URL - Set your application url
|
||||
SERVER_URL=http://localhost:8080
|
||||
|
||||
SSL_CONF_PRIVKEY=/path/to/cert.key
|
||||
SSL_CONF_FULLCHAIN=/path/to/cert.crt
|
||||
|
||||
SENTRY_DSN=
|
||||
|
||||
# Telemetry - Set to false to disable telemetry
|
||||
TELEMETRY_ENABLED=true
|
||||
TELEMETRY_URL=
|
||||
|
||||
# Prometheus metrics - Set to true to enable Prometheus metrics
|
||||
PROMETHEUS_METRICS=false
|
||||
METRICS_AUTH_REQUIRED=true
|
||||
METRICS_USER=prometheus
|
||||
METRICS_PASSWORD=secure_random_password_here
|
||||
METRICS_ALLOWED_IPS=127.0.0.1,10.0.0.100,192.168.1.50
|
||||
|
||||
# Proxy configuration (optional)
|
||||
PROXY_HOST=
|
||||
PROXY_PORT=
|
||||
PROXY_PROTOCOL=
|
||||
PROXY_USERNAME=
|
||||
PROXY_PASSWORD=
|
||||
|
||||
# Audio converter API (optional)
|
||||
API_AUDIO_CONVERTER=
|
||||
API_AUDIO_CONVERTER_KEY=
|
||||
|
||||
# Cors - * for all or set separate by commas - ex.: 'yourdomain1.com, yourdomain2.com'
|
||||
CORS_ORIGIN=*
|
||||
CORS_METHODS=GET,POST,PUT,DELETE
|
||||
CORS_CREDENTIALS=true
|
||||
|
||||
# Determine the logs to be displayed
|
||||
LOG_LEVEL=ERROR,WARN,DEBUG,INFO,LOG,VERBOSE,DARK,WEBHOOKS,WEBSOCKET
|
||||
LOG_COLOR=true
|
||||
# Log Baileys - "fatal" | "error" | "warn" | "info" | "debug" | "trace"
|
||||
LOG_BAILEYS=error
|
||||
|
||||
# Set the maximum number of listeners that can be registered for an event
|
||||
EVENT_EMITTER_MAX_LISTENERS=50
|
||||
|
||||
# Determine how long the instance should be deleted from memory in case of no connection.
|
||||
# Default time: 5 minutes
|
||||
# If you don't even want an expiration, enter the value false
|
||||
DEL_INSTANCE=false
|
||||
|
||||
# Provider: postgresql | mysql | psql_bouncer
|
||||
DATABASE_PROVIDER=postgresql
|
||||
DATABASE_CONNECTION_URI='postgresql://user:pass@postgres:5432/evolution_db?schema=evolution_api'
|
||||
# Client name for the database connection
|
||||
# It is used to separate an API installation from another that uses the same database.
|
||||
DATABASE_CONNECTION_CLIENT_NAME=evolution_exchange
|
||||
|
||||
# Bouncer connection: used only when the database provider is set to 'psql_bouncer'.
|
||||
# Defines the PostgreSQL URL with pgbouncer enabled (pgbouncer=true).
|
||||
# DATABASE_BOUNCER_CONNECTION_URI=postgresql://user:pass@pgbouncer:5432/evolution_db?pgbouncer=true&schema=evolution_api
|
||||
|
||||
# Choose the data you want to save in the application's database
|
||||
DATABASE_SAVE_DATA_INSTANCE=true
|
||||
DATABASE_SAVE_DATA_NEW_MESSAGE=true
|
||||
DATABASE_SAVE_MESSAGE_UPDATE=true
|
||||
DATABASE_SAVE_DATA_CONTACTS=true
|
||||
DATABASE_SAVE_DATA_CHATS=true
|
||||
DATABASE_SAVE_DATA_LABELS=true
|
||||
DATABASE_SAVE_DATA_HISTORIC=true
|
||||
DATABASE_SAVE_IS_ON_WHATSAPP=true
|
||||
DATABASE_SAVE_IS_ON_WHATSAPP_DAYS=7
|
||||
DATABASE_DELETE_MESSAGE=true
|
||||
|
||||
# RabbitMQ - Environment variables
|
||||
RABBITMQ_ENABLED=false
|
||||
RABBITMQ_URI=amqp://localhost
|
||||
RABBITMQ_EXCHANGE_NAME=evolution
|
||||
RABBITMQ_FRAME_MAX=8192
|
||||
# Global events - By enabling this variable, events from all instances are sent in the same event queue.
|
||||
RABBITMQ_GLOBAL_ENABLED=false
|
||||
# Prefix key to queue name
|
||||
RABBITMQ_PREFIX_KEY=evolution
|
||||
# Choose the events you want to send to RabbitMQ
|
||||
RABBITMQ_EVENTS_APPLICATION_STARTUP=false
|
||||
RABBITMQ_EVENTS_INSTANCE_CREATE=false
|
||||
RABBITMQ_EVENTS_INSTANCE_DELETE=false
|
||||
RABBITMQ_EVENTS_QRCODE_UPDATED=false
|
||||
RABBITMQ_EVENTS_MESSAGES_SET=false
|
||||
RABBITMQ_EVENTS_MESSAGES_UPSERT=false
|
||||
RABBITMQ_EVENTS_MESSAGES_EDITED=false
|
||||
RABBITMQ_EVENTS_MESSAGES_UPDATE=false
|
||||
RABBITMQ_EVENTS_MESSAGES_DELETE=false
|
||||
RABBITMQ_EVENTS_SEND_MESSAGE=false
|
||||
RABBITMQ_EVENTS_SEND_MESSAGE_UPDATE=false
|
||||
RABBITMQ_EVENTS_CONTACTS_SET=false
|
||||
RABBITMQ_EVENTS_CONTACTS_UPSERT=false
|
||||
RABBITMQ_EVENTS_CONTACTS_UPDATE=false
|
||||
RABBITMQ_EVENTS_PRESENCE_UPDATE=false
|
||||
RABBITMQ_EVENTS_CHATS_SET=false
|
||||
RABBITMQ_EVENTS_CHATS_UPSERT=false
|
||||
RABBITMQ_EVENTS_CHATS_UPDATE=false
|
||||
RABBITMQ_EVENTS_CHATS_DELETE=false
|
||||
RABBITMQ_EVENTS_GROUPS_UPSERT=false
|
||||
RABBITMQ_EVENTS_GROUP_UPDATE=false
|
||||
RABBITMQ_EVENTS_GROUP_PARTICIPANTS_UPDATE=false
|
||||
RABBITMQ_EVENTS_CONNECTION_UPDATE=false
|
||||
RABBITMQ_EVENTS_REMOVE_INSTANCE=false
|
||||
RABBITMQ_EVENTS_LOGOUT_INSTANCE=false
|
||||
RABBITMQ_EVENTS_CALL=false
|
||||
RABBITMQ_EVENTS_TYPEBOT_START=false
|
||||
RABBITMQ_EVENTS_TYPEBOT_CHANGE_STATUS=false
|
||||
|
||||
# SQS - Environment variables
|
||||
SQS_ENABLED=false
|
||||
SQS_ACCESS_KEY_ID=
|
||||
SQS_SECRET_ACCESS_KEY=
|
||||
SQS_ACCOUNT_ID=
|
||||
SQS_REGION=
|
||||
|
||||
SQS_GLOBAL_ENABLED=false
|
||||
SQS_GLOBAL_FORCE_SINGLE_QUEUE=false
|
||||
SQS_GLOBAL_APPLICATION_STARTUP=false
|
||||
SQS_GLOBAL_CALL=false
|
||||
SQS_GLOBAL_CHATS_DELETE=false
|
||||
SQS_GLOBAL_CHATS_SET=false
|
||||
SQS_GLOBAL_CHATS_UPDATE=false
|
||||
SQS_GLOBAL_CHATS_UPSERT=false
|
||||
SQS_GLOBAL_CONNECTION_UPDATE=false
|
||||
SQS_GLOBAL_CONTACTS_SET=false
|
||||
SQS_GLOBAL_CONTACTS_UPDATE=false
|
||||
SQS_GLOBAL_CONTACTS_UPSERT=false
|
||||
SQS_GLOBAL_GROUP_PARTICIPANTS_UPDATE=false
|
||||
SQS_GLOBAL_GROUPS_UPDATE=false
|
||||
SQS_GLOBAL_GROUPS_UPSERT=false
|
||||
SQS_GLOBAL_LABELS_ASSOCIATION=false
|
||||
SQS_GLOBAL_LABELS_EDIT=false
|
||||
SQS_GLOBAL_LOGOUT_INSTANCE=false
|
||||
SQS_GLOBAL_MESSAGES_DELETE=false
|
||||
SQS_GLOBAL_MESSAGES_EDITED=false
|
||||
SQS_GLOBAL_MESSAGES_SET=false
|
||||
SQS_GLOBAL_MESSAGES_UPDATE=false
|
||||
SQS_GLOBAL_MESSAGES_UPSERT=false
|
||||
SQS_GLOBAL_PRESENCE_UPDATE=false
|
||||
SQS_GLOBAL_QRCODE_UPDATED=false
|
||||
SQS_GLOBAL_REMOVE_INSTANCE=false
|
||||
SQS_GLOBAL_SEND_MESSAGE=false
|
||||
SQS_GLOBAL_TYPEBOT_CHANGE_STATUS=false
|
||||
SQS_GLOBAL_TYPEBOT_START=false
|
||||
|
||||
# Websocket - Environment variables
|
||||
WEBSOCKET_ENABLED=false
|
||||
WEBSOCKET_GLOBAL_EVENTS=false
|
||||
WEBSOCKET_ALLOWED_HOSTS=127.0.0.1,::1,::ffff:127.0.0.1
|
||||
|
||||
# Pusher - Environment variables
|
||||
PUSHER_ENABLED=false
|
||||
PUSHER_GLOBAL_ENABLED=false
|
||||
PUSHER_GLOBAL_APP_ID=
|
||||
PUSHER_GLOBAL_KEY=
|
||||
PUSHER_GLOBAL_SECRET=
|
||||
PUSHER_GLOBAL_CLUSTER=
|
||||
PUSHER_GLOBAL_USE_TLS=true
|
||||
# Choose the events you want to send to Pusher
|
||||
PUSHER_EVENTS_APPLICATION_STARTUP=true
|
||||
PUSHER_EVENTS_QRCODE_UPDATED=true
|
||||
PUSHER_EVENTS_MESSAGES_SET=true
|
||||
PUSHER_EVENTS_MESSAGES_UPSERT=true
|
||||
PUSHER_EVENTS_MESSAGES_EDITED=true
|
||||
PUSHER_EVENTS_MESSAGES_UPDATE=true
|
||||
PUSHER_EVENTS_MESSAGES_DELETE=true
|
||||
PUSHER_EVENTS_SEND_MESSAGE=true
|
||||
PUSHER_EVENTS_SEND_MESSAGE_UPDATE=true
|
||||
PUSHER_EVENTS_CONTACTS_SET=true
|
||||
PUSHER_EVENTS_CONTACTS_UPSERT=true
|
||||
PUSHER_EVENTS_CONTACTS_UPDATE=true
|
||||
PUSHER_EVENTS_PRESENCE_UPDATE=true
|
||||
PUSHER_EVENTS_CHATS_SET=true
|
||||
PUSHER_EVENTS_CHATS_UPSERT=true
|
||||
PUSHER_EVENTS_CHATS_UPDATE=true
|
||||
PUSHER_EVENTS_CHATS_DELETE=true
|
||||
PUSHER_EVENTS_GROUPS_UPSERT=true
|
||||
PUSHER_EVENTS_GROUPS_UPDATE=true
|
||||
PUSHER_EVENTS_GROUP_PARTICIPANTS_UPDATE=true
|
||||
PUSHER_EVENTS_CONNECTION_UPDATE=true
|
||||
PUSHER_EVENTS_LABELS_EDIT=true
|
||||
PUSHER_EVENTS_LABELS_ASSOCIATION=true
|
||||
PUSHER_EVENTS_CALL=true
|
||||
PUSHER_EVENTS_TYPEBOT_START=false
|
||||
PUSHER_EVENTS_TYPEBOT_CHANGE_STATUS=false
|
||||
|
||||
# Kafka - Environment variables
|
||||
KAFKA_ENABLED=false
|
||||
KAFKA_CLIENT_ID=evolution-api
|
||||
KAFKA_BROKERS=localhost:9092
|
||||
KAFKA_CONNECTION_TIMEOUT=3000
|
||||
KAFKA_REQUEST_TIMEOUT=30000
|
||||
# Global events - By enabling this variable, events from all instances are sent to global Kafka topics.
|
||||
KAFKA_GLOBAL_ENABLED=false
|
||||
KAFKA_CONSUMER_GROUP_ID=evolution-api-consumers
|
||||
KAFKA_TOPIC_PREFIX=evolution
|
||||
KAFKA_NUM_PARTITIONS=1
|
||||
KAFKA_REPLICATION_FACTOR=1
|
||||
KAFKA_AUTO_CREATE_TOPICS=false
|
||||
# Choose the events you want to send to Kafka
|
||||
KAFKA_EVENTS_APPLICATION_STARTUP=false
|
||||
KAFKA_EVENTS_INSTANCE_CREATE=false
|
||||
KAFKA_EVENTS_INSTANCE_DELETE=false
|
||||
KAFKA_EVENTS_QRCODE_UPDATED=false
|
||||
KAFKA_EVENTS_MESSAGES_SET=false
|
||||
KAFKA_EVENTS_MESSAGES_UPSERT=false
|
||||
KAFKA_EVENTS_MESSAGES_EDITED=false
|
||||
KAFKA_EVENTS_MESSAGES_UPDATE=false
|
||||
KAFKA_EVENTS_MESSAGES_DELETE=false
|
||||
KAFKA_EVENTS_SEND_MESSAGE=false
|
||||
KAFKA_EVENTS_SEND_MESSAGE_UPDATE=false
|
||||
KAFKA_EVENTS_CONTACTS_SET=false
|
||||
KAFKA_EVENTS_CONTACTS_UPSERT=false
|
||||
KAFKA_EVENTS_CONTACTS_UPDATE=false
|
||||
KAFKA_EVENTS_PRESENCE_UPDATE=false
|
||||
KAFKA_EVENTS_CHATS_SET=false
|
||||
KAFKA_EVENTS_CHATS_UPSERT=false
|
||||
KAFKA_EVENTS_CHATS_UPDATE=false
|
||||
KAFKA_EVENTS_CHATS_DELETE=false
|
||||
KAFKA_EVENTS_GROUPS_UPSERT=false
|
||||
KAFKA_EVENTS_GROUPS_UPDATE=false
|
||||
KAFKA_EVENTS_GROUP_PARTICIPANTS_UPDATE=false
|
||||
KAFKA_EVENTS_CONNECTION_UPDATE=false
|
||||
KAFKA_EVENTS_LABELS_EDIT=false
|
||||
KAFKA_EVENTS_LABELS_ASSOCIATION=false
|
||||
KAFKA_EVENTS_CALL=false
|
||||
KAFKA_EVENTS_TYPEBOT_START=false
|
||||
KAFKA_EVENTS_TYPEBOT_CHANGE_STATUS=false
|
||||
# SASL Authentication (optional)
|
||||
KAFKA_SASL_ENABLED=false
|
||||
KAFKA_SASL_MECHANISM=plain
|
||||
KAFKA_SASL_USERNAME=
|
||||
KAFKA_SASL_PASSWORD=
|
||||
# SSL Configuration (optional)
|
||||
KAFKA_SSL_ENABLED=false
|
||||
KAFKA_SSL_REJECT_UNAUTHORIZED=true
|
||||
KAFKA_SSL_CA=
|
||||
KAFKA_SSL_KEY=
|
||||
KAFKA_SSL_CERT=
|
||||
|
||||
# WhatsApp Business API - Environment variables
|
||||
# Token used to validate the webhook on the Facebook APP
|
||||
WA_BUSINESS_TOKEN_WEBHOOK=evolution
|
||||
WA_BUSINESS_URL=https://graph.facebook.com
|
||||
WA_BUSINESS_VERSION=v20.0
|
||||
WA_BUSINESS_LANGUAGE=en_US
|
||||
|
||||
# Global Webhook Settings
|
||||
# Each instance's Webhook URL and events will be requested at the time it is created
|
||||
WEBHOOK_GLOBAL_ENABLED=false
|
||||
# Define a global webhook that will listen for enabled events from all instances
|
||||
WEBHOOK_GLOBAL_URL=''
|
||||
# With this option activated, you work with a url per webhook event, respecting the global url and the name of each event
|
||||
WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=false
|
||||
# Set the events you want to hear
|
||||
WEBHOOK_EVENTS_APPLICATION_STARTUP=false
|
||||
WEBHOOK_EVENTS_QRCODE_UPDATED=true
|
||||
WEBHOOK_EVENTS_MESSAGES_SET=true
|
||||
WEBHOOK_EVENTS_MESSAGES_UPSERT=true
|
||||
WEBHOOK_EVENTS_MESSAGES_EDITED=true
|
||||
WEBHOOK_EVENTS_MESSAGES_UPDATE=true
|
||||
WEBHOOK_EVENTS_MESSAGES_DELETE=true
|
||||
WEBHOOK_EVENTS_SEND_MESSAGE=true
|
||||
WEBHOOK_EVENTS_SEND_MESSAGE_UPDATE=true
|
||||
WEBHOOK_EVENTS_CONTACTS_SET=true
|
||||
WEBHOOK_EVENTS_CONTACTS_UPSERT=true
|
||||
WEBHOOK_EVENTS_CONTACTS_UPDATE=true
|
||||
WEBHOOK_EVENTS_PRESENCE_UPDATE=true
|
||||
WEBHOOK_EVENTS_CHATS_SET=true
|
||||
WEBHOOK_EVENTS_CHATS_UPSERT=true
|
||||
WEBHOOK_EVENTS_CHATS_UPDATE=true
|
||||
WEBHOOK_EVENTS_CHATS_DELETE=true
|
||||
WEBHOOK_EVENTS_GROUPS_UPSERT=true
|
||||
WEBHOOK_EVENTS_GROUPS_UPDATE=true
|
||||
WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=true
|
||||
WEBHOOK_EVENTS_CONNECTION_UPDATE=true
|
||||
WEBHOOK_EVENTS_REMOVE_INSTANCE=false
|
||||
WEBHOOK_EVENTS_LOGOUT_INSTANCE=false
|
||||
WEBHOOK_EVENTS_LABELS_EDIT=true
|
||||
WEBHOOK_EVENTS_LABELS_ASSOCIATION=true
|
||||
WEBHOOK_EVENTS_CALL=true
|
||||
# This events is used with Typebot
|
||||
WEBHOOK_EVENTS_TYPEBOT_START=false
|
||||
WEBHOOK_EVENTS_TYPEBOT_CHANGE_STATUS=false
|
||||
# This event is used to send errors
|
||||
WEBHOOK_EVENTS_ERRORS=false
|
||||
WEBHOOK_EVENTS_ERRORS_WEBHOOK=
|
||||
|
||||
WEBHOOK_REQUEST_TIMEOUT_MS=60000
|
||||
WEBHOOK_RETRY_MAX_ATTEMPTS=10
|
||||
WEBHOOK_RETRY_INITIAL_DELAY_SECONDS=5
|
||||
WEBHOOK_RETRY_USE_EXPONENTIAL_BACKOFF=true
|
||||
WEBHOOK_RETRY_MAX_DELAY_SECONDS=300
|
||||
WEBHOOK_RETRY_JITTER_FACTOR=0.2
|
||||
# Comma separated list of HTTP status codes that should not trigger retries
|
||||
WEBHOOK_RETRY_NON_RETRYABLE_STATUS_CODES=400,401,403,404,422
|
||||
|
||||
# Name that will be displayed on smartphone connection
|
||||
CONFIG_SESSION_PHONE_CLIENT=Evolution API
|
||||
# Browser Name = Chrome | Firefox | Edge | Opera | Safari
|
||||
CONFIG_SESSION_PHONE_NAME=Chrome
|
||||
|
||||
# Whatsapp Web version for baileys channel
|
||||
# https://web.whatsapp.com/check-update?version=0&platform=web
|
||||
|
||||
|
||||
# Set qrcode display limit
|
||||
QRCODE_LIMIT=30
|
||||
# Color of the QRCode on base64
|
||||
QRCODE_COLOR='#175197'
|
||||
|
||||
# Typebot - Environment variables
|
||||
TYPEBOT_ENABLED=false
|
||||
# old | latest
|
||||
TYPEBOT_API_VERSION=latest
|
||||
|
||||
# Chatwoot - Environment variables
|
||||
CHATWOOT_ENABLED=false
|
||||
# If you leave this option as false, when deleting the message for everyone on WhatsApp, it will not be deleted on Chatwoot.
|
||||
CHATWOOT_MESSAGE_READ=true
|
||||
# If you leave this option as true, when sending a message in Chatwoot, the client's last message will be marked as read on WhatsApp.
|
||||
CHATWOOT_MESSAGE_DELETE=true
|
||||
# If you leave this option as true, a contact will be created on Chatwoot to provide the QR Code and update messages about the instance.
|
||||
CHATWOOT_BOT_CONTACT=true
|
||||
# This db connection is used to import messages from whatsapp to chatwoot database
|
||||
CHATWOOT_IMPORT_DATABASE_CONNECTION_URI=postgresql://user:passwprd@host:5432/chatwoot?sslmode=disable
|
||||
CHATWOOT_IMPORT_PLACEHOLDER_MEDIA_MESSAGE=true
|
||||
|
||||
# OpenAI - Environment variables
|
||||
OPENAI_ENABLED=false
|
||||
|
||||
# Dify - Environment variables
|
||||
DIFY_ENABLED=false
|
||||
|
||||
# n8n - Environment variables
|
||||
N8N_ENABLED=false
|
||||
|
||||
# EvoAI - Environment variables
|
||||
EVOAI_ENABLED=false
|
||||
|
||||
# Cache - Environment variables
|
||||
# Redis Cache enabled
|
||||
CACHE_REDIS_ENABLED=true
|
||||
CACHE_REDIS_URI=redis://localhost:6379/6
|
||||
CACHE_REDIS_TTL=604800
|
||||
# Prefix serves to differentiate data from one installation to another that are using the same redis
|
||||
CACHE_REDIS_PREFIX_KEY=evolution
|
||||
# Enabling this variable will save the connection information in Redis and not in the database.
|
||||
CACHE_REDIS_SAVE_INSTANCES=false
|
||||
# Local Cache enabled
|
||||
CACHE_LOCAL_ENABLED=false
|
||||
|
||||
# Amazon S3 - Environment variables
|
||||
S3_ENABLED=false
|
||||
S3_ACCESS_KEY=
|
||||
S3_SECRET_KEY=
|
||||
S3_BUCKET=evolution
|
||||
S3_PORT=443
|
||||
S3_ENDPOINT=s3.domain.com
|
||||
S3_REGION=eu-west-3
|
||||
S3_USE_SSL=true
|
||||
|
||||
# AMAZON S3 - Environment variables
|
||||
# S3_ENABLED=true
|
||||
# S3_BUCKET=bucket_name
|
||||
# S3_ACCESS_KEY=access_key_id
|
||||
# S3_SECRET_KEY=secret_access_key
|
||||
# S3_ENDPOINT=s3.amazonaws.com # region: s3.eu-west-3.amazonaws.com
|
||||
# S3_REGION=eu-west-3
|
||||
|
||||
# MINIO Use SSL - Environment variables
|
||||
# S3_ENABLED=true
|
||||
# S3_ACCESS_KEY=access_key_id
|
||||
# S3_SECRET_KEY=secret_access_key
|
||||
# S3_BUCKET=bucket_name
|
||||
# S3_PORT=443
|
||||
# S3_ENDPOINT=s3.domain.com
|
||||
# S3_USE_SSL=true
|
||||
# S3_REGION=eu-south
|
||||
|
||||
# Evolution Audio Converter - Environment variables - https://github.com/EvolutionAPI/evolution-audio-converter
|
||||
# API_AUDIO_CONVERTER=http://localhost:4040/process-audio
|
||||
# API_AUDIO_CONVERTER_KEY=429683C4C977415CAAFCCE10F7D57E11
|
||||
|
||||
# Define a global apikey to access all instances.
|
||||
# OBS: This key must be inserted in the request header to create an instance.
|
||||
AUTHENTICATION_API_KEY=429683C4C977415CAAFCCE10F7D57E11
|
||||
# If you leave this option as true, the instances will be exposed in the fetch instances endpoint.
|
||||
AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true
|
||||
LANGUAGE=en
|
||||
|
||||
# Define a global proxy to be used if the instance does not have one
|
||||
# PROXY_HOST=
|
||||
# PROXY_PORT=80
|
||||
# PROXY_PROTOCOL=http
|
||||
# PROXY_USERNAME=
|
||||
# PROXY_PASSWORD=
|
||||
57
.eslintrc.js
57
.eslintrc.js
@@ -1,42 +1,39 @@
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
sourceType: 'CommonJS',
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir: __dirname,
|
||||
sourceType: 'module',
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
||||
},
|
||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
'plugin:prettier/recommended'
|
||||
],
|
||||
plugins: ['@typescript-eslint', 'simple-import-sort', 'import'],
|
||||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
|
||||
globals: {
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly',
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly',
|
||||
},
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
jest: true,
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
ignorePatterns: ['.eslintrc.js'],
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'@typescript-eslint/ban-types': [
|
||||
'error',
|
||||
{
|
||||
extendDefaults: true,
|
||||
types: {
|
||||
'{}': false,
|
||||
Object: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
'prettier/prettier': ['error', { endOfLine: 'auto' }],
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'import/first': 'error',
|
||||
'import/no-duplicates': 'error',
|
||||
'simple-import-sort/imports': 'error',
|
||||
'simple-import-sort/exports': 'error',
|
||||
'@typescript-eslint/no-empty-object-type': 'off',
|
||||
'@typescript-eslint/no-wrapper-object-types': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'off',
|
||||
'prettier/prettier': ['error', { endOfLine: 'auto' }],
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
107
.github/ISSUE_TEMPLATE/-en--bug-report.yaml
vendored
Normal file
107
.github/ISSUE_TEMPLATE/-en--bug-report.yaml
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
name: Bug Report
|
||||
description: Create a report to help us improve.
|
||||
labels:
|
||||
- bug
|
||||
- en
|
||||
# - help wanted
|
||||
# Automatically assign the issue to:
|
||||
# assignees: DavidsonGomes
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Welcome!
|
||||
description: |
|
||||
The issue tracker is only for reporting bugs and feature requests.
|
||||
For user-related support questions, please visit:
|
||||
- [Discord](https://evolution-api.com/discord)
|
||||
- [WhatsApp Group](https://evolution-api.com/whatsapp)
|
||||
<br/>
|
||||
|
||||
**DO NOT OPEN AN ISSUE FOR GENERAL SUPPORT QUESTIONS.**
|
||||
|
||||
options:
|
||||
- label: Yes, I have searched for similar issues on [GitHub](https://github.com/EvolutionAPI/evolution-api/issues) and found none.
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What did you do?
|
||||
description: |
|
||||
How to write a good bug report?
|
||||
|
||||
- Respect the issue template as much as possible.
|
||||
- The title should be short and descriptive.
|
||||
- Explain the conditions that led you to report this issue: the context.
|
||||
- The context should lead to something, an idea or problem you are facing.
|
||||
- Be clear and concise.
|
||||
- Format your messages to help the reader focus on what matters and understand the structure of your message, use [Markdown syntax](https://help.github.com/articles/github-flavored-markdown)
|
||||
placeholder: Describe the problem you encountered in detail.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What did you expect?
|
||||
placeholder: Describe what you expected to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What did you observe instead of what you expected?
|
||||
placeholder: Explain what actually happens when you follow the steps above.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Screenshots/Videos
|
||||
placeholder: |
|
||||
If possible, add screenshots or videos that illustrate the problem. This can be extremely helpful in understanding the issue better.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Which version of the API are you using?
|
||||
description: |
|
||||
Enter the version number found in the `version` property of the **package.json**.
|
||||
placeholder: Paste the version here.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: select
|
||||
attributes:
|
||||
label: What is your environment?
|
||||
options:
|
||||
- Windows
|
||||
- Linux
|
||||
- Mac
|
||||
- Docker
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Other environment specifications
|
||||
placeholder: 'Hardware/Software: [e.g., CPU, GPU]'
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: If applicable, paste the log output
|
||||
description: |
|
||||
Please attach any logs that might be related to the issue.
|
||||
If the logs contain sensitive information, consider sending them privately to one of the project maintainers.
|
||||
placeholder: Paste the application log here.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Notes
|
||||
description: Include any other information you think might be useful to understand or resolve the bug.
|
||||
validations:
|
||||
required: false
|
||||
86
.github/ISSUE_TEMPLATE/-en--feature-request.yaml
vendored
Normal file
86
.github/ISSUE_TEMPLATE/-en--feature-request.yaml
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
name: Feature Request
|
||||
description: Suggest ideas for the project.
|
||||
labels:
|
||||
- enhancement
|
||||
- en
|
||||
# Automatically assign the issue to:
|
||||
# assignees: DavidsonGomes
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Welcome!
|
||||
description: '**DO NOT OPEN FOR GENERAL SUPPORT QUESTIONS.**'
|
||||
|
||||
options:
|
||||
- label: Yes, I have searched for similar requests on [GitHub](https://github.com/code-chat-br/whatsapp-api/issues) and found none.
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: What type of feature?
|
||||
description: |
|
||||
How to write a good feature request?
|
||||
|
||||
- Respect the issue template as much as possible.
|
||||
- The title should be short and descriptive.
|
||||
- Explain the conditions that led you to suggest this feature: the context.
|
||||
- The context should lead to something, an idea or problem you are facing.
|
||||
- Be clear and concise.
|
||||
- Format your messages to help the reader focus on what matters and understand the structure of your message, use [Markdown syntax](https://help.github.com/articles/github-flavored-markdown)
|
||||
options:
|
||||
- Integration
|
||||
- Functionality
|
||||
- Endpoint
|
||||
- Database adjustment
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What is the motivation for the request?
|
||||
description: |
|
||||
What problem does the feature seek to solve?
|
||||
Clearly and in detail describe the functionality you want to be implemented.
|
||||
Explain how it fits into the context of the project.
|
||||
placeholder: Detailed description
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Usage Examples
|
||||
description: |
|
||||
Provide specific examples of how this functionality could be used.
|
||||
This can include scenarios or use cases where the feature would be particularly beneficial.
|
||||
placeholder: text - image - video - flowcharts
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: How should the feature be developed?
|
||||
description: |
|
||||
Should it be inserted directly into the code?
|
||||
Should it be built as a different application that acts as an extension of the API?
|
||||
For example: a `worker`?
|
||||
|
||||
Discuss how this new functionality could impact other parts of the project, if applicable.
|
||||
|
||||
---
|
||||
|
||||
If you have ideas on how this functionality could be implemented, please share them here.
|
||||
This is not mandatory, but it can be helpful for the development team.
|
||||
|
||||
placeholder: Insert feature ideas here
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Notes
|
||||
description: Any other information you believe is relevant to your request.
|
||||
placeholder: Insert your observations here.
|
||||
validations:
|
||||
required: false
|
||||
108
.github/ISSUE_TEMPLATE/-pt--reportar-bug.yaml
vendored
Normal file
108
.github/ISSUE_TEMPLATE/-pt--reportar-bug.yaml
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
name: Relatório de bug
|
||||
description: Crie um relatório para nos ajudar a melhorar.
|
||||
labels:
|
||||
- bug
|
||||
- pt-br
|
||||
# - help wanted
|
||||
# Atrubuir automaticamente a issue a:
|
||||
# assignees: DavidsonGomes
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: termos
|
||||
attributes:
|
||||
label: Bem-vido!
|
||||
description: |
|
||||
O rastreador de problemas é apenas para relatar bugs e solicitações de recursos.
|
||||
Para perguntas de suporte relacionadas ao usuário final, acesse:
|
||||
- [Discord](https://evolution-api.com/discord)
|
||||
- [Grupo do WhatsApp](https://evolution-api.com/whatsapp)
|
||||
<br/>
|
||||
|
||||
**NÃO ABRA UM PROBLEMA PARA PERGUNTAS GERAIS DE SUPORTE.**
|
||||
|
||||
options:
|
||||
- label: Sim, pesquisei problemas semelhantes no [GitHub](https://github.com/EvolutionAPI/evolution-api/issues) e não encontrei nenhum.
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: O que você fez?
|
||||
description: |
|
||||
Como escrever um bom relatório de bug?
|
||||
|
||||
- Respeite o modelo de problema tanto quanto possível.
|
||||
- O título deve ser curto e descritivo.
|
||||
- Explique as condições que o levaram a reportar este problema: o contexto.
|
||||
- O contexto deve levar a algo, ideia ou problema que você está enfrentando.
|
||||
- Seja claro e conciso.
|
||||
- Formate suas mensagens para ajudar o leitor a se concentrar no que importa e entender a estrutura da sua mensagem, use [sintaxe Markdown](https://help.github.com/articles/github-flavored-markdown)
|
||||
placeholder: Descreva detalhadamente o problema que você encontrou.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: O que você esperava?
|
||||
placeholder: Descreva o que você esperava que acontecesse.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: O que vc observou ao invés do que esperava?
|
||||
placeholder: Explique o que realmente acontece quando você segue os passos acima.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Capturas de Tela/Vídeos
|
||||
placeholder: |
|
||||
Se possível, adicione capturas de tela ou vídeos que ilustrem o problema. Isso pode ser extremamente útil para entender melhor o problema.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Qual versão da API você está usando?
|
||||
description: |
|
||||
Insira o número da sua versão que está na propriedade `version` do **package.json**.
|
||||
placeholder: Cole aqui a versão.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: select
|
||||
attributes:
|
||||
label: Qual é o seu ambiente?
|
||||
options:
|
||||
- Windows
|
||||
- Linux
|
||||
- Mac
|
||||
- Docker
|
||||
- Outro
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Outras expecificações do ambiente
|
||||
placeholder: 'Hardware/Software: [ex: CPU, GPU]'
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Se aplicável, cole a saída do log
|
||||
description: |
|
||||
Por favor, anexe os logs que possam estar relacionados ao problema.
|
||||
Se os logs contiverem informações sensíveis, considere enviá-los de forma privada para um dos mantenedores do projeto.
|
||||
placeholder: Cole aqui o log da aplicação
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Notas Adicionais
|
||||
description: Inclua aqui qualquer outra informação que você ache que possa ser útil para entender ou resolver o bug.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
86
.github/ISSUE_TEMPLATE/-pt--solicitar-recurso.yaml
vendored
Normal file
86
.github/ISSUE_TEMPLATE/-pt--solicitar-recurso.yaml
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
name: Solicitação de recursos
|
||||
description: Sugira ideias para o projeto.
|
||||
labels:
|
||||
- enhancement
|
||||
- pt-br
|
||||
# Automatically assign the issue to:
|
||||
# assignees: DavidsonGomes
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: termos
|
||||
attributes:
|
||||
label: Bem-vindo!
|
||||
description: '**NÃO ABRA PARA PERGUNTAS GERAIS DE SUPORTE.**'
|
||||
|
||||
options:
|
||||
- label: Sim, pesquisei solicitações semelhantes no [GitHub](https://github.com/code-chat-br/whatsapp-api/issues) e não encontrei nenhum.
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Qual tipo de recurso?
|
||||
description: |
|
||||
Como escrever uma boa solicitação de bug?
|
||||
|
||||
- Respeite o modelo de problema tanto quanto possível.
|
||||
- O título deve ser curto e descritivo.
|
||||
- Explique as condições que o levaram a reportar este problema: o contexto.
|
||||
- O contexto deve levar a algo, ideia ou problema que você está enfrentando.
|
||||
- Seja claro e conciso.
|
||||
- Formate suas mensagens para ajudar o leitor a se concentrar no que importa e entender a estrutura da sua mensagem, use [sintaxe Markdown](https://help.github.com/articles/github-flavored-markdown)
|
||||
options:
|
||||
- Integração
|
||||
- Funcionalidade
|
||||
- Endpoint
|
||||
- Ajuste de banco de dados
|
||||
- Outro
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Qual a motivação para a solicitação?
|
||||
description: |
|
||||
Qual problema o recurso busca resolver?
|
||||
Descreva claramente e em detalhes a funcionalidade que você deseja que seja implementada.
|
||||
Explique como isso se encaixa no contexto do projeto.
|
||||
placeholder: Descrição detalhada
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Exemplos de Uso
|
||||
description: |
|
||||
Forneça exemplos específicos de como essa funcionalidade poderia ser utilizada.
|
||||
Isso pode incluir cenários ou casos de uso onde a funcionalidade seria particularmente benéfica.
|
||||
placeholder: texto - imagem - video - fluxogramas
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Como o recurso deve ser desenvolvido?
|
||||
description: |
|
||||
Deve ser inserido diretamente no código?
|
||||
Deve ser construído uma aplicação diferente que atuará como uma extenção da api?
|
||||
Por exemplo: um `worker`?
|
||||
|
||||
Discuta como essa nova funcionalidade poderia impactar outras partes do projeto, se aplicável.
|
||||
|
||||
---
|
||||
|
||||
Se você tem ideias sobre como essa funcionalidade pode ser implementada, por favor, compartilhe-as aqui.
|
||||
Isso não é obrigatório, mas pode ser útil para a equipe de desenvolvimento.
|
||||
|
||||
placeholder: Insira ideias para o recurso
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Notas Adicionais
|
||||
description: Qualquer outra informação que você acredita ser relevante para a sua solicitação.
|
||||
placeholder: Insira aqui as sua observções.
|
||||
validations:
|
||||
required: false
|
||||
81
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
81
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: 🐛 Bug Report
|
||||
description: Report a bug or unexpected behavior
|
||||
title: "[BUG] "
|
||||
labels: ["bug", "needs-triage"]
|
||||
assignees: []
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
Please search existing issues before creating a new one.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: 📋 Bug Description
|
||||
description: A clear and concise description of what the bug is.
|
||||
placeholder: Describe the bug...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: 🔄 Steps to Reproduce
|
||||
description: Steps to reproduce the behavior
|
||||
placeholder: |
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: ✅ Expected Behavior
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
placeholder: What should happen?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: actual
|
||||
attributes:
|
||||
label: ❌ Actual Behavior
|
||||
description: A clear and concise description of what actually happened.
|
||||
placeholder: What actually happened?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: 🌍 Environment
|
||||
description: Please provide information about your environment
|
||||
value: |
|
||||
- OS: [e.g. Ubuntu 20.04, Windows 10, macOS 12.0]
|
||||
- Node.js version: [e.g. 18.17.0]
|
||||
- Evolution API version: [e.g. 2.3.7]
|
||||
- Database: [e.g. PostgreSQL 14, MySQL 8.0]
|
||||
- Connection type: [e.g. Baileys, WhatsApp Business API]
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: 📋 Logs
|
||||
description: If applicable, add logs to help explain your problem.
|
||||
placeholder: Paste relevant logs here...
|
||||
render: shell
|
||||
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: 📝 Additional Context
|
||||
description: Add any other context about the problem here.
|
||||
placeholder: Any additional information...
|
||||
85
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
85
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
name: ✨ Feature Request
|
||||
description: Suggest a new feature or enhancement
|
||||
title: "[FEATURE] "
|
||||
labels: ["enhancement", "needs-triage"]
|
||||
assignees: []
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for suggesting a new feature!
|
||||
Please check our [Feature Requests on Canny](https://evolutionapi.canny.io/feature-requests) first.
|
||||
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: 🎯 Problem Statement
|
||||
description: Is your feature request related to a problem? Please describe.
|
||||
placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: 💡 Proposed Solution
|
||||
description: Describe the solution you'd like
|
||||
placeholder: A clear and concise description of what you want to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: 🔄 Alternatives Considered
|
||||
description: Describe alternatives you've considered
|
||||
placeholder: A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
- type: dropdown
|
||||
id: priority
|
||||
attributes:
|
||||
label: 📊 Priority
|
||||
description: How important is this feature to you?
|
||||
options:
|
||||
- Low - Nice to have
|
||||
- Medium - Would be helpful
|
||||
- High - Important for my use case
|
||||
- Critical - Blocking my work
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: component
|
||||
attributes:
|
||||
label: 🧩 Component
|
||||
description: Which component does this feature relate to?
|
||||
options:
|
||||
- WhatsApp Integration (Baileys)
|
||||
- WhatsApp Business API
|
||||
- Chatwoot Integration
|
||||
- Typebot Integration
|
||||
- OpenAI Integration
|
||||
- Dify Integration
|
||||
- API Endpoints
|
||||
- Database
|
||||
- Authentication
|
||||
- Webhooks
|
||||
- File Storage
|
||||
- Other
|
||||
|
||||
- type: textarea
|
||||
id: use_case
|
||||
attributes:
|
||||
label: 🎯 Use Case
|
||||
description: Describe your specific use case for this feature
|
||||
placeholder: How would you use this feature? What problem does it solve for you?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: 📝 Additional Context
|
||||
description: Add any other context, screenshots, or examples about the feature request here.
|
||||
placeholder: Any additional information, mockups, or examples...
|
||||
41
.github/pull_request_template.md
vendored
Normal file
41
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
## 📋 Description
|
||||
<!-- Describe your changes in detail -->
|
||||
|
||||
## 🔗 Related Issue
|
||||
<!-- Link to the issue this PR addresses -->
|
||||
Closes #(issue_number)
|
||||
|
||||
## 🧪 Type of Change
|
||||
<!-- Mark with an `x` all the checkboxes that apply -->
|
||||
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] ✨ New feature (non-breaking change which adds functionality)
|
||||
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] 📚 Documentation update
|
||||
- [ ] 🔧 Refactoring (no functional changes)
|
||||
- [ ] ⚡ Performance improvement
|
||||
- [ ] 🧹 Code cleanup
|
||||
- [ ] 🔒 Security fix
|
||||
|
||||
## 🧪 Testing
|
||||
<!-- Describe the testing you performed to verify your changes -->
|
||||
- [ ] Manual testing completed
|
||||
- [ ] Functionality verified in development environment
|
||||
- [ ] No breaking changes introduced
|
||||
- [ ] Tested with different connection types (if applicable)
|
||||
|
||||
## 📸 Screenshots (if applicable)
|
||||
<!-- Add screenshots to help explain your changes -->
|
||||
|
||||
## ✅ Checklist
|
||||
<!-- Mark with an `x` all the checkboxes that apply -->
|
||||
- [ ] My code follows the project's style guidelines
|
||||
- [ ] I have performed a self-review of my code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have manually tested my changes thoroughly
|
||||
- [ ] I have verified the changes work with different scenarios
|
||||
- [ ] Any dependent changes have been merged and published
|
||||
|
||||
## 📝 Additional Notes
|
||||
<!-- Any additional information, concerns, or questions -->
|
||||
42
.github/workflows/check_code_quality.yml
vendored
Normal file
42
.github/workflows/check_code_quality.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: Check Code Quality
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
|
||||
jobs:
|
||||
check-lint-and-build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20.x
|
||||
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- name: Install packages
|
||||
run: npm ci
|
||||
|
||||
- name: Check linting
|
||||
run: npm run lint:check
|
||||
|
||||
- name: Generate Prisma client
|
||||
run: npm run db:generate
|
||||
|
||||
- name: Check build
|
||||
run: npm run build
|
||||
50
.github/workflows/publish_docker_image.yml
vendored
Normal file
50
.github/workflows/publish_docker_image.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Build Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*.*.*"
|
||||
|
||||
jobs:
|
||||
build_deploy:
|
||||
name: Build and Deploy
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: evoapicloud/evolution-api
|
||||
tags: type=semver,pattern=v{{version}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
50
.github/workflows/publish_docker_image_homolog.yml
vendored
Normal file
50
.github/workflows/publish_docker_image_homolog.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Build Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
build_deploy:
|
||||
name: Build and Deploy
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: evoapicloud/evolution-api
|
||||
tags: homolog
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
50
.github/workflows/publish_docker_image_latest.yml
vendored
Normal file
50
.github/workflows/publish_docker_image_latest.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Build Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build_deploy:
|
||||
name: Build and Deploy
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: evoapicloud/evolution-api
|
||||
tags: latest
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
55
.github/workflows/security.yml
vendored
Normal file
55
.github/workflows/security.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
name: Security Scan
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
schedule:
|
||||
- cron: '0 0 * * 1' # Weekly on Mondays
|
||||
|
||||
jobs:
|
||||
codeql:
|
||||
name: CodeQL Analysis
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
dependency-review:
|
||||
name: Dependency Review
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request'
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Dependency Review
|
||||
uses: actions/dependency-review-action@v4
|
||||
18
.gitignore
vendored
18
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
# Repo
|
||||
Baileys
|
||||
# compiled output
|
||||
/dist
|
||||
/node_modules
|
||||
@@ -18,17 +20,16 @@ lerna-debug.log*
|
||||
|
||||
# Package
|
||||
/yarn.lock
|
||||
/package-lock.json
|
||||
/pnpm-lock.yaml
|
||||
|
||||
# IDE - VSCode
|
||||
# IDEs
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
# Prisma
|
||||
/prisma/migrations
|
||||
.nova/*
|
||||
.idea/*
|
||||
|
||||
# Project related
|
||||
/instances/*
|
||||
@@ -36,5 +37,12 @@ lerna-debug.log*
|
||||
/test/
|
||||
/src/env.yml
|
||||
/store
|
||||
*.env
|
||||
|
||||
/temp/*
|
||||
|
||||
.DS_Store
|
||||
*.DS_Store
|
||||
.tool-versions
|
||||
|
||||
/prisma/migrations/*
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "evolution-manager-v2"]
|
||||
path = evolution-manager-v2
|
||||
url = https://github.com/EvolutionAPI/evolution-manager-v2.git
|
||||
51
.husky/README.md
Normal file
51
.husky/README.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# Git Hooks Configuration
|
||||
|
||||
Este projeto usa [Husky](https://typicode.github.io/husky/) para automatizar verificações de qualidade de código.
|
||||
|
||||
## Hooks Configurados
|
||||
|
||||
### Pre-commit
|
||||
- **Arquivo**: `.husky/pre-commit`
|
||||
- **Executa**: `npx lint-staged`
|
||||
- **Função**: Executa lint e correções automáticas apenas nos arquivos modificados
|
||||
|
||||
### Pre-push
|
||||
- **Arquivo**: `.husky/pre-push`
|
||||
- **Executa**: `npm run build` + `npm run lint:check`
|
||||
- **Função**: Verifica se o projeto compila e não tem erros de lint antes do push
|
||||
|
||||
## Lint-staged Configuration
|
||||
|
||||
Configurado no `package.json`:
|
||||
|
||||
```json
|
||||
"lint-staged": {
|
||||
"src/**/*.{ts,js}": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
],
|
||||
"src/**/*.ts": [
|
||||
"npm run build"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Como funciona
|
||||
|
||||
1. **Ao fazer commit**: Executa lint apenas nos arquivos modificados
|
||||
2. **Ao fazer push**: Executa build completo e verificação de lint
|
||||
3. **Se houver erros**: O commit/push é bloqueado até correção
|
||||
|
||||
## Comandos úteis
|
||||
|
||||
```bash
|
||||
# Pular hooks (não recomendado)
|
||||
git commit --no-verify
|
||||
git push --no-verify
|
||||
|
||||
# Executar lint manualmente
|
||||
npm run lint
|
||||
|
||||
# Executar build manualmente
|
||||
npm run build
|
||||
```
|
||||
1
.husky/commit-msg
Executable file
1
.husky/commit-msg
Executable file
@@ -0,0 +1 @@
|
||||
npx --no -- commitlint --edit $1
|
||||
1
.husky/pre-commit
Normal file
1
.husky/pre-commit
Normal file
@@ -0,0 +1 @@
|
||||
npx lint-staged
|
||||
2
.husky/pre-push
Executable file
2
.husky/pre-push
Executable file
@@ -0,0 +1,2 @@
|
||||
npm run build
|
||||
npm run lint:check
|
||||
@@ -2,8 +2,11 @@ module.exports = {
|
||||
semi: true,
|
||||
trailingComma: 'all',
|
||||
singleQuote: true,
|
||||
printWidth: 90,
|
||||
printWidth: 120,
|
||||
arrowParens: 'always',
|
||||
tabWidth: 2,
|
||||
bracketSameLine: true,
|
||||
bracketSpacing: true
|
||||
useTabs: false,
|
||||
bracketSameLine: false,
|
||||
bracketSpacing: true,
|
||||
parser: 'typescript'
|
||||
}
|
||||
11
.vscode/settings.json
vendored
11
.vscode/settings.json
vendored
@@ -5,7 +5,12 @@
|
||||
"editor.smoothScrolling": true,
|
||||
"editor.tabSize": 2,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true,
|
||||
"source.fixAll": true
|
||||
}
|
||||
"source.fixAll.eslint": "explicit",
|
||||
"source.fixAll": "explicit"
|
||||
},
|
||||
"prisma-smart-formatter.typescript.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"prisma-smart-formatter.prisma.defaultFormatter": "Prisma.prisma",
|
||||
"i18n-ally.localesPaths": [
|
||||
"store/messages"
|
||||
]
|
||||
}
|
||||
355
AGENTS.md
Normal file
355
AGENTS.md
Normal file
@@ -0,0 +1,355 @@
|
||||
# Evolution API - AI Agent Guidelines
|
||||
|
||||
This document provides comprehensive guidelines for AI agents (Claude, GPT, Cursor, etc.) working with the Evolution API codebase.
|
||||
|
||||
## Project Overview
|
||||
|
||||
**Evolution API** is a production-ready, multi-tenant WhatsApp API platform built with Node.js, TypeScript, and Express.js. It supports multiple WhatsApp providers and extensive integrations with chatbots, CRM systems, and messaging platforms.
|
||||
|
||||
## Project Structure & Module Organization
|
||||
|
||||
### Core Directories
|
||||
- **`src/`** – TypeScript source code with modular architecture
|
||||
- `api/controllers/` – HTTP route handlers (thin layer)
|
||||
- `api/services/` – Business logic (core functionality)
|
||||
- `api/routes/` – Express route definitions (RouterBroker pattern)
|
||||
- `api/integrations/` – External service integrations
|
||||
- `channel/` – WhatsApp providers (Baileys, Business API, Evolution)
|
||||
- `chatbot/` – AI/Bot integrations (OpenAI, Dify, Typebot, Chatwoot)
|
||||
- `event/` – Event systems (WebSocket, RabbitMQ, SQS, NATS, Pusher)
|
||||
- `storage/` – File storage (S3, MinIO)
|
||||
- `dto/` – Data Transfer Objects (simple classes, no decorators)
|
||||
- `guards/` – Authentication/authorization middleware
|
||||
- `types/` – TypeScript type definitions
|
||||
- `repository/` – Data access layer (Prisma)
|
||||
- **`prisma/`** – Database schemas and migrations
|
||||
- `postgresql-schema.prisma` / `mysql-schema.prisma` – Provider-specific schemas
|
||||
- `postgresql-migrations/` / `mysql-migrations/` – Provider-specific migrations
|
||||
- **`config/`** – Environment and application configuration
|
||||
- **`utils/`** – Shared utilities and helper functions
|
||||
- **`validate/`** – JSONSchema7 validation schemas
|
||||
- **`exceptions/`** – Custom HTTP exception classes
|
||||
- **`cache/`** – Redis and local cache implementations
|
||||
|
||||
### Build & Deployment
|
||||
- **`dist/`** – Build output (do not edit directly)
|
||||
- **`public/`** – Static assets and media files
|
||||
- **`Docker*`**, **`docker-compose*.yaml`** – Containerization and local development stack
|
||||
|
||||
## Build, Test, and Development Commands
|
||||
|
||||
### Development Workflow
|
||||
```bash
|
||||
# Development server with hot reload
|
||||
npm run dev:server
|
||||
|
||||
# Direct execution for testing
|
||||
npm start
|
||||
|
||||
# Production build and run
|
||||
npm run build
|
||||
npm run start:prod
|
||||
```
|
||||
|
||||
### Code Quality
|
||||
```bash
|
||||
# Linting and formatting
|
||||
npm run lint # ESLint with auto-fix
|
||||
npm run lint:check # ESLint check only
|
||||
|
||||
# Commit with conventional commits
|
||||
npm run commit # Interactive commit with Commitizen
|
||||
```
|
||||
|
||||
### Database Management
|
||||
```bash
|
||||
# Set database provider first (CRITICAL)
|
||||
export DATABASE_PROVIDER=postgresql # or mysql
|
||||
|
||||
# Generate Prisma client
|
||||
npm run db:generate
|
||||
|
||||
# Development migrations (with provider sync)
|
||||
npm run db:migrate:dev # Unix/Mac
|
||||
npm run db:migrate:dev:win # Windows
|
||||
|
||||
# Production deployment
|
||||
npm run db:deploy # Unix/Mac
|
||||
npm run db:deploy:win # Windows
|
||||
|
||||
# Database tools
|
||||
npm run db:studio # Open Prisma Studio
|
||||
```
|
||||
|
||||
### Docker Development
|
||||
```bash
|
||||
# Start local services (Redis, PostgreSQL, etc.)
|
||||
docker-compose up -d
|
||||
|
||||
# Full development stack
|
||||
docker-compose -f docker-compose.dev.yaml up -d
|
||||
```
|
||||
|
||||
## Coding Standards & Architecture Patterns
|
||||
|
||||
### Code Style (Enforced by ESLint + Prettier)
|
||||
- **TypeScript strict mode** with full type coverage
|
||||
- **2-space indentation**, single quotes, trailing commas
|
||||
- **120-character line limit**
|
||||
- **Import order** via `simple-import-sort`
|
||||
- **File naming**: `feature.kind.ts` (e.g., `whatsapp.baileys.service.ts`)
|
||||
- **Naming conventions**:
|
||||
- Classes: `PascalCase`
|
||||
- Functions/variables: `camelCase`
|
||||
- Constants: `UPPER_SNAKE_CASE`
|
||||
- Files: `kebab-case.type.ts`
|
||||
|
||||
### Architecture Patterns
|
||||
|
||||
#### Service Layer Pattern
|
||||
```typescript
|
||||
export class ExampleService {
|
||||
constructor(private readonly waMonitor: WAMonitoringService) {}
|
||||
|
||||
private readonly logger = new Logger('ExampleService');
|
||||
|
||||
public async create(instance: InstanceDto, data: ExampleDto) {
|
||||
// Business logic here
|
||||
return { example: { ...instance, data } };
|
||||
}
|
||||
|
||||
public async find(instance: InstanceDto): Promise<ExampleDto | null> {
|
||||
try {
|
||||
const result = await this.waMonitor.waInstances[instance.instanceName].findData();
|
||||
return result || null; // Return null on not found (Evolution pattern)
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding data:', error);
|
||||
return null; // Return null on error (Evolution pattern)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Controller Pattern (Thin Layer)
|
||||
```typescript
|
||||
export class ExampleController {
|
||||
constructor(private readonly exampleService: ExampleService) {}
|
||||
|
||||
public async createExample(instance: InstanceDto, data: ExampleDto) {
|
||||
return this.exampleService.create(instance, data);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### RouterBroker Pattern
|
||||
```typescript
|
||||
export class ExampleRouter extends RouterBroker {
|
||||
constructor(...guards: any[]) {
|
||||
super();
|
||||
this.router.post(this.routerPath('create'), ...guards, async (req, res) => {
|
||||
const response = await this.dataValidate<ExampleDto>({
|
||||
request: req,
|
||||
schema: exampleSchema, // JSONSchema7
|
||||
ClassRef: ExampleDto,
|
||||
execute: (instance, data) => controller.createExample(instance, data),
|
||||
});
|
||||
res.status(201).json(response);
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### DTO Pattern (Simple Classes)
|
||||
```typescript
|
||||
// CORRECT - Evolution API pattern (no decorators)
|
||||
export class ExampleDto {
|
||||
name: string;
|
||||
description?: string;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
// INCORRECT - Don't use class-validator decorators
|
||||
export class BadExampleDto {
|
||||
@IsString() // ❌ Evolution API doesn't use decorators
|
||||
name: string;
|
||||
}
|
||||
```
|
||||
|
||||
#### Validation Pattern (JSONSchema7)
|
||||
```typescript
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
export const exampleSchema: JSONSchema7 = {
|
||||
$id: v4(),
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
enabled: { type: 'boolean' },
|
||||
},
|
||||
required: ['name', 'enabled'],
|
||||
};
|
||||
```
|
||||
|
||||
## Multi-Tenant Architecture
|
||||
|
||||
### Instance Isolation
|
||||
- **CRITICAL**: All operations must be scoped by `instanceName` or `instanceId`
|
||||
- **Database queries**: Always include `where: { instanceId: ... }`
|
||||
- **Authentication**: Validate instance ownership before operations
|
||||
- **Data isolation**: Complete separation between tenant instances
|
||||
|
||||
### WhatsApp Instance Management
|
||||
```typescript
|
||||
// Access instance via WAMonitoringService
|
||||
const waInstance = this.waMonitor.waInstances[instance.instanceName];
|
||||
if (!waInstance) {
|
||||
throw new NotFoundException(`Instance ${instance.instanceName} not found`);
|
||||
}
|
||||
```
|
||||
|
||||
## Database Patterns
|
||||
|
||||
### Multi-Provider Support
|
||||
- **PostgreSQL**: Uses `@db.Integer`, `@db.JsonB`, `@default(now())`
|
||||
- **MySQL**: Uses `@db.Int`, `@db.Json`, `@default(now())`
|
||||
- **Environment**: Set `DATABASE_PROVIDER=postgresql` or `mysql`
|
||||
- **Migrations**: Provider-specific folders auto-selected
|
||||
|
||||
### Prisma Repository Pattern
|
||||
```typescript
|
||||
// Always use PrismaRepository for database operations
|
||||
const result = await this.prismaRepository.instance.findUnique({
|
||||
where: { name: instanceName },
|
||||
});
|
||||
```
|
||||
|
||||
## Integration Patterns
|
||||
|
||||
### Channel Integration (WhatsApp Providers)
|
||||
- **Baileys**: WhatsApp Web with QR code authentication
|
||||
- **Business API**: Official Meta WhatsApp Business API
|
||||
- **Evolution API**: Custom WhatsApp integration
|
||||
- **Pattern**: Extend base channel service classes
|
||||
|
||||
### Chatbot Integration
|
||||
- **Base classes**: Extend `BaseChatbotService` and `BaseChatbotController`
|
||||
- **Trigger system**: Support keyword, regex, and advanced triggers
|
||||
- **Session management**: Handle conversation state per user
|
||||
- **Available integrations**: EvolutionBot, OpenAI, Dify, Typebot, Chatwoot, Flowise, N8N, EvoAI
|
||||
|
||||
### Event Integration
|
||||
- **Internal events**: EventEmitter2 for application events
|
||||
- **External events**: WebSocket, RabbitMQ, SQS, NATS, Pusher
|
||||
- **Webhook delivery**: Reliable delivery with retry logic
|
||||
|
||||
## Testing Guidelines
|
||||
|
||||
### Current State
|
||||
- **No formal test suite** currently implemented
|
||||
- **Manual testing** is the primary approach
|
||||
- **Integration testing** in development environment
|
||||
|
||||
### Testing Strategy
|
||||
```typescript
|
||||
// Place tests in test/ directory as *.test.ts
|
||||
// Run: npm test (watches test/all.test.ts)
|
||||
|
||||
describe('ExampleService', () => {
|
||||
it('should create example', async () => {
|
||||
// Mock external dependencies
|
||||
// Test business logic
|
||||
// Assert expected behavior
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Recommended Approach
|
||||
- Focus on **critical business logic** in services
|
||||
- **Mock external dependencies** (WhatsApp APIs, databases)
|
||||
- **Integration tests** for API endpoints
|
||||
- **Manual testing** for WhatsApp connection flows
|
||||
|
||||
## Commit & Pull Request Guidelines
|
||||
|
||||
### Conventional Commits (Enforced by commitlint)
|
||||
```bash
|
||||
# Use interactive commit tool
|
||||
npm run commit
|
||||
|
||||
# Commit format: type(scope): subject (max 100 chars)
|
||||
# Types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, revert, security
|
||||
```
|
||||
|
||||
### Examples
|
||||
- `feat(api): add WhatsApp message status endpoint`
|
||||
- `fix(baileys): resolve connection timeout issue`
|
||||
- `docs(readme): update installation instructions`
|
||||
- `refactor(service): extract common message validation logic`
|
||||
|
||||
### Pull Request Requirements
|
||||
- **Clear description** of changes and motivation
|
||||
- **Linked issues** if applicable
|
||||
- **Migration impact** (specify database provider)
|
||||
- **Local testing steps** with screenshots/logs
|
||||
- **Breaking changes** clearly documented
|
||||
|
||||
## Security & Configuration
|
||||
|
||||
### Environment Setup
|
||||
```bash
|
||||
# Copy example environment file
|
||||
cp .env.example .env
|
||||
|
||||
# NEVER commit secrets to version control
|
||||
# Set DATABASE_PROVIDER before database commands
|
||||
export DATABASE_PROVIDER=postgresql # or mysql
|
||||
```
|
||||
|
||||
### Security Best Practices
|
||||
- **API key authentication** via `apikey` header
|
||||
- **Input validation** with JSONSchema7
|
||||
- **Rate limiting** on all endpoints
|
||||
- **Webhook signature validation**
|
||||
- **Instance-based access control**
|
||||
- **Secure defaults** for all configurations
|
||||
|
||||
### Vulnerability Reporting
|
||||
- See `SECURITY.md` for security vulnerability reporting process
|
||||
- Contact: `contato@evolution-api.com`
|
||||
|
||||
## Communication Standards
|
||||
|
||||
### Language Requirements
|
||||
- **User communication**: Always respond in Portuguese (PT-BR)
|
||||
- **Code/comments**: English for technical documentation
|
||||
- **API responses**: English for consistency
|
||||
- **Error messages**: Portuguese for user-facing errors
|
||||
|
||||
### Documentation Standards
|
||||
- **Inline comments**: Document complex business logic
|
||||
- **API documentation**: Document all public endpoints
|
||||
- **Integration guides**: Document new integration patterns
|
||||
- **Migration guides**: Document database schema changes
|
||||
|
||||
## Performance & Scalability
|
||||
|
||||
### Caching Strategy
|
||||
- **Redis primary**: Distributed caching for production
|
||||
- **Node-cache fallback**: Local caching when Redis unavailable
|
||||
- **TTL strategy**: Appropriate cache expiration per data type
|
||||
- **Cache invalidation**: Proper invalidation on data changes
|
||||
|
||||
### Connection Management
|
||||
- **Database**: Prisma connection pooling
|
||||
- **WhatsApp**: One connection per instance with lifecycle management
|
||||
- **Redis**: Connection pooling and retry logic
|
||||
- **External APIs**: Rate limiting and retry with exponential backoff
|
||||
|
||||
### Monitoring & Observability
|
||||
- **Structured logging**: Pino logger with correlation IDs
|
||||
- **Error tracking**: Comprehensive error scenarios
|
||||
- **Health checks**: Instance status and connection monitoring
|
||||
- **Telemetry**: Usage analytics (non-sensitive data only)
|
||||
|
||||
1170
CHANGELOG.md
1170
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
223
CLAUDE.md
Normal file
223
CLAUDE.md
Normal file
@@ -0,0 +1,223 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides comprehensive guidance to Claude AI when working with the Evolution API codebase.
|
||||
|
||||
## Project Overview
|
||||
|
||||
**Evolution API** is a powerful, production-ready REST API for WhatsApp communication that supports multiple WhatsApp providers:
|
||||
- **Baileys** (WhatsApp Web) - Open-source WhatsApp Web client
|
||||
- **Meta Business API** - Official WhatsApp Business API
|
||||
- **Evolution API** - Custom WhatsApp integration
|
||||
|
||||
Built with **Node.js 20+**, **TypeScript 5+**, and **Express.js**, it provides extensive integrations with chatbots, CRM systems, and messaging platforms in a **multi-tenant architecture**.
|
||||
|
||||
## Common Development Commands
|
||||
|
||||
### Build and Run
|
||||
```bash
|
||||
# Development
|
||||
npm run dev:server # Run in development with hot reload (tsx watch)
|
||||
|
||||
# Production
|
||||
npm run build # TypeScript check + tsup build
|
||||
npm run start:prod # Run production build
|
||||
|
||||
# Direct execution
|
||||
npm start # Run with tsx
|
||||
```
|
||||
|
||||
### Code Quality
|
||||
```bash
|
||||
npm run lint # ESLint with auto-fix
|
||||
npm run lint:check # ESLint check only
|
||||
npm run commit # Interactive commit with commitizen
|
||||
```
|
||||
|
||||
### Database Management
|
||||
```bash
|
||||
# Set database provider first
|
||||
export DATABASE_PROVIDER=postgresql # or mysql
|
||||
|
||||
# Generate Prisma client (automatically uses DATABASE_PROVIDER env)
|
||||
npm run db:generate
|
||||
|
||||
# Deploy migrations (production)
|
||||
npm run db:deploy # Unix/Mac
|
||||
npm run db:deploy:win # Windows
|
||||
|
||||
# Development migrations (with sync to provider folder)
|
||||
npm run db:migrate:dev # Unix/Mac
|
||||
npm run db:migrate:dev:win # Windows
|
||||
|
||||
# Open Prisma Studio
|
||||
npm run db:studio
|
||||
|
||||
# Development migrations
|
||||
npm run db:migrate:dev # Unix/Mac
|
||||
npm run db:migrate:dev:win # Windows
|
||||
```
|
||||
|
||||
### Testing
|
||||
```bash
|
||||
npm test # Run tests with watch mode
|
||||
```
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
### Core Structure
|
||||
- **Multi-tenant SaaS**: Complete instance isolation with per-tenant authentication
|
||||
- **Multi-provider database**: PostgreSQL and MySQL via Prisma ORM with provider-specific schemas and migrations
|
||||
- **WhatsApp integrations**: Baileys, Meta Business API, and Evolution API with unified interface
|
||||
- **Event-driven architecture**: EventEmitter2 for internal events + WebSocket, RabbitMQ, SQS, NATS, Pusher for external events
|
||||
- **Microservices pattern**: Modular integrations for chatbots, storage, and external services
|
||||
|
||||
### Directory Layout
|
||||
```
|
||||
src/
|
||||
├── api/
|
||||
│ ├── controllers/ # HTTP route handlers (thin layer)
|
||||
│ ├── services/ # Business logic (core functionality)
|
||||
│ ├── repository/ # Data access layer (Prisma)
|
||||
│ ├── dto/ # Data Transfer Objects (simple classes)
|
||||
│ ├── guards/ # Authentication/authorization middleware
|
||||
│ ├── integrations/ # External service integrations
|
||||
│ │ ├── channel/ # WhatsApp providers (Baileys, Business API, Evolution)
|
||||
│ │ ├── chatbot/ # AI/Bot integrations (OpenAI, Dify, Typebot, Chatwoot)
|
||||
│ │ ├── event/ # Event systems (WebSocket, RabbitMQ, SQS, NATS, Pusher)
|
||||
│ │ └── storage/ # File storage (S3, MinIO)
|
||||
│ ├── routes/ # Express route definitions (RouterBroker pattern)
|
||||
│ └── types/ # TypeScript type definitions
|
||||
├── config/ # Environment and app configuration
|
||||
├── cache/ # Redis and local cache implementations
|
||||
├── exceptions/ # Custom HTTP exception classes
|
||||
├── utils/ # Shared utilities and helpers
|
||||
└── validate/ # JSONSchema7 validation schemas
|
||||
```
|
||||
|
||||
### Key Integration Points
|
||||
|
||||
**Channel Integrations** (`src/api/integrations/channel/`):
|
||||
- **Baileys**: WhatsApp Web client with QR code authentication
|
||||
- **Business API**: Official Meta WhatsApp Business API
|
||||
- **Evolution API**: Custom WhatsApp integration
|
||||
- Connection lifecycle management per instance with automatic reconnection
|
||||
|
||||
**Chatbot Integrations** (`src/api/integrations/chatbot/`):
|
||||
- **EvolutionBot**: Native chatbot with trigger system
|
||||
- **Chatwoot**: Customer service platform integration
|
||||
- **Typebot**: Visual chatbot flow builder
|
||||
- **OpenAI**: AI capabilities including GPT and Whisper (audio transcription)
|
||||
- **Dify**: AI agent workflow platform
|
||||
- **Flowise**: LangChain visual builder
|
||||
- **N8N**: Workflow automation platform
|
||||
- **EvoAI**: Custom AI integration
|
||||
|
||||
**Event Integrations** (`src/api/integrations/event/`):
|
||||
- **WebSocket**: Real-time Socket.io connections
|
||||
- **RabbitMQ**: Message queue for async processing
|
||||
- **Amazon SQS**: Cloud-based message queuing
|
||||
- **NATS**: High-performance messaging system
|
||||
- **Pusher**: Real-time push notifications
|
||||
|
||||
**Storage Integrations** (`src/api/integrations/storage/`):
|
||||
- **AWS S3**: Cloud object storage
|
||||
- **MinIO**: Self-hosted S3-compatible storage
|
||||
- Media file management and URL generation
|
||||
|
||||
### Database Schema Management
|
||||
- Separate schema files: `postgresql-schema.prisma` and `mysql-schema.prisma`
|
||||
- Environment variable `DATABASE_PROVIDER` determines active database
|
||||
- Migration folders are provider-specific and auto-selected during deployment
|
||||
|
||||
### Authentication & Security
|
||||
- **API key-based authentication** via `apikey` header (global or per-instance)
|
||||
- **Instance-specific tokens** for WhatsApp connection authentication
|
||||
- **Guards system** for route protection and authorization
|
||||
- **Input validation** using JSONSchema7 with RouterBroker `dataValidate`
|
||||
- **Rate limiting** and security middleware
|
||||
- **Webhook signature validation** for external integrations
|
||||
|
||||
## Important Implementation Details
|
||||
|
||||
### WhatsApp Instance Management
|
||||
- Each WhatsApp connection is an "instance" with unique name
|
||||
- Instance data stored in database with connection state
|
||||
- Session persistence in database or file system (configurable)
|
||||
- Automatic reconnection handling with exponential backoff
|
||||
|
||||
### Message Queue Architecture
|
||||
- Supports RabbitMQ, Amazon SQS, and WebSocket for events
|
||||
- Event types: message.received, message.sent, connection.update, etc.
|
||||
- Configurable per instance which events to send
|
||||
|
||||
### Media Handling
|
||||
- Local storage or S3/Minio for media files
|
||||
- Automatic media download from WhatsApp
|
||||
- Media URL generation for external access
|
||||
- Support for audio transcription via OpenAI
|
||||
|
||||
### Multi-tenancy Support
|
||||
- Instance isolation at database level
|
||||
- Separate webhook configurations per instance
|
||||
- Independent integration settings per instance
|
||||
|
||||
## Environment Configuration
|
||||
|
||||
Key environment variables are defined in `.env.example`. The system uses a strongly-typed configuration system via `src/config/env.config.ts`.
|
||||
|
||||
Critical configurations:
|
||||
- `DATABASE_PROVIDER`: postgresql or mysql
|
||||
- `DATABASE_CONNECTION_URI`: Database connection string
|
||||
- `AUTHENTICATION_API_KEY`: Global API authentication
|
||||
- `REDIS_ENABLED`: Enable Redis cache
|
||||
- `RABBITMQ_ENABLED`/`SQS_ENABLED`: Message queue options
|
||||
|
||||
## Development Guidelines
|
||||
|
||||
The project follows comprehensive development standards defined in `.cursor/rules/`:
|
||||
|
||||
### Core Principles
|
||||
- **Always respond in Portuguese (PT-BR)** for user communication
|
||||
- **Follow established architecture patterns** (Service Layer, RouterBroker, etc.)
|
||||
- **Robust error handling** with retry logic and graceful degradation
|
||||
- **Multi-database compatibility** (PostgreSQL and MySQL)
|
||||
- **Security-first approach** with input validation and rate limiting
|
||||
- **Performance optimizations** with Redis caching and connection pooling
|
||||
|
||||
### Code Standards
|
||||
- **TypeScript strict mode** with full type coverage
|
||||
- **JSONSchema7** for input validation (not class-validator)
|
||||
- **Conventional Commits** enforced by commitlint
|
||||
- **ESLint + Prettier** for code formatting
|
||||
- **Service Object pattern** for business logic
|
||||
- **RouterBroker pattern** for route handling with `dataValidate`
|
||||
|
||||
### Architecture Patterns
|
||||
- **Multi-tenant isolation** at database and instance level
|
||||
- **Event-driven communication** with EventEmitter2
|
||||
- **Microservices integration** pattern for external services
|
||||
- **Connection pooling** and lifecycle management
|
||||
- **Caching strategy** with Redis primary and Node-cache fallback
|
||||
|
||||
## Testing Approach
|
||||
|
||||
Currently, the project has minimal formal testing infrastructure:
|
||||
- **Manual testing** is the primary approach
|
||||
- **Integration testing** in development environment
|
||||
- **No unit test suite** currently implemented
|
||||
- Test files can be placed in `test/` directory as `*.test.ts`
|
||||
- Run `npm test` for watch mode development testing
|
||||
|
||||
### Recommended Testing Strategy
|
||||
- Focus on **critical business logic** in services
|
||||
- **Mock external dependencies** (WhatsApp APIs, databases)
|
||||
- **Integration tests** for API endpoints
|
||||
- **Manual testing** for WhatsApp connection flows
|
||||
|
||||
## Deployment Considerations
|
||||
|
||||
- Docker support with `Dockerfile` and `docker-compose.yaml`
|
||||
- Graceful shutdown handling for connections
|
||||
- Health check endpoints for monitoring
|
||||
- Sentry integration for error tracking
|
||||
- Telemetry for usage analytics (non-sensitive data only)
|
||||
@@ -1,100 +0,0 @@
|
||||
SERVER_URL='<url>' # ex.: http://localhost:3333
|
||||
|
||||
CORS_ORIGIN='*' # Or separate by commas - ex.: 'yourdomain1.com, yourdomain2.com'
|
||||
CORS_METHODS='POST,GET,PUT,DELETE'
|
||||
CORS_CREDENTIALS=true
|
||||
|
||||
# Determine the logs to be displayed
|
||||
LOG_LEVEL='ERROR,WARN,DEBUG,INFO,LOG,VERBOSE,DARK,WEBHOOKS'
|
||||
LOG_COLOR=true
|
||||
LOG_BAILEYS=error # "fatal" | "error" | "warn" | "info" | "debug" | "trace"
|
||||
|
||||
# Determine how long the instance should be deleted from memory in case of no connection.
|
||||
# Default time: 5 minutes
|
||||
# If you don't even want an expiration, enter the value false
|
||||
DEL_INSTANCE=false
|
||||
|
||||
# Temporary data storage
|
||||
STORE_MESSAGES=true
|
||||
STORE_MESSAGE_UP=true
|
||||
STORE_CONTACTS=true
|
||||
STORE_CHATS=true
|
||||
|
||||
CLEAN_STORE_CLEANING_INTERVAL=7200 # seconds === 2h
|
||||
CLEAN_STORE_MESSAGES=true
|
||||
CLEAN_STORE_MESSAGE_UP=true
|
||||
CLEAN_STORE_CONTACTS=true
|
||||
CLEAN_STORE_CHATS=true
|
||||
|
||||
# Permanent data storage
|
||||
DATABASE_ENABLED=false
|
||||
DATABASE_CONNECTION_URI=mongodb://root:root@mongodb:27017/?authSource=admin&readPreference=primary&ssl=false&directConnection=true
|
||||
DATABASE_CONNECTION_DB_PREFIX_NAME=evolution
|
||||
|
||||
# Choose the data you want to save in the application's database or store
|
||||
DATABASE_SAVE_DATA_INSTANCE=false
|
||||
DATABASE_SAVE_DATA_NEW_MESSAGE=false
|
||||
DATABASE_SAVE_MESSAGE_UPDATE=false
|
||||
DATABASE_SAVE_DATA_CONTACTS=false
|
||||
DATABASE_SAVE_DATA_CHATS=false
|
||||
|
||||
REDIS_ENABLED=false
|
||||
REDIS_URI=redis://redis:6379
|
||||
REDIS_PREFIX_KEY=evolution
|
||||
|
||||
# Global Webhook Settings
|
||||
# Each instance's Webhook URL and events will be requested at the time it is created
|
||||
## Define a global webhook that will listen for enabled events from all instances
|
||||
WEBHOOK_GLOBAL_URL='<url>'
|
||||
WEBHOOK_GLOBAL_ENABLED=false
|
||||
# With this option activated, you work with a url per webhook event, respecting the global url and the name of each event
|
||||
WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=false
|
||||
## Set the events you want to hear
|
||||
WEBHOOK_EVENTS_APPLICATION_STARTUP=false
|
||||
WEBHOOK_EVENTS_QRCODE_UPDATED=true
|
||||
WEBHOOK_EVENTS_MESSAGES_SET=true
|
||||
WEBHOOK_EVENTS_MESSAGES_UPSERT=true
|
||||
WEBHOOK_EVENTS_MESSAGES_UPDATE=true
|
||||
WEBHOOK_EVENTS_SEND_MESSAGE=true
|
||||
WEBHOOK_EVENTS_CONTACTS_SET=true
|
||||
WEBHOOK_EVENTS_CONTACTS_UPSERT=true
|
||||
WEBHOOK_EVENTS_CONTACTS_UPDATE=true
|
||||
WEBHOOK_EVENTS_PRESENCE_UPDATE=true
|
||||
WEBHOOK_EVENTS_CHATS_SET=true
|
||||
WEBHOOK_EVENTS_CHATS_UPSERT=true
|
||||
WEBHOOK_EVENTS_CHATS_UPDATE=true
|
||||
WEBHOOK_EVENTS_CHATS_DELETE=true
|
||||
WEBHOOK_EVENTS_GROUPS_UPSERT=true
|
||||
WEBHOOK_EVENTS_GROUPS_UPDATE=true
|
||||
WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=true
|
||||
WEBHOOK_EVENTS_CONNECTION_UPDATE=true
|
||||
# This event fires every time a new token is requested via the refresh route
|
||||
WEBHOOK_EVENTS_NEW_JWT_TOKEN=false
|
||||
|
||||
# Name that will be displayed on smartphone connection
|
||||
CONFIG_SESSION_PHONE_CLIENT='Evolution API'
|
||||
CONFIG_SESSION_PHONE_NAME=chrome # chrome | firefox | edge | opera | safari
|
||||
|
||||
# Set qrcode display limit
|
||||
QRCODE_LIMIT=30
|
||||
|
||||
# Defines an authentication type for the api
|
||||
# We recommend using the apikey because it will allow you to use a custom token,
|
||||
# if you use jwt, a random token will be generated and may be expired and you will have to generate a new token
|
||||
AUTHENTICATION_TYPE='apikey' # jwt or 'apikey'
|
||||
## Define a global apikey to access all instances.
|
||||
### OBS: This key must be inserted in the request header to create an instance.
|
||||
AUTHENTICATION_API_KEY='B6D711FCDE4D4FD5936544120E713976'
|
||||
AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true
|
||||
## Set the secret key to encrypt and decrypt your token and its expiration time
|
||||
AUTHENTICATION_JWT_EXPIRIN_IN=0 # seconds - 3600s ===1h | zero (0) - never expires
|
||||
AUTHENTICATION_JWT_SECRET='L0YWtjb2w554WFqPG'
|
||||
# Set the instance name and webhook url to create an instance in init the application
|
||||
# With this option activated, you work with a url per webhook event, respecting the local url and the name of each event
|
||||
AUTHENTICATION_INSTANCE_MODE=server # container or server
|
||||
# if you are using container mode, set the container name and the webhook url to default instance
|
||||
AUTHENTICATION_INSTANCE_NAME=evolution
|
||||
AUTHENTICATION_INSTANCE_WEBHOOK_URL='<url>'
|
||||
AUTHENTICATION_INSTANCE_CHATWOOT_ACCOUNT_ID=1
|
||||
AUTHENTICATION_INSTANCE_CHATWOOT_TOKEN=123456
|
||||
AUTHENTICATION_INSTANCE_CHATWOOT_URL='<url>'
|
||||
51
Docker/kafka/docker-compose.yaml
Normal file
51
Docker/kafka/docker-compose.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
zookeeper:
|
||||
container_name: zookeeper
|
||||
image: confluentinc/cp-zookeeper:7.5.0
|
||||
environment:
|
||||
- ZOOKEEPER_CLIENT_PORT=2181
|
||||
- ZOOKEEPER_TICK_TIME=2000
|
||||
- ZOOKEEPER_SYNC_LIMIT=2
|
||||
volumes:
|
||||
- zookeeper_data:/var/lib/zookeeper/
|
||||
ports:
|
||||
- 2181:2181
|
||||
|
||||
kafka:
|
||||
container_name: kafka
|
||||
image: confluentinc/cp-kafka:7.5.0
|
||||
depends_on:
|
||||
- zookeeper
|
||||
environment:
|
||||
- KAFKA_BROKER_ID=1
|
||||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
|
||||
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,OUTSIDE:PLAINTEXT
|
||||
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092,OUTSIDE://host.docker.internal:9094
|
||||
- KAFKA_INTER_BROKER_LISTENER_NAME=PLAINTEXT
|
||||
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
|
||||
- KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=1
|
||||
- KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=1
|
||||
- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0
|
||||
- KAFKA_AUTO_CREATE_TOPICS_ENABLE=true
|
||||
- KAFKA_LOG_RETENTION_HOURS=168
|
||||
- KAFKA_LOG_SEGMENT_BYTES=1073741824
|
||||
- KAFKA_LOG_RETENTION_CHECK_INTERVAL_MS=300000
|
||||
- KAFKA_COMPRESSION_TYPE=gzip
|
||||
ports:
|
||||
- 29092:29092
|
||||
- 9092:9092
|
||||
- 9094:9094
|
||||
volumes:
|
||||
- kafka_data:/var/lib/kafka/data
|
||||
|
||||
volumes:
|
||||
zookeeper_data:
|
||||
kafka_data:
|
||||
|
||||
|
||||
networks:
|
||||
evolution-net:
|
||||
name: evolution-net
|
||||
driver: bridge
|
||||
31
Docker/minio/docker-compose.yaml
Normal file
31
Docker/minio/docker-compose.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
minio:
|
||||
container_name: minio
|
||||
image: quay.io/minio/minio
|
||||
networks:
|
||||
- evolution-net
|
||||
command: server /data --console-address ":9001"
|
||||
restart: always
|
||||
ports:
|
||||
- 5432:5432
|
||||
environment:
|
||||
- MINIO_ROOT_USER=USER
|
||||
- MINIO_ROOT_PASSWORD=PASSWORD
|
||||
- MINIO_BROWSER_REDIRECT_URL=http:/localhost:9001
|
||||
- MINIO_SERVER_URL=http://localhost:9000
|
||||
volumes:
|
||||
- minio_data:/data
|
||||
expose:
|
||||
- 9000
|
||||
- 9001
|
||||
|
||||
volumes:
|
||||
minio_data:
|
||||
|
||||
|
||||
networks:
|
||||
evolution-net:
|
||||
name: evolution-net
|
||||
driver: bridge
|
||||
@@ -1,43 +0,0 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
mongodb:
|
||||
container_name: mongodb
|
||||
image: mongo
|
||||
restart: always
|
||||
ports:
|
||||
- 27017:27017
|
||||
environment:
|
||||
- MONGO_INITDB_ROOT_USERNAME=root
|
||||
- MONGO_INITDB_ROOT_PASSWORD=root
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
volumes:
|
||||
- evolution_mongodb_data:/data/db
|
||||
- evolution_mongodb_configdb:/data/configdb
|
||||
networks:
|
||||
- evolution-net
|
||||
expose:
|
||||
- 27017
|
||||
|
||||
mongo-express:
|
||||
image: mongo-express
|
||||
environment:
|
||||
ME_CONFIG_BASICAUTH_USERNAME: root
|
||||
ME_CONFIG_BASICAUTH_PASSWORD: root
|
||||
ME_CONFIG_MONGODB_SERVER: mongodb
|
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: root
|
||||
ports:
|
||||
- 8081:8081
|
||||
links:
|
||||
- mongodb
|
||||
|
||||
volumes:
|
||||
evolution_mongodb_data:
|
||||
evolution_mongodb_configdb:
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: evolution-net
|
||||
|
||||
27
Docker/mysql/docker-compose.yaml
Normal file
27
Docker/mysql/docker-compose.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
mysql:
|
||||
container_name: mysql
|
||||
image: percona/percona-server:8.0
|
||||
networks:
|
||||
- evolution-net
|
||||
restart: always
|
||||
ports:
|
||||
- 3306:3306
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
- TZ=America/Bahia
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
expose:
|
||||
- 3306
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
|
||||
|
||||
networks:
|
||||
evolution-net:
|
||||
name: evolution-net
|
||||
driver: bridge
|
||||
42
Docker/postgres/docker-compose.yaml
Normal file
42
Docker/postgres/docker-compose.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
container_name: postgres
|
||||
image: postgres:15
|
||||
networks:
|
||||
- evolution-net
|
||||
command: ["postgres", "-c", "max_connections=1000"]
|
||||
restart: always
|
||||
ports:
|
||||
- 5432:5432
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=PASSWORD
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
expose:
|
||||
- 5432
|
||||
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4:latest
|
||||
networks:
|
||||
- evolution-net
|
||||
environment:
|
||||
- PGADMIN_DEFAULT_EMAIL=EMAIL
|
||||
- PGADMIN_DEFAULT_PASSWORD=PASSWORD
|
||||
volumes:
|
||||
- pgadmin_data:/var/lib/pgadmin
|
||||
ports:
|
||||
- 4000:80
|
||||
links:
|
||||
- postgres
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
pgadmin_data:
|
||||
|
||||
|
||||
networks:
|
||||
evolution-net:
|
||||
name: evolution-net
|
||||
driver: bridge
|
||||
25
Docker/rabbitmq/docker-compose.yaml
Normal file
25
Docker/rabbitmq/docker-compose.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
rabbitmq:
|
||||
container_name: rabbitmq
|
||||
image: rabbitmq:management
|
||||
environment:
|
||||
- RABBITMQ_ERLANG_COOKIE=33H2CdkzF5WrnJ4ud6nkUdRTKXvbCHeFjvVL71p
|
||||
- RABBITMQ_DEFAULT_VHOST=default
|
||||
- RABBITMQ_DEFAULT_USER=USER
|
||||
- RABBITMQ_DEFAULT_PASS=PASSWORD
|
||||
volumes:
|
||||
- rabbitmq_data:/var/lib/rabbitmq/
|
||||
ports:
|
||||
- 5672:5672
|
||||
- 15672:15672
|
||||
|
||||
volumes:
|
||||
rabbitmq_data:
|
||||
|
||||
|
||||
networks:
|
||||
evolution-net:
|
||||
name: evolution-net
|
||||
driver: bridge
|
||||
@@ -3,26 +3,21 @@ version: '3.3'
|
||||
services:
|
||||
redis:
|
||||
image: redis:latest
|
||||
networks:
|
||||
- evolution-net
|
||||
container_name: redis
|
||||
command: >
|
||||
redis-server
|
||||
--port 6379
|
||||
--appendonly yes
|
||||
redis-server --port 6379 --appendonly yes
|
||||
volumes:
|
||||
- evolution_redis:/data
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
rebrow:
|
||||
image: marian/rebrow
|
||||
ports:
|
||||
- 5001:5001
|
||||
links:
|
||||
- redis
|
||||
|
||||
|
||||
volumes:
|
||||
evolution_redis:
|
||||
|
||||
|
||||
networks:
|
||||
default:
|
||||
evolution-net:
|
||||
name: evolution-net
|
||||
driver: bridge
|
||||
|
||||
32
Docker/scripts/deploy_database.sh
Executable file
32
Docker/scripts/deploy_database.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./Docker/scripts/env_functions.sh
|
||||
|
||||
if [ "$DOCKER_ENV" != "true" ]; then
|
||||
export_env_vars
|
||||
fi
|
||||
|
||||
if [[ "$DATABASE_PROVIDER" == "postgresql" || "$DATABASE_PROVIDER" == "mysql" || "$DATABASE_PROVIDER" == "psql_bouncer" ]]; then
|
||||
export DATABASE_URL
|
||||
echo "Deploying migrations for $DATABASE_PROVIDER"
|
||||
echo "Database URL: $DATABASE_URL"
|
||||
# rm -rf ./prisma/migrations
|
||||
# cp -r ./prisma/$DATABASE_PROVIDER-migrations ./prisma/migrations
|
||||
npm run db:deploy
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Migration failed"
|
||||
exit 1
|
||||
else
|
||||
echo "Migration succeeded"
|
||||
fi
|
||||
npm run db:generate
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Prisma generate failed"
|
||||
exit 1
|
||||
else
|
||||
echo "Prisma generate succeeded"
|
||||
fi
|
||||
else
|
||||
echo "Error: Database provider $DATABASE_PROVIDER invalid."
|
||||
exit 1
|
||||
fi
|
||||
18
Docker/scripts/env_functions.sh
Executable file
18
Docker/scripts/env_functions.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
export_env_vars() {
|
||||
if [ -f .env ]; then
|
||||
while IFS='=' read -r key value; do
|
||||
if [[ -z "$key" || "$key" =~ ^\s*# || -z "$value" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
key=$(echo "$key" | tr -d '[:space:]')
|
||||
value=$(echo "$value" | tr -d '[:space:]')
|
||||
value=$(echo "$value" | tr -d "'" | tr -d "\"")
|
||||
|
||||
export "$key=$value"
|
||||
done < .env
|
||||
else
|
||||
echo ".env file not found"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
23
Docker/scripts/generate_database.sh
Normal file
23
Docker/scripts/generate_database.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./Docker/scripts/env_functions.sh
|
||||
|
||||
if [ "$DOCKER_ENV" != "true" ]; then
|
||||
export_env_vars
|
||||
fi
|
||||
|
||||
if [[ "$DATABASE_PROVIDER" == "postgresql" || "$DATABASE_PROVIDER" == "mysql" || "$DATABASE_PROVIDER" == "psql_bouncer" ]]; then
|
||||
export DATABASE_URL
|
||||
echo "Generating database for $DATABASE_PROVIDER"
|
||||
echo "Database URL: $DATABASE_URL"
|
||||
npm run db:generate
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Prisma generate failed"
|
||||
exit 1
|
||||
else
|
||||
echo "Prisma generate succeeded"
|
||||
fi
|
||||
else
|
||||
echo "Error: Database provider $DATABASE_PROVIDER invalid."
|
||||
exit 1
|
||||
fi
|
||||
146
Docker/swarm/evolution_api_v2.yaml
Normal file
146
Docker/swarm/evolution_api_v2.yaml
Normal file
@@ -0,0 +1,146 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
evolution_v2:
|
||||
image: evoapicloud/evolution-api:v2.3.7
|
||||
volumes:
|
||||
- evolution_instances:/evolution/instances
|
||||
networks:
|
||||
- network_public
|
||||
environment:
|
||||
- SERVER_URL=https://evo2.site.com
|
||||
- DEL_INSTANCE=false
|
||||
- DATABASE_PROVIDER=postgresql
|
||||
- DATABASE_CONNECTION_URI=postgresql://postgres:SENHA@postgres:5432/evolution
|
||||
- DATABASE_SAVE_DATA_INSTANCE=true
|
||||
- DATABASE_SAVE_DATA_NEW_MESSAGE=true
|
||||
- DATABASE_SAVE_MESSAGE_UPDATE=true
|
||||
- DATABASE_SAVE_DATA_CONTACTS=true
|
||||
- DATABASE_SAVE_DATA_CHATS=true
|
||||
- DATABASE_SAVE_DATA_LABELS=true
|
||||
- DATABASE_SAVE_DATA_HISTORIC=true
|
||||
- DATABASE_CONNECTION_CLIENT_NAME=evolution_v2
|
||||
- RABBITMQ_ENABLED=false
|
||||
- RABBITMQ_URI=amqp://admin:admin@rabbitmq:5672/default
|
||||
- RABBITMQ_EXCHANGE_NAME=evolution_v2
|
||||
- RABBITMQ_GLOBAL_ENABLED=false
|
||||
- RABBITMQ_EVENTS_APPLICATION_STARTUP=false
|
||||
- RABBITMQ_EVENTS_INSTANCE_CREATE=false
|
||||
- RABBITMQ_EVENTS_INSTANCE_DELETE=false
|
||||
- RABBITMQ_EVENTS_QRCODE_UPDATED=false
|
||||
- RABBITMQ_EVENTS_MESSAGES_SET=false
|
||||
- RABBITMQ_EVENTS_MESSAGES_UPSERT=true
|
||||
- RABBITMQ_EVENTS_MESSAGES_EDITED=false
|
||||
- RABBITMQ_EVENTS_MESSAGES_UPDATE=false
|
||||
- RABBITMQ_EVENTS_MESSAGES_DELETE=false
|
||||
- RABBITMQ_EVENTS_SEND_MESSAGE=false
|
||||
- RABBITMQ_EVENTS_SEND_MESSAGE_UPDATE=false
|
||||
- RABBITMQ_EVENTS_CONTACTS_SET=false
|
||||
- RABBITMQ_EVENTS_CONTACTS_UPSERT=false
|
||||
- RABBITMQ_EVENTS_CONTACTS_UPDATE=false
|
||||
- RABBITMQ_EVENTS_PRESENCE_UPDATE=false
|
||||
- RABBITMQ_EVENTS_CHATS_SET=false
|
||||
- RABBITMQ_EVENTS_CHATS_UPSERT=false
|
||||
- RABBITMQ_EVENTS_CHATS_UPDATE=false
|
||||
- RABBITMQ_EVENTS_CHATS_DELETE=false
|
||||
- RABBITMQ_EVENTS_GROUPS_UPSERT=false
|
||||
- RABBITMQ_EVENTS_GROUP_UPDATE=false
|
||||
- RABBITMQ_EVENTS_GROUP_PARTICIPANTS_UPDATE=false
|
||||
- RABBITMQ_EVENTS_CONNECTION_UPDATE=true
|
||||
- RABBITMQ_EVENTS_CALL=false
|
||||
- RABBITMQ_EVENTS_TYPEBOT_START=false
|
||||
- RABBITMQ_EVENTS_TYPEBOT_CHANGE_STATUS=false
|
||||
- SQS_ENABLED=false
|
||||
- SQS_ACCESS_KEY_ID=
|
||||
- SQS_SECRET_ACCESS_KEY=
|
||||
- SQS_ACCOUNT_ID=
|
||||
- SQS_REGION=
|
||||
- WEBSOCKET_ENABLED=false
|
||||
- WEBSOCKET_GLOBAL_EVENTS=false
|
||||
- WA_BUSINESS_TOKEN_WEBHOOK=evolution
|
||||
- WA_BUSINESS_URL=https://graph.facebook.com
|
||||
- WA_BUSINESS_VERSION=v20.0
|
||||
- WA_BUSINESS_LANGUAGE=pt_BR
|
||||
- WEBHOOK_GLOBAL_URL=''
|
||||
- WEBHOOK_GLOBAL_ENABLED=false
|
||||
- WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=false
|
||||
- WEBHOOK_EVENTS_APPLICATION_STARTUP=false
|
||||
- WEBHOOK_EVENTS_QRCODE_UPDATED=true
|
||||
- WEBHOOK_EVENTS_MESSAGES_SET=true
|
||||
- WEBHOOK_EVENTS_MESSAGES_UPSERT=true
|
||||
- WEBHOOK_EVENTS_MESSAGES_EDITED=true
|
||||
- WEBHOOK_EVENTS_MESSAGES_UPDATE=true
|
||||
- WEBHOOK_EVENTS_MESSAGES_DELETE=true
|
||||
- WEBHOOK_EVENTS_SEND_MESSAGE=true
|
||||
- WEBHOOK_EVENTS_SEND_MESSAGE_UPDATE=true
|
||||
- WEBHOOK_EVENTS_CONTACTS_SET=true
|
||||
- WEBHOOK_EVENTS_CONTACTS_UPSERT=true
|
||||
- WEBHOOK_EVENTS_CONTACTS_UPDATE=true
|
||||
- WEBHOOK_EVENTS_PRESENCE_UPDATE=true
|
||||
- WEBHOOK_EVENTS_CHATS_SET=true
|
||||
- WEBHOOK_EVENTS_CHATS_UPSERT=true
|
||||
- WEBHOOK_EVENTS_CHATS_UPDATE=true
|
||||
- WEBHOOK_EVENTS_CHATS_DELETE=true
|
||||
- WEBHOOK_EVENTS_GROUPS_UPSERT=true
|
||||
- WEBHOOK_EVENTS_GROUPS_UPDATE=true
|
||||
- WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=true
|
||||
- WEBHOOK_EVENTS_CONNECTION_UPDATE=true
|
||||
- WEBHOOK_EVENTS_LABELS_EDIT=true
|
||||
- WEBHOOK_EVENTS_LABELS_ASSOCIATION=true
|
||||
- WEBHOOK_EVENTS_CALL=true
|
||||
- WEBHOOK_EVENTS_TYPEBOT_START=false
|
||||
- WEBHOOK_EVENTS_TYPEBOT_CHANGE_STATUS=false
|
||||
- WEBHOOK_EVENTS_ERRORS=false
|
||||
- WEBHOOK_EVENTS_ERRORS_WEBHOOK=
|
||||
- CONFIG_SESSION_PHONE_CLIENT=Evolution API V2
|
||||
- CONFIG_SESSION_PHONE_NAME=Chrome
|
||||
- QRCODE_LIMIT=30
|
||||
- OPENAI_ENABLED=true
|
||||
- DIFY_ENABLED=true
|
||||
- TYPEBOT_ENABLED=true
|
||||
- TYPEBOT_API_VERSION=latest
|
||||
- CHATWOOT_ENABLED=true
|
||||
- CHATWOOT_MESSAGE_READ=true
|
||||
- CHATWOOT_MESSAGE_DELETE=true
|
||||
- CHATWOOT_IMPORT_DATABASE_CONNECTION_URI=postgresql://postgres:PASSWORD@postgres:5432/chatwoot?sslmode=disable
|
||||
- CHATWOOT_IMPORT_PLACEHOLDER_MEDIA_MESSAGE=true
|
||||
- CACHE_REDIS_ENABLED=true
|
||||
- CACHE_REDIS_URI=redis://evo_redis:6379/1
|
||||
- CACHE_REDIS_PREFIX_KEY=evolution_v2
|
||||
- CACHE_REDIS_SAVE_INSTANCES=false
|
||||
- CACHE_LOCAL_ENABLED=false
|
||||
- S3_ENABLED=true
|
||||
- S3_ACCESS_KEY=
|
||||
- S3_SECRET_KEY=
|
||||
- S3_BUCKET=evolution
|
||||
- S3_PORT=443
|
||||
- S3_ENDPOINT=files.site.com
|
||||
- S3_USE_SSL=true
|
||||
- AUTHENTICATION_API_KEY=429683C4C977415CAAFCCE10F7D57E11
|
||||
- AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=true
|
||||
- LANGUAGE=en
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: 1
|
||||
placement:
|
||||
constraints:
|
||||
- node.hostname == evolution-manager
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.evolution_v2.rule=Host(`evo2.site.com`)
|
||||
- traefik.http.routers.evolution_v2.entrypoints=websecure
|
||||
- traefik.http.routers.evolution_v2.tls.certresolver=letsencryptresolver
|
||||
- traefik.http.routers.evolution_v2.priority=1
|
||||
- traefik.http.routers.evolution_v2.service=evolution_v2
|
||||
- traefik.http.services.evolution_v2.loadbalancer.server.port=8080
|
||||
- traefik.http.services.evolution_v2.loadbalancer.passHostHeader=true
|
||||
|
||||
volumes:
|
||||
evolution_instances:
|
||||
external: true
|
||||
name: evolution_v2_data
|
||||
|
||||
networks:
|
||||
network_public:
|
||||
external: true
|
||||
name: network_public
|
||||
137
Dockerfile
137
Dockerfile
@@ -1,103 +1,60 @@
|
||||
FROM node:16.18-alpine
|
||||
FROM node:24-alpine AS builder
|
||||
|
||||
LABEL version="1.1.3" description="Api to control whatsapp features through http requests."
|
||||
RUN apk update && \
|
||||
apk add --no-cache git ffmpeg wget curl bash openssl
|
||||
|
||||
LABEL version="2.3.1" description="Api to control whatsapp features through http requests."
|
||||
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
|
||||
LABEL contact="contato@agenciadgcode.com"
|
||||
|
||||
RUN apk update && apk upgrade && \
|
||||
apk add --no-cache git
|
||||
LABEL contact="contato@evolution-api.com"
|
||||
|
||||
WORKDIR /evolution
|
||||
|
||||
COPY ./package.json .
|
||||
COPY ./package*.json ./
|
||||
COPY ./tsconfig.json ./
|
||||
COPY ./tsup.config.ts ./
|
||||
|
||||
ENV DOCKER_ENV=true
|
||||
RUN npm ci --silent
|
||||
|
||||
ENV SERVER_TYPE="http"
|
||||
ENV SERVER_PORT=8080
|
||||
ENV SERVER_URL=$SERVER_URL
|
||||
COPY ./src ./src
|
||||
COPY ./public ./public
|
||||
COPY ./prisma ./prisma
|
||||
COPY ./manager ./manager
|
||||
COPY ./.env.example ./.env
|
||||
COPY ./runWithProvider.js ./
|
||||
|
||||
ENV CORS_ORIGIN="*"
|
||||
ENV CORS_METHODS="POST,GET,PUT,DELETE"
|
||||
ENV CORS_CREDENTIALS=true
|
||||
COPY ./Docker ./Docker
|
||||
|
||||
ENV LOG_LEVEL=$LOG_LEVEL
|
||||
ENV LOG_COLOR=$LOG_COLOR
|
||||
RUN chmod +x ./Docker/scripts/* && dos2unix ./Docker/scripts/*
|
||||
|
||||
ENV DEL_INSTANCE=$DEL_INSTANCE
|
||||
|
||||
ENV STORE_MESSAGES=$STORE_MESSAGE
|
||||
ENV STORE_MESSAGE_UP=$STORE_MESSAGE_UP
|
||||
ENV STORE_CONTACTS=$STORE_CONTACTS
|
||||
ENV STORE_CHATS=$STORE_CHATS
|
||||
|
||||
ENV CLEAN_STORE_CLEANING_INTERVAL=$CLEAN_STORE_CLEANING_INTERVAL
|
||||
ENV CLEAN_STORE_MESSAGES=$CLEAN_STORE_MESSAGE
|
||||
ENV CLEAN_STORE_MESSAGE_UP=$CLEAN_STORE_MESSAGE_UP
|
||||
ENV CLEAN_STORE_CONTACTS=$CLEAN_STORE_CONTACTS
|
||||
ENV CLEAN_STORE_CHATS=$CLEAN_STORE_CHATS
|
||||
|
||||
ENV DATABASE_ENABLED=$DATABASE_ENABLED
|
||||
ENV DATABASE_CONNECTION_URI=$DATABASE_CONNECTION_URI
|
||||
ENV DATABASE_CONNECTION_DB_PREFIX_NAME=$DATABASE_CONNECTION_DB_PREFIX_NAME
|
||||
ENV DATABASE_SAVE_DATA_INSTANCE=$DATABASE_SAVE_DATA_INSTANCE
|
||||
ENV DATABASE_SAVE_DATA_NEW_MESSAGE=$DATABASE_SAVE_DATA_NEW_MESSAGE
|
||||
ENV DATABASE_SAVE_MESSAGE_UPDATE=$DATABASE_SAVE_MESSAGE_UPDATE
|
||||
ENV DATABASE_SAVE_DATA_CONTACTS=$DATABASE_SAVE_DATA_CONTACTS
|
||||
ENV DATABASE_SAVE_DATA_CHATS=$DATABASE_SAVE_DATA_CHATS
|
||||
|
||||
ENV REDIS_ENABLED=$REDIS_ENABLED
|
||||
ENV REDIS_URI=$REDIS_URI
|
||||
ENV REDIS_PREFIX_KEY=$REDIS_PREFIX_KEY
|
||||
|
||||
ENV WEBHOOK_GLOBAL_URL=$WEBHOOK_GLOBAL_URL
|
||||
ENV WEBHOOK_GLOBAL_ENABLED=$WEBHOOK_GLOBAL_ENABLED
|
||||
ENV WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=$WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS
|
||||
|
||||
ENV WEBHOOK_EVENTS_APPLICATION_STARTUP=$WEBHOOK_EVENTS_APPLICATION_STARTUP
|
||||
ENV WEBHOOK_EVENTS_QRCODE_UPDATED=$WEBHOOK_EVENTS_QRCODE_UPDATED
|
||||
ENV WEBHOOK_EVENTS_MESSAGES_SET=$WEBHOOK_EVENTS_MESSAGES_SET
|
||||
ENV WEBHOOK_EVENTS_MESSAGES_UPSERT=$WEBHOOK_EVENTS_MESSAGES_UPSERT
|
||||
ENV WEBHOOK_EVENTS_MESSAGES_UPDATE=$WEBHOOK_EVENTS_MESSAGES_UPDATE
|
||||
ENV WEBHOOK_EVENTS_SEND_MESSAGE=$WEBHOOK_EVENTS_SEND_MESSAGE
|
||||
ENV WEBHOOK_EVENTS_CONTACTS_SET=$WEBHOOK_EVENTS_CONTACTS_SET
|
||||
ENV WEBHOOK_EVENTS_CONTACTS_UPSERT=$WEBHOOK_EVENTS_CONTACTS_UPSERT
|
||||
ENV WEBHOOK_EVENTS_CONTACTS_UPDATE=$WEBHOOK_EVENTS_CONTACTS_UPDATE
|
||||
ENV WEBHOOK_EVENTS_PRESENCE_UPDATE=$WEBHOOK_EVENTS_PRESENCE_UPDATE
|
||||
ENV WEBHOOK_EVENTS_CHATS_SET=$WEBHOOK_EVENTS_CHATS_SET
|
||||
ENV WEBHOOK_EVENTS_CHATS_UPSERT=$WEBHOOK_EVENTS_CHATS_UPSERT
|
||||
ENV WEBHOOK_EVENTS_CHATS_UPDATE=$WEBHOOK_EVENTS_CHATS_UPDATE
|
||||
ENV WEBHOOK_EVENTS_CONNECTION_UPDATE=$WEBHOOK_EVENTS_CONNECTION_UPDATE
|
||||
ENV WEBHOOK_EVENTS_GROUPS_UPSERT=$WEBHOOK_EVENTS_GROUPS_UPSERT
|
||||
ENV WEBHOOK_EVENTS_GROUPS_UPDATE=$WEBHOOK_EVENTS_GROUPS_UPDATE
|
||||
ENV WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=$WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE
|
||||
|
||||
ENV WEBHOOK_EVENTS_NEW_JWT_TOKEN=$WEBHOOK_EVENTS_NEW_JWT_TOKEN
|
||||
|
||||
ENV CONFIG_SESSION_PHONE_CLIENT=$CONFIG_SESSION_PHONE_CLIENT
|
||||
ENV CONFIG_SESSION_PHONE_NAME=$CONFIG_SESSION_PHONE_NAME
|
||||
|
||||
ENV QRCODE_LIMIT=$QRCODE_LIMIT
|
||||
|
||||
ENV AUTHENTICATION_TYPE=$AUTHENTICATION_TYPE
|
||||
|
||||
ENV AUTHENTICATION_API_KEY=$AUTHENTICATION_API_KEY
|
||||
ENV AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=$AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES
|
||||
|
||||
ENV AUTHENTICATION_JWT_EXPIRIN_IN=$AUTHENTICATION_JWT_EXPIRIN_IN
|
||||
ENV AUTHENTICATION_JWT_SECRET="L=0YWt]b2w[WF>#>:&E`"
|
||||
|
||||
ENV AUTHENTICATION_INSTANCE_NAME=$AUTHENTICATION_INSTANCE_NAME
|
||||
ENV AUTHENTICATION_INSTANCE_WEBHOOK_URL=$AUTHENTICATION_INSTANCE_WEBHOOK_URL
|
||||
ENV AUTHENTICATION_INSTANCE_CHATWOOT_ACCOUNT_ID=$AUTHENTICATION_INSTANCE_CHATWOOT_ACCOUNT_ID
|
||||
ENV AUTHENTICATION_INSTANCE_CHATWOOT_TOKEN=$AUTHENTICATION_INSTANCE_CHATWOOT_TOKEN
|
||||
ENV AUTHENTICATION_INSTANCE_CHATWOOT_URL=$AUTHENTICATION_INSTANCE_CHATWOOT_URL
|
||||
ENV AUTHENTICATION_INSTANCE_MODE=$AUTHENTICATION_INSTANCE_MODE
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
RUN ./Docker/scripts/generate_database.sh
|
||||
|
||||
RUN npm run build
|
||||
|
||||
CMD [ "node", "./dist/src/main.js" ]
|
||||
FROM node:24-alpine AS final
|
||||
|
||||
RUN apk update && \
|
||||
apk add tzdata ffmpeg bash openssl
|
||||
|
||||
ENV TZ=America/Sao_Paulo
|
||||
ENV DOCKER_ENV=true
|
||||
|
||||
WORKDIR /evolution
|
||||
|
||||
COPY --from=builder /evolution/package.json ./package.json
|
||||
COPY --from=builder /evolution/package-lock.json ./package-lock.json
|
||||
|
||||
COPY --from=builder /evolution/node_modules ./node_modules
|
||||
COPY --from=builder /evolution/dist ./dist
|
||||
COPY --from=builder /evolution/prisma ./prisma
|
||||
COPY --from=builder /evolution/manager ./manager
|
||||
COPY --from=builder /evolution/public ./public
|
||||
COPY --from=builder /evolution/.env ./.env
|
||||
COPY --from=builder /evolution/Docker ./Docker
|
||||
COPY --from=builder /evolution/runWithProvider.js ./runWithProvider.js
|
||||
COPY --from=builder /evolution/tsup.config.ts ./tsup.config.ts
|
||||
|
||||
ENV DOCKER_ENV=true
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "-c", ". ./Docker/scripts/deploy_database.sh && npm run start:prod" ]
|
||||
|
||||
19
Dockerfile.metrics
Normal file
19
Dockerfile.metrics
Normal file
@@ -0,0 +1,19 @@
|
||||
FROM evoapicloud/evolution-api:latest AS base
|
||||
WORKDIR /evolution
|
||||
|
||||
# Copiamos apenas o necessário para recompilar o dist com as mudanças locais
|
||||
COPY tsconfig.json tsup.config.ts package.json ./
|
||||
COPY src ./src
|
||||
|
||||
# Recompila usando os node_modules já presentes na imagem base
|
||||
RUN npm run build
|
||||
|
||||
# Runtime final: reaproveita a imagem oficial e apenas sobrepõe o dist
|
||||
FROM evoapicloud/evolution-api:latest AS final
|
||||
WORKDIR /evolution
|
||||
COPY --from=base /evolution/dist ./dist
|
||||
|
||||
ENV PROMETHEUS_METRICS=true
|
||||
|
||||
# Entrada original da imagem oficial já sobe o app em /evolution
|
||||
|
||||
241
Extras/chatwoot/configurar_admin.json
Normal file
241
Extras/chatwoot/configurar_admin.json
Normal file
@@ -0,0 +1,241 @@
|
||||
{
|
||||
"name": "[Evolution] Configurar Admin",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "CHATWOOT_ADMIN_USER_TOKEN"
|
||||
},
|
||||
{
|
||||
"name": "chatwoot_url",
|
||||
"value": "https://CHATWOOT_URL"
|
||||
},
|
||||
{
|
||||
"name": "n8n_url",
|
||||
"value": "https://N8N_URL"
|
||||
},
|
||||
{
|
||||
"name": "organization",
|
||||
"value": "ORGANIZATION_NAME"
|
||||
},
|
||||
{
|
||||
"name": "logo",
|
||||
"value": "ORGANIZATION_LOGO"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "7a89a538-2cae-4032-8896-09627c07bc68",
|
||||
"name": "Info Base",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
620,
|
||||
480
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/api/v1/accounts/1/contacts/",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json[\"api_access_token\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"inbox_id\": {{ $('Cria Inbox Start').item.json[\"id\"] }},\n \"name\": \"Bot {{ $('Info Base').item.json[\"organization\"] }}\",\n \"phone_number\": \"+123456\",\n \"avatar_url\": \"{{ $('Info Base').item.json[\"logo\"] }}\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "12a39df3-6b95-4f83-a0bc-50b25adaca7f",
|
||||
"name": "Cria Contato Bot",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
1020,
|
||||
480
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/api/v1/accounts/1/inboxes/",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json[\"api_access_token\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"name\": \"Start {{ $('Info Base').item.json[\"organization\"] }}\",\n \"channel\": {\n \"type\": \"api\",\n \"website_url\": \"\"\n }\n}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "bed7c54d-e232-4fe4-9584-0515e9679868",
|
||||
"name": "Cria Inbox Start",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
820,
|
||||
480
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "36ada769-a757-4193-989b-0cc4ea504b80",
|
||||
"name": "When clicking \"Execute Workflow\"",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
420,
|
||||
480
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/api/v1/accounts/1/automation_rules/",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json[\"api_access_token\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"name\": \"Create Company Chatwoot\",\n \"description\": \"Create Company Chatwoot\",\n \"event_name\": \"message_created\",\n \"active\": true,\n \"actions\": \n [\n {\n \"action_name\": \"send_webhook_event\",\n \"action_params\": [\"{{ $('Info Base').item.json[\"n8n_url\"] }}/webhook/criadorchatwoot\"]\n }\n ],\n \"conditions\": \n [\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"Tema Criador de Empresa:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\"+123456\"]\n }\n ]\n}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "f5bbb285-71a8-4c58-a4d7-e56002d697f0",
|
||||
"name": "Cria Automação Empresas",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
1220,
|
||||
480
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/api/v1/accounts/1/automation_rules/",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json[\"api_access_token\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"name\": \"Create Inbox {{ $('Info Base').item.json[\"organization\"] }}\",\n \"description\": \"Create Inbox {{ $('Info Base').item.json[\"organization\"] }}\",\n \"event_name\": \"message_created\",\n \"active\": true,\n \"actions\": \n [\n {\n \"action_name\": \"send_webhook_event\",\n \"action_params\": [\"{{ $('Info Base').item.json[\"n8n_url\"] }}/webhook/inbox_whatsapp?utoken={{ $('Info Base').item.json[\"api_access_token\"] }}&organization={{ $('Info Base').item.json[\"organization\"] }}\"]\n }\n ],\n \"conditions\": \n [\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"start:\"]\n },\n \n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"query_operator\": \"or\",\n \"values\": [\"+123456\"]\n },\n\n\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"new_instance:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\"+123456\"]\n }\n ]\n}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "a36bebdc-a318-40a2-8532-c7f476f8adb7",
|
||||
"name": "Cria Automação Inboxes",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
1420,
|
||||
480
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"content": "## Workflow Para Configurar admin\n**Aqui você prepara o Chatwoot Principal com um usuário (Superadmin) que poderá criar empresas e caixas de entrada**\n**Instruções**\n**No node Info Base, configure as variáveis de seu Chatwoot e N8N**\n**Obs: A variável api_access_token é o token do usuário que irá poder criar as empresas**",
|
||||
"width": 894.6435495898575
|
||||
},
|
||||
"id": "db66e867-e9f4-452d-b521-725eeac652c8",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
420,
|
||||
280
|
||||
]
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Info Base": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Inbox Start",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cria Contato Bot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Automação Empresas",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cria Inbox Start": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Contato Bot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"When clicking \"Execute Workflow\"": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Info Base",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cria Automação Empresas": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Automação Inboxes",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {},
|
||||
"versionId": "78f155dc-7809-4bfc-9282-63f49b07fc4d",
|
||||
"id": "BSATyGpGWLR4ZwNm",
|
||||
"meta": {
|
||||
"instanceId": "4ff16e963c7f5197d7e99e6239192860914312fea0ce2a9a7fd14d74a0a0e906"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
456
Extras/chatwoot/criador_de_empresas.json
Normal file
456
Extras/chatwoot/criador_de_empresas.json
Normal file
@@ -0,0 +1,456 @@
|
||||
{
|
||||
"name": "[Evolution] Criador de Empresas",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "criadorchatwoot",
|
||||
"options": {}
|
||||
},
|
||||
"id": "5a47c10a-e43c-4fa5-baad-4b6cc511bfcd",
|
||||
"name": "Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1420,
|
||||
860
|
||||
],
|
||||
"webhookId": "6fe428e3-1752-453c-9358-abf18b793387"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/platform/api/v1/accounts",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json[\"api_access_token\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "name",
|
||||
"value": "={{ $json.name_company }}"
|
||||
},
|
||||
{
|
||||
"name": "locale",
|
||||
"value": "pt_BR"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "8295c119-3a96-424e-9386-43d75f6816f5",
|
||||
"name": "Cria Conta",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
2020,
|
||||
860
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/platform/api/v1/users",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json[\"api_access_token\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "name",
|
||||
"value": "={{ $('Info Base').item.json.name_admin }}"
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"value": "={{ $('Info Base').item.json[\"email\"] }}"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"value": "={{ $('Info Base').item.json[\"password\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "4fe5007a-3a6b-490a-a446-e45cc168189f",
|
||||
"name": "Cria Usuario",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
2220,
|
||||
860
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/platform/api/v1/accounts/{{ $node[\"Cria Conta\"].json[\"id\"] }}/account_users",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json[\"api_access_token\"] }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "user_id",
|
||||
"value": "={{ $node[\"Cria Usuario\"].json[\"id\"] }}"
|
||||
},
|
||||
{
|
||||
"name": "role",
|
||||
"value": "administrator"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "848c55e2-5678-4291-9602-c94d994da95b",
|
||||
"name": "Add Usuario a Conta",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
2420,
|
||||
860
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fromEmail": "={{ $('Info Base').item.json[\"from_email\"] }}",
|
||||
"toEmail": "={{ $('LimpaDados').item.json.email }}",
|
||||
"subject": "=Bem vindo à {{ $('Info Base').item.json[\"organization\"] }}",
|
||||
"text": "=Olá seja bem vindo:\n\nAbaixo segue seus dados de acesso:\n\nURL: {{ $('Info Base').item.json[\"chatwoot_url\"] }}\n\nuser: {{ $('LimpaDados').item.json[\"email\"] }}\n\nSenha: {{ $('LimpaDados').item.json[\"password\"] }}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "27f3b24f-1cf2-4d0d-a354-ecba066059f6",
|
||||
"name": "Send Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
3220,
|
||||
860
|
||||
],
|
||||
"credentials": {
|
||||
"smtp": {
|
||||
"id": "6BxluEUV8zrXKoVG",
|
||||
"name": "[Dgcode] SMTP"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "CHATWOOT_PLATFORM_TOKEN"
|
||||
},
|
||||
{
|
||||
"name": "chatwoot_url",
|
||||
"value": "https://CHATWOOT_URL"
|
||||
},
|
||||
{
|
||||
"name": "n8n_url",
|
||||
"value": "https://N8N_URL"
|
||||
},
|
||||
{
|
||||
"name": "organization",
|
||||
"value": "ORGANIZATION_NAME"
|
||||
},
|
||||
{
|
||||
"name": "logo",
|
||||
"value": "ORGANIZATION_LOGO"
|
||||
},
|
||||
{
|
||||
"name": "from_email",
|
||||
"value": "FROM_EMAIL"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"value": "={{ $json.name_company }}"
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"value": "={{ $json.email }}"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"value": "={{ $json.password }}"
|
||||
},
|
||||
{
|
||||
"name": "name_company",
|
||||
"value": "={{ $json.name_company }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "38b4069d-e51e-4db7-933f-941b1be6d124",
|
||||
"name": "Info Base",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1820,
|
||||
860
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"keepOnlySet": true,
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "name_admin",
|
||||
"value": "={{$node[\"Webhook\"].json[\"body\"][\"messages\"][0][\"content\"].match(/Nome Usuario Administrador: ([^\\n]+)/)[1];}}"
|
||||
},
|
||||
{
|
||||
"name": "name_company",
|
||||
"value": "={{$node[\"Webhook\"].json[\"body\"][\"messages\"][0][\"content\"].match(/Nome da Empresa: ([^\\n]+)/)[1];}}"
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"value": "={{$node[\"Webhook\"].json[\"body\"][\"messages\"][0][\"content\"].match(/Email: ([^\\s]+)/)[1];}}"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"value": "={{$node[\"Webhook\"].json[\"body\"][\"messages\"][0][\"content\"].match(/Senha: ([^\\s]+)/)[1];}}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "28e29e73-aadc-49ca-bd6d-b57ee0160a21",
|
||||
"name": "LimpaDados",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1620,
|
||||
860
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/api/v1/accounts/{{ $('Add Usuario a Conta').item.json.account_id }}/contacts/",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Cria Usuario').item.json.access_token }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"inbox_id\": {{ $('Cria Inbox Start').item.json[\"id\"] }},\n \"name\": \"Bot {{ $('Info Base').item.json[\"organization\"] }}\",\n \"phone_number\": \"+123456\",\n \"avatar_url\": \"{{ $('Info Base').item.json[\"logo\"] }}\"\n}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "bb671443-bdb4-4f56-99af-f0baef246a3e",
|
||||
"name": "Cria Contato Bot",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
2820,
|
||||
860
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/api/v1/accounts/{{ $('Add Usuario a Conta').item.json.account_id }}/automation_rules/",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Cria Usuario').item.json.access_token }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"name\": \"Create Inbox {{ $('Info Base').item.json[\"organization\"] }}\",\n \"description\": \"Create Inbox {{ $('Info Base').item.json[\"organization\"] }}\",\n \"event_name\": \"message_created\",\n \"active\": true,\n \"actions\": \n [\n {\n \"action_name\": \"send_webhook_event\",\n \"action_params\": [\"{{ $('Info Base').item.json[\"n8n_url\"] }}/webhook/inbox_whatsapp?utoken={{ $('Cria Usuario').item.json.access_token }}&organization={{ $('Info Base').item.json[\"organization\"] }}\"]\n }\n ],\n \"conditions\": \n [\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"start:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"query_operator\": \"or\",\n \"values\": [\"+123456\"]\n },\n {\n \"attribute_key\": \"content\",\n \"filter_operator\": \"contains\",\n \"query_operator\": \"and\",\n \"values\": [\"new_instance:\"]\n },\n {\n \"attribute_key\": \"phone_number\",\n \"filter_operator\": \"equal_to\",\n \"values\": [\"+123456\"]\n }\n ]\n}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "e016a2af-b212-4e00-a3ff-8cd03530aa06",
|
||||
"name": "Cria Automação",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
3020,
|
||||
860
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwoot_url\"] }}/api/v1/accounts/{{ $json.account_id }}/inboxes/",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Cria Usuario').item.json.access_token }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n \"name\": \"Start {{ $('Info Base').item.json[\"organization\"] }}\",\n \"channel\": {\n \"type\": \"api\",\n \"website_url\": \"\"\n }\n}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "d3c42148-8920-4c98-a874-eb7113f2dd22",
|
||||
"name": "Cria Inbox Start",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
2620,
|
||||
860
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"content": "## Workflow Criador de Empresas\n**Cria Contas (Empresas) e Usuários através de tema**\n**Instruções**\n**No node Info Base, configure as variáveis de seu Chatwoot e N8N**\n**Obs: A variável api_access_token é o token PlatformApp encontrado no acesso ao Super Admin**\n**Tema para criar novas empresa:**\n\nTema Criador de Empresa:\n\nNome Usuario Administrador: Joao Linhares\nNome da Empresa: Oficina Linhates\nEmail: machineteste24@gmail.com\nSenha: Mfcd62!!",
|
||||
"height": 304.02684563758396,
|
||||
"width": 1129.7777777777778
|
||||
},
|
||||
"id": "d07516c0-4c8e-43ab-ba86-c8d063b09be5",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1420,
|
||||
520
|
||||
]
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "LimpaDados",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cria Conta": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Usuario",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cria Usuario": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Add Usuario a Conta",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Add Usuario a Conta": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Inbox Start",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Info Base": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Conta",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"LimpaDados": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Info Base",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cria Contato Bot": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Automação",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cria Automação": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Cria Inbox Start": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Contato Bot",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {},
|
||||
"versionId": "3ffd6d3f-6966-4de4-af8f-1fda464bc1b8",
|
||||
"id": "79R6qQDtfyCwgYjJ",
|
||||
"meta": {
|
||||
"instanceId": "4ff16e963c7f5197d7e99e6239192860914312fea0ce2a9a7fd14d74a0a0e906"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
577
Extras/chatwoot/criador_de_inbox.json
Normal file
577
Extras/chatwoot/criador_de_inbox.json
Normal file
@@ -0,0 +1,577 @@
|
||||
{
|
||||
"name": "criador_de_inbox_evo_v2.0",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"method": "POST",
|
||||
"url": "={{ $json.evolution_url }}/instance/create",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
},
|
||||
{
|
||||
"name": "apikey",
|
||||
"value": "={{ $json.global_api_key }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"bodyParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "instanceName",
|
||||
"value": "={{ $json.instanceName }}"
|
||||
},
|
||||
{
|
||||
"name": "qrcode",
|
||||
"value": "={{ $json.qrcode }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootAccountId",
|
||||
"value": "={{ $json.chatwootAccountId }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootToken",
|
||||
"value": "={{ $json.chatwootToken }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootUrl",
|
||||
"value": "={{ $json.chatwootUrl }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootSignMsg",
|
||||
"value": "={{ $json.chatwootSignMsg }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootReopenConversation",
|
||||
"value": "={{ $json.chatwootReopenConversation }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootConversationPending",
|
||||
"value": "={{ $json.chatwootConversationPending }}"
|
||||
},
|
||||
{
|
||||
"name": "rejectCall",
|
||||
"value": "={{ $json.rejectCall }}"
|
||||
},
|
||||
{
|
||||
"name": "msgCall",
|
||||
"value": "={{ $json.msgCall }}"
|
||||
},
|
||||
{
|
||||
"name": "groupsIgnore",
|
||||
"value": "={{ $json.groupsIgnore }}"
|
||||
},
|
||||
{
|
||||
"name": "alwaysOnline",
|
||||
"value": "={{ $json.alwaysOnline }}"
|
||||
},
|
||||
{
|
||||
"name": "readMessages",
|
||||
"value": "={{ $json.readMessages }}"
|
||||
},
|
||||
{
|
||||
"name": "readStatus",
|
||||
"value": "={{ $json.readStatus }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootImportContacts",
|
||||
"value": "={{ $json.chatwootImportContacts }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootImportMessages",
|
||||
"value": "={{ $json.chatwootImportMessages }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootDaysLimitImportMessages",
|
||||
"value": "={{ $json.chatwootDaysLimitImportMessages }}"
|
||||
},
|
||||
{
|
||||
"name": "syncFullHistory",
|
||||
"value": "={{ $json.syncFullHistory }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootMergeBrazilContacts",
|
||||
"value": "={{ $json.chatwootMergeBrazilContacts }}"
|
||||
},
|
||||
{
|
||||
"name": "integration",
|
||||
"value": "={{ $json.integration }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootNameInbox",
|
||||
"value": "={{ $json.chatwootNameInbox }}"
|
||||
},
|
||||
{
|
||||
"name": "token",
|
||||
"value": "={{ $json.token }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "7da41431-cc8e-4eb4-9894-7bf413819fe3",
|
||||
"name": "Cria Instancia",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 4.1,
|
||||
"position": [
|
||||
900,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"url": "={{ $('Info Base').item.json[\"chatwootUrl\"] }}/api/v1/accounts/{{ $('Info Base').item.json[\"chatwootAccountId\"] }}/inboxes/",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json.chatwootToken }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "d51fbbfe-4579-4fba-949f-c29e0b806feb",
|
||||
"name": "Lista Inboxes",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
1120,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"content": "## Workflow Para Criar Inbox - Evolution 2.0 ou superior\n**Aqui você configura a comunicação entre o chatwoot e a Evolution API para criar novas instâncias a partir do chatwoot**\n**Instruções**\n**No node Info Base, configure as variáveis de seu Chatwoot e Evolution API**",
|
||||
"width": 1129.7777777777778
|
||||
},
|
||||
"id": "7c66af51-b01e-4b76-8a8c-0193e87ec9d5",
|
||||
"name": "Sticky Note",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
460,
|
||||
460
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"keepOnlySet": true,
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "chatwootUrl",
|
||||
"value": "https://chatwootUrl - preencha"
|
||||
},
|
||||
{
|
||||
"name": "evolution_url",
|
||||
"value": "https://evolution_url - preencha"
|
||||
},
|
||||
{
|
||||
"name": "global_api_key",
|
||||
"value": "global_api_key - preencha"
|
||||
},
|
||||
{
|
||||
"name": "organization",
|
||||
"value": "={{ $json.query.organization }}"
|
||||
},
|
||||
{
|
||||
"name": "instanceName",
|
||||
"value": "={{ $json.body.messages[0].content.split(':')[1] }}-cwId-{{ $json.body.messages[0].account_id }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootToken",
|
||||
"value": "={{ $json.query.utoken }}"
|
||||
},
|
||||
{
|
||||
"name": "msgCall",
|
||||
"value": "Não aceitamos chamadas, por favor deixe uma mensagem!"
|
||||
},
|
||||
{
|
||||
"name": "integration",
|
||||
"value": "WHATSAPP-BAILEYS"
|
||||
},
|
||||
{
|
||||
"name": "chatwootNameInbox",
|
||||
"value": "={{ $json.body.messages[0].content.split(':')[1] }}"
|
||||
},
|
||||
{
|
||||
"name": "chatwootAccountId",
|
||||
"value": "={{ $json.body.messages[0].account_id.toString() }}"
|
||||
},
|
||||
{
|
||||
"name": "token",
|
||||
"value": "=AfRw{{ Date.now() }}BeH4"
|
||||
}
|
||||
],
|
||||
"boolean": [
|
||||
{
|
||||
"name": "qrcode",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"name": "chatwootSignMsg",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"name": "chatwootReopenConversation",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"name": "chatwootConversationPending"
|
||||
},
|
||||
{
|
||||
"name": "rejectCall"
|
||||
},
|
||||
{
|
||||
"name": "groupsIgnore"
|
||||
},
|
||||
{
|
||||
"name": "alwaysOnline",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"name": "readMessages",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"name": "readStatus"
|
||||
},
|
||||
{
|
||||
"name": "chatwootImportMessages",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"name": "chatwootImportContacts",
|
||||
"value": true
|
||||
},
|
||||
{
|
||||
"name": "syncFullHistory"
|
||||
},
|
||||
{
|
||||
"name": "chatwootMergeBrazilContacts",
|
||||
"value": true
|
||||
}
|
||||
],
|
||||
"number": [
|
||||
{
|
||||
"name": "chatwootDaysLimitImportMessages",
|
||||
"value": 60
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"dotNotation": false
|
||||
}
|
||||
},
|
||||
"id": "eaffbc44-3701-4f8d-b923-92061cfb995f",
|
||||
"name": "Info Base",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
680,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"value2": "=Start {{ $('Info Base').item.json[\"organization\"] }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "82eb24c8-2269-4622-b012-d6f6ad35c149",
|
||||
"name": "é Start Inbox?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1800,
|
||||
600
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"batchSize": 1,
|
||||
"options": {}
|
||||
},
|
||||
"id": "b9de1318-ab0b-4529-b30a-2daea64dbcfe",
|
||||
"name": "Split In Batches",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1560,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "DELETE",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwootUrl\"] }}/api/v1/accounts/{{ $('Info Base').item.json[\"chatwootAccountId\"] }}/inboxes/{{ $json.id }}",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json.chatwootToken }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "db2ad958-7642-41eb-8e9a-e8b1668230d1",
|
||||
"name": "Deleta Inbox Start",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
2040,
|
||||
480
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "6d68d3a7-d613-471f-8492-9ec473481521",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1800,
|
||||
780
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"fieldToSplitOut": "payload",
|
||||
"options": {}
|
||||
},
|
||||
"id": "be833e77-b2ae-44c6-b4fc-ad24ffc8ad9a",
|
||||
"name": "Ajusta lista",
|
||||
"type": "n8n-nodes-base.itemLists",
|
||||
"typeVersion": 2.2,
|
||||
"position": [
|
||||
1340,
|
||||
680
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "inbox_whatsapp",
|
||||
"options": {}
|
||||
},
|
||||
"id": "faae80e0-9070-4a0c-83bc-d47643a64653",
|
||||
"name": "Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
460,
|
||||
680
|
||||
],
|
||||
"webhookId": "85cb0c27-4223-4339-b7b4-35a16c0a04b8"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"string": [
|
||||
{
|
||||
"value1": "={{ $json.name }}",
|
||||
"value2": "={{ $('Webhook').item.json[\"body\"][\"messages\"][0][\"content\"].split(':')[1] }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "4ea7b74f-bdc5-4619-8e99-1f5d33c7e28e",
|
||||
"name": "é_pre-existente?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1980,
|
||||
700
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"method": "PATCH",
|
||||
"url": "={{ $('Info Base').item.json[\"chatwootUrl\"] }}/api/v1/accounts/{{ $('Info Base').item.json[\"chatwootAccountId\"] }}/inboxes/{{ $json.id }}",
|
||||
"sendHeaders": true,
|
||||
"headerParameters": {
|
||||
"parameters": [
|
||||
{
|
||||
"name": "api_access_token",
|
||||
"value": "={{ $('Info Base').item.json.chatwootToken }}"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
},
|
||||
"sendBody": true,
|
||||
"specifyBody": "json",
|
||||
"jsonBody": "={\n\"channel\": {\n\"webhook_url\": \"{{ $('Info Base').item.json[\"evolution_url\"] }}/chatwoot/webhook/{{ encodeURIComponent($('Info Base').item.json[\"instanceName\"]) }}\"\n}\n}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "74d6db21-d49e-48d6-b1a8-ff8bddca67d1",
|
||||
"name": "Update_webhook_url",
|
||||
"type": "n8n-nodes-base.httpRequest",
|
||||
"typeVersion": 3,
|
||||
"position": [
|
||||
2200,
|
||||
700
|
||||
]
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Cria Instancia": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Lista Inboxes",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Lista Inboxes": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Ajusta lista",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Info Base": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Cria Instancia",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"é Start Inbox?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Deleta Inbox Start",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "é_pre-existente?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Split In Batches": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "é Start Inbox?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Deleta Inbox Start": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Split In Batches",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Ajusta lista": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Split In Batches",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Info Base",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"é_pre-existente?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Update_webhook_url",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Split In Batches",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Update_webhook_url": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Split In Batches",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "68f9fa60-e295-4b74-8cb3-c4723d6cb2b2",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "8ed3edb9203bfe03a4b94f63390235285fbb1c230430fdae73a456b9fae762d5"
|
||||
},
|
||||
"id": "f6dLbF7I7nrjcDc4",
|
||||
"tags": []
|
||||
}
|
||||
675
LICENSE
675
LICENSE
@@ -1,674 +1,21 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
# Evolution API License
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Evolution API is licensed under the Apache License 2.0, with the following additional conditions:
|
||||
|
||||
Preamble
|
||||
1. Evolution API may be utilized commercially, including as a backend service for other applications or as an application development platform for enterprises. Should the conditions below be met, a commercial license must be obtained from the producer:
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
a. LOGO and copyright information: In the process of using Evolution API's frontend components, you may not remove or modify the LOGO or copyright information in the Evolution API console or applications. This restriction is inapplicable to uses of Evolution API that do not involve its frontend components.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
b. Usage Notification Requirement: If Evolution API is used as part of any project, including closed-source systems (e.g., proprietary software), the user is required to display a clear notification within the system that Evolution API is being utilized. This notification should be visible to system administrators and accessible from the system's documentation or settings page. Failure to comply with this requirement may result in the necessity for a commercial license, as determined by the producer.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
Please contact contato@evolution-api.com to inquire about licensing matters.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
2. As a contributor, you should agree that:
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary.
|
||||
b. Your contributed code may be used for commercial purposes, including but not limited to its cloud business operations.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
© 2025 Evolution API
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
137
README.md
137
README.md
@@ -2,40 +2,143 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://hub.docker.com/r/evoapicloud/evolution-api)
|
||||
[](https://evolution-api.com/whatsapp)
|
||||
[](https://evolution-api.com/discord)
|
||||
[](https://evolution-api.com/postman)
|
||||
[](https://doc.evolution-api.com)
|
||||
[](./LICENSE)
|
||||
[](https://app.picpay.com/user/davidsongomes1998)
|
||||
[](https://evolutionapi.canny.io/feature-requests)
|
||||
[](https://evolutionapi.canny.io/feature-requests)
|
||||
[](https://evolutionapi.canny.io/changelog)
|
||||
[](./LICENSE)
|
||||
[](https://app.picpay.com/user/davidsongomes1998)
|
||||
[](https://github.com/sponsors/EvolutionAPI)
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center"><img src="./public/images/cover.png"></div>
|
||||
|
||||
## WhatsApp-Api-NodeJs
|
||||
## Evolution API
|
||||
|
||||
This project is based on the [CodeChat](https://github.com/code-chat-br/whatsapp-api). The original project is an implementation of [Baileys](https://github.com/WhiskeySockets/Baileys), serving as a Restful API service that controls WhatsApp functions.</br>
|
||||
The code allows the creation of multiservice chats, service bots, or any other system that utilizes WhatsApp. The documentation provides instructions on how to set up and use the project, as well as additional information about its features and configuration options.
|
||||
Evolution API began as a WhatsApp controller API based on [CodeChat](https://github.com/code-chat-br/whatsapp-api), which in turn implemented the [Baileys](https://github.com/WhiskeySockets/Baileys) library. While originally focused on WhatsApp, Evolution API has grown into a comprehensive platform supporting multiple messaging services and integrations. We continue to acknowledge CodeChat for laying the groundwork.
|
||||
|
||||
## SSL
|
||||
Today, Evolution API is not limited to WhatsApp. It integrates with various platforms such as Typebot, Chatwoot, Dify, and OpenAI, offering a broad array of functionalities beyond messaging. Evolution API supports both the Baileys-based WhatsApp API and the official WhatsApp Business API, with upcoming support for Instagram and Messenger.
|
||||
|
||||
To install the SSL certificate, follow the **[instructions](https://certbot.eff.org/instructions?ws=other&os=ubuntufocal)** below.
|
||||
## Looking for a Lightweight Version?
|
||||
For those who need a more streamlined and performance-optimized version, check out [Evolution API Lite](https://github.com/EvolutionAPI/evolution-api-lite). It's designed specifically for microservices, focusing solely on connectivity without integrations or audio conversion features. Ideal for environments that prioritize simplicity and efficiency.
|
||||
|
||||
# Note
|
||||
## Types of Connections
|
||||
|
||||
This code is in no way affiliated with WhatsApp. Use at your own discretion. Don't spam this.
|
||||
Evolution API supports multiple types of connections to WhatsApp, enabling flexible and powerful integration options:
|
||||
|
||||
This code was produced based on the baileys library and it is still under development.
|
||||
- *WhatsApp API - Baileys*:
|
||||
- A free API based on WhatsApp Web, leveraging the [Baileys library](https://github.com/WhiskeySockets/Baileys).
|
||||
- This connection type allows control over WhatsApp Web functionalities through a RESTful API, suitable for multi-service chats, service bots, and other WhatsApp-integrated systems.
|
||||
- Note: This method relies on the web version of WhatsApp and may have limitations compared to official APIs.
|
||||
|
||||
- *WhatsApp Cloud API*:
|
||||
- The official API provided by Meta (formerly Facebook).
|
||||
- This connection type offers a robust and reliable solution designed for businesses needing higher volumes of messaging and better integration support.
|
||||
- The Cloud API supports features such as end-to-end encryption, advanced analytics, and more comprehensive customer service tools.
|
||||
- To use this API, you must comply with Meta's policies and potentially pay for usage based on message volume and other factors.
|
||||
|
||||
## Integrations
|
||||
|
||||
Evolution API supports various integrations to enhance its functionality. Below is a list of available integrations and their uses:
|
||||
|
||||
- [Typebot](https://typebot.io/):
|
||||
- Build conversational bots using Typebot, integrated directly into Evolution with trigger management.
|
||||
|
||||
- [Chatwoot](https://www.chatwoot.com/):
|
||||
- Direct integration with Chatwoot for handling customer service for your business.
|
||||
|
||||
- [RabbitMQ](https://www.rabbitmq.com/):
|
||||
- Receive events from the Evolution API via RabbitMQ.
|
||||
|
||||
- [Apache Kafka](https://kafka.apache.org/):
|
||||
- Receive events from the Evolution API via Apache Kafka for real-time event streaming and processing.
|
||||
|
||||
- [Amazon SQS](https://aws.amazon.com/pt/sqs/):
|
||||
- Receive events from the Evolution API via Amazon SQS.
|
||||
|
||||
- [Socket.io](https://socket.io/):
|
||||
- Receive events from the Evolution API via WebSocket.
|
||||
|
||||
- [Dify](https://dify.ai/):
|
||||
- Integrate your Evolution API directly with Dify AI for seamless trigger management and multiple agents.
|
||||
|
||||
- [OpenAI](https://openai.com/):
|
||||
- Integrate your Evolution API with OpenAI for AI capabilities, including audio-to-text conversion, available across all Evolution integrations.
|
||||
|
||||
- Amazon S3 / Minio:
|
||||
- Store media files received in [Amazon S3](https://aws.amazon.com/pt/s3/) or [Minio](https://min.io/).
|
||||
|
||||
## Community & Feedback
|
||||
|
||||
We value community input and feedback to continuously improve Evolution API:
|
||||
|
||||
### 🚀 Feature Requests & Roadmap
|
||||
- **[Feature Requests](https://evolutionapi.canny.io/feature-requests)**: Submit new feature ideas and vote on community proposals
|
||||
- **[Roadmap](https://evolutionapi.canny.io/feature-requests)**: View planned features and development progress
|
||||
- **[Changelog](https://evolutionapi.canny.io/changelog)**: Stay updated with the latest releases and improvements
|
||||
|
||||
### 💬 Community Support
|
||||
- **[WhatsApp Group](https://evolution-api.com/whatsapp)**: Join our community for support and discussions
|
||||
- **[Discord Community](https://evolution-api.com/discord)**: Real-time chat with developers and users
|
||||
- **[GitHub Issues](https://github.com/EvolutionAPI/evolution-api/issues)**: Report bugs and technical issues
|
||||
|
||||
### 🔒 Security
|
||||
- **[Security Policy](./SECURITY.md)**: Guidelines for reporting security vulnerabilities
|
||||
- **Security Contact**: contato@evolution-api.com
|
||||
|
||||
## Telemetry Notice
|
||||
|
||||
To continuously improve our services, we have implemented telemetry that collects data on the routes used, the most accessed routes, and the version of the API in use. We would like to assure you that no sensitive or personal data is collected during this process. The telemetry helps us identify improvements and provide a better experience for users.
|
||||
|
||||
## Evolution Support Premium
|
||||
|
||||
Join our Evolution Pro community for expert support and a weekly call to answer questions. Visit the link below to learn more and subscribe:
|
||||
|
||||
[Click here to learn more](https://evolution-api.com/suporte-pro)
|
||||
|
||||
# Donate to the project.
|
||||
|
||||
#### PicPay
|
||||
#### Github Sponsors
|
||||
|
||||
<div align="center">
|
||||
<a href="https://app.picpay.com/user/davidsongomes1998" target="_blank" rel="noopener noreferrer">
|
||||
<img src="./public/images/picpay-image.png" style="width: 50% !important;">
|
||||
</a>
|
||||
</div>
|
||||
https://github.com/sponsors/EvolutionAPI
|
||||
|
||||
</br>
|
||||
# Content Creator Partners
|
||||
|
||||
We are proud to collaborate with the following content creators who have contributed valuable insights and tutorials about Evolution API:
|
||||
|
||||
- [Promovaweb](https://www.youtube.com/@promovaweb)
|
||||
- [Sandeco](https://www.youtube.com/@canalsandeco)
|
||||
- [Comunidade ZDG](https://www.youtube.com/@ComunidadeZDG)
|
||||
- [Francis MNO](https://www.youtube.com/@FrancisMNO)
|
||||
- [Pablo Cabral](https://youtube.com/@pablocabral)
|
||||
- [XPop Digital](https://www.youtube.com/@xpopdigital)
|
||||
- [Costar Wagner Dev](https://www.youtube.com/@costarwagnerdev)
|
||||
- [Dante Testa](https://youtube.com/@dantetesta_)
|
||||
- [Rubén Salazar](https://youtube.com/channel/UCnYGZIE2riiLqaN9sI6riig)
|
||||
- [OrionDesign](youtube.com/OrionDesign_Oficial)
|
||||
- [IMPA 365](youtube.com/@impa365_ofc)
|
||||
- [Comunidade Hub Connect](https://youtube.com/@comunidadehubconnect)
|
||||
- [dSantana Automações](https://www.youtube.com/channel/UCG7DjUmAxtYyURlOGAIryNQ?view_as=subscriber)
|
||||
- [Edison Martins](https://www.youtube.com/@edisonmartinsmkt)
|
||||
- [Astra Online](https://www.youtube.com/@astraonlineweb)
|
||||
- [MKT Seven Automações](https://www.youtube.com/@sevenautomacoes)
|
||||
- [Vamos automatizar](https://www.youtube.com/vamosautomatizar)
|
||||
|
||||
## License
|
||||
|
||||
Evolution API is licensed under the Apache License 2.0, with the following additional conditions:
|
||||
|
||||
1. **LOGO and copyright information**: In the process of using Evolution API's frontend components, you may not remove or modify the LOGO or copyright information in the Evolution API console or applications. This restriction is inapplicable to uses of Evolution API that do not involve its frontend components.
|
||||
|
||||
2. **Usage Notification Requirement**: If Evolution API is used as part of any project, including closed-source systems (e.g., proprietary software), the user is required to display a clear notification within the system that Evolution API is being utilized. This notification should be visible to system administrators and accessible from the system's documentation or settings page. Failure to comply with this requirement may result in the necessity for a commercial license, as determined by the producer.
|
||||
|
||||
Please contact contato@evolution-api.com to inquire about licensing matters.
|
||||
|
||||
Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
||||
|
||||
© 2025 Evolution API
|
||||
|
||||
99
SECURITY.md
Normal file
99
SECURITY.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
We actively support the following versions of Evolution API with security updates:
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 2.3.x | ✅ Yes |
|
||||
| 2.2.x | ✅ Yes |
|
||||
| 2.1.x | ⚠️ Critical fixes only |
|
||||
| < 2.1 | ❌ No |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
We take security vulnerabilities seriously. If you discover a security vulnerability in Evolution API, please help us by reporting it responsibly.
|
||||
|
||||
### 🔒 Private Disclosure Process
|
||||
|
||||
**Please DO NOT create a public GitHub issue for security vulnerabilities.**
|
||||
|
||||
Instead, please report security vulnerabilities via email to:
|
||||
|
||||
**📧 contato@evolution-api.com**
|
||||
|
||||
### 📋 What to Include
|
||||
|
||||
When reporting a vulnerability, please include:
|
||||
|
||||
- **Description**: A clear description of the vulnerability
|
||||
- **Impact**: What an attacker could achieve by exploiting this vulnerability
|
||||
- **Steps to Reproduce**: Detailed steps to reproduce the issue
|
||||
- **Proof of Concept**: If possible, include a minimal proof of concept
|
||||
- **Environment**: Version of Evolution API, OS, Node.js version, etc.
|
||||
- **Suggested Fix**: If you have ideas for how to fix the issue
|
||||
|
||||
### 🕐 Response Timeline
|
||||
|
||||
We will acknowledge receipt of your vulnerability report within **48 hours** and will send you regular updates about our progress.
|
||||
|
||||
- **Initial Response**: Within 48 hours
|
||||
- **Status Update**: Within 7 days
|
||||
- **Resolution Timeline**: Varies based on complexity, typically 30-90 days
|
||||
|
||||
### 🎯 Scope
|
||||
|
||||
This security policy applies to:
|
||||
|
||||
- Evolution API core application
|
||||
- Official Docker images
|
||||
- Documentation that could lead to security issues
|
||||
|
||||
### 🚫 Out of Scope
|
||||
|
||||
The following are generally considered out of scope:
|
||||
|
||||
- Third-party integrations (Chatwoot, Typebot, etc.) - please report to respective projects
|
||||
- Issues in dependencies - please report to the dependency maintainers
|
||||
- Social engineering attacks
|
||||
- Physical attacks
|
||||
- Denial of Service attacks
|
||||
|
||||
### 🏆 Recognition
|
||||
|
||||
We believe in recognizing security researchers who help us keep Evolution API secure:
|
||||
|
||||
- We will acknowledge your contribution in our security advisories (unless you prefer to remain anonymous)
|
||||
- For significant vulnerabilities, we may feature you in our Hall of Fame
|
||||
- We will work with you on coordinated disclosure timing
|
||||
|
||||
### 📚 Security Best Practices
|
||||
|
||||
For users deploying Evolution API:
|
||||
|
||||
- Always use the latest supported version
|
||||
- Keep your dependencies up to date
|
||||
- Use strong authentication methods
|
||||
- Implement proper network security
|
||||
- Monitor your logs for suspicious activity
|
||||
- Follow the principle of least privilege
|
||||
|
||||
### 🔄 Security Updates
|
||||
|
||||
Security updates will be:
|
||||
|
||||
- Released as patch versions (e.g., 2.3.1 → 2.3.2)
|
||||
- Documented in our [CHANGELOG.md](./CHANGELOG.md)
|
||||
- Announced in our community channels
|
||||
- Tagged with security labels in GitHub releases
|
||||
|
||||
## Contact
|
||||
|
||||
For any questions about this security policy, please contact:
|
||||
|
||||
- **Email**: contato@evolution-api.com
|
||||
|
||||
---
|
||||
|
||||
Thank you for helping keep Evolution API and our community safe! 🛡️
|
||||
34
commitlint.config.js
Normal file
34
commitlint.config.js
Normal file
@@ -0,0 +1,34 @@
|
||||
module.exports = {
|
||||
extends: ['@commitlint/config-conventional'],
|
||||
rules: {
|
||||
'type-enum': [
|
||||
2,
|
||||
'always',
|
||||
[
|
||||
'feat', // New feature
|
||||
'fix', // Bug fix
|
||||
'docs', // Documentation changes
|
||||
'style', // Code style changes (formatting, etc)
|
||||
'refactor', // Code refactoring
|
||||
'perf', // Performance improvements
|
||||
'test', // Adding or updating tests
|
||||
'chore', // Maintenance tasks
|
||||
'ci', // CI/CD changes
|
||||
'build', // Build system changes
|
||||
'revert', // Reverting changes
|
||||
'security', // Security fixes
|
||||
],
|
||||
],
|
||||
'type-case': [2, 'always', 'lower-case'],
|
||||
'type-empty': [2, 'never'],
|
||||
'scope-case': [2, 'always', 'lower-case'],
|
||||
'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
|
||||
'subject-empty': [2, 'never'],
|
||||
'subject-full-stop': [2, 'never', '.'],
|
||||
'header-max-length': [2, 'always', 100],
|
||||
'body-leading-blank': [1, 'always'],
|
||||
'body-max-line-length': [0, 'always', 150],
|
||||
'footer-leading-blank': [1, 'always'],
|
||||
'footer-max-line-length': [0, 'always', 150],
|
||||
},
|
||||
};
|
||||
@@ -1,72 +0,0 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
redis:
|
||||
image: redis:latest
|
||||
container_name: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
rebrow:
|
||||
image: marian/rebrow
|
||||
ports:
|
||||
- 5001:5001
|
||||
links:
|
||||
- redis
|
||||
|
||||
mongodb:
|
||||
container_name: mongodb
|
||||
image: mongo
|
||||
restart: always
|
||||
volumes:
|
||||
- evolution_mongodb_data:/data/db
|
||||
- evolution_mongodb_configdb:/data/configdb
|
||||
ports:
|
||||
- 27017:27017
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: root
|
||||
MONGO_INITDB_ROOT_PASSWORD: root
|
||||
expose:
|
||||
- 27017
|
||||
|
||||
mongo-express:
|
||||
image: mongo-express
|
||||
environment:
|
||||
ME_CONFIG_BASICAUTH_USERNAME: root
|
||||
ME_CONFIG_BASICAUTH_PASSWORD: root
|
||||
ME_CONFIG_MONGODB_SERVER: mongodb
|
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: root
|
||||
ports:
|
||||
- 8081:8081
|
||||
links:
|
||||
- mongodb
|
||||
api:
|
||||
container_name: evolution_api
|
||||
image: evolution/api:local
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- evolution_instances:/evolution/instances
|
||||
- evolution_store:/evolution/store
|
||||
env_file:
|
||||
- ./Docker/.env
|
||||
command: ['node', './dist/src/main.js']
|
||||
expose:
|
||||
- 8080
|
||||
links:
|
||||
- mongodb
|
||||
- redis
|
||||
|
||||
volumes:
|
||||
evolution_instances:
|
||||
evolution_store:
|
||||
evolution_mongodb_data:
|
||||
evolution_mongodb_configdb:
|
||||
evolution_redis:
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: evolution-net
|
||||
|
||||
35
docker-compose.dev.yaml
Normal file
35
docker-compose.dev.yaml
Normal file
@@ -0,0 +1,35 @@
|
||||
services:
|
||||
api:
|
||||
container_name: evolution_api
|
||||
image: evolution/api:local
|
||||
build: .
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- evolution_instances:/evolution/instances
|
||||
networks:
|
||||
- evolution-net
|
||||
env_file:
|
||||
- .env
|
||||
expose:
|
||||
- 8080
|
||||
|
||||
frontend:
|
||||
container_name: evolution_frontend
|
||||
image: evolution/manager:local
|
||||
build: ./evolution-manager-v2
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:80"
|
||||
networks:
|
||||
- evolution-net
|
||||
|
||||
volumes:
|
||||
evolution_instances:
|
||||
|
||||
|
||||
networks:
|
||||
evolution-net:
|
||||
name: evolution-net
|
||||
driver: bridge
|
||||
@@ -1,26 +1,84 @@
|
||||
version: '3.3'
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
api:
|
||||
container_name: evolution_api
|
||||
image: evolution/api:local
|
||||
image: evoapicloud/evolution-api:latest
|
||||
restart: always
|
||||
depends_on:
|
||||
- redis
|
||||
- evolution-postgres
|
||||
ports:
|
||||
- 8080:8080
|
||||
- "127.0.0.1:8080:8080"
|
||||
volumes:
|
||||
- evolution_instances:/evolution/instances
|
||||
- evolution_store:/evolution/store
|
||||
networks:
|
||||
- evolution-net
|
||||
- dokploy-network
|
||||
env_file:
|
||||
- ./Docker/.env
|
||||
command: ['node', './dist/src/main.js']
|
||||
- .env
|
||||
expose:
|
||||
- 8080
|
||||
- "8080"
|
||||
|
||||
frontend:
|
||||
container_name: evolution_frontend
|
||||
image: evoapicloud/evolution-manager:latest
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:80"
|
||||
networks:
|
||||
- evolution-net
|
||||
|
||||
redis:
|
||||
container_name: evolution_redis
|
||||
image: redis:latest
|
||||
restart: always
|
||||
command: >
|
||||
redis-server --port 6379 --appendonly yes
|
||||
volumes:
|
||||
- evolution_redis:/data
|
||||
networks:
|
||||
evolution-net:
|
||||
aliases:
|
||||
- evolution-redis
|
||||
dokploy-network:
|
||||
aliases:
|
||||
- evolution-redis
|
||||
expose:
|
||||
- "6379"
|
||||
|
||||
evolution-postgres:
|
||||
container_name: evolution_postgres
|
||||
image: postgres:15
|
||||
restart: always
|
||||
env_file:
|
||||
- .env
|
||||
command:
|
||||
- postgres
|
||||
- -c
|
||||
- max_connections=1000
|
||||
- -c
|
||||
- listen_addresses=*
|
||||
environment:
|
||||
- POSTGRES_DB=${POSTGRES_DATABASE}
|
||||
- POSTGRES_USER=${POSTGRES_USERNAME}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- evolution-net
|
||||
- dokploy-network
|
||||
expose:
|
||||
- "5432"
|
||||
|
||||
volumes:
|
||||
evolution_instances:
|
||||
evolution_store:
|
||||
evolution_redis:
|
||||
postgres_data:
|
||||
|
||||
networks:
|
||||
default:
|
||||
evolution-net:
|
||||
name: evolution-net
|
||||
|
||||
driver: bridge
|
||||
dokploy-network:
|
||||
external: true
|
||||
13
docker.sh
13
docker.sh
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
NET='evolution-net'
|
||||
IMAGE='evolution/api:local'
|
||||
|
||||
if !(docker network ls | grep ${NET} > /dev/null)
|
||||
then
|
||||
docker network create -d bridge ${NET}
|
||||
fi
|
||||
|
||||
docker build -t ${IMAGE} .
|
||||
|
||||
docker compose up -d
|
||||
302
env.example
Normal file
302
env.example
Normal file
@@ -0,0 +1,302 @@
|
||||
# ===========================================
|
||||
# EVOLUTION API - CONFIGURAÇÃO DE AMBIENTE
|
||||
# ===========================================
|
||||
|
||||
# ===========================================
|
||||
# SERVIDOR
|
||||
# ===========================================
|
||||
SERVER_NAME=evolution
|
||||
SERVER_TYPE=http
|
||||
SERVER_PORT=8080
|
||||
SERVER_URL=http://localhost:8080
|
||||
SERVER_DISABLE_DOCS=false
|
||||
SERVER_DISABLE_MANAGER=false
|
||||
|
||||
# ===========================================
|
||||
# CORS
|
||||
# ===========================================
|
||||
CORS_ORIGIN=*
|
||||
CORS_METHODS=POST,GET,PUT,DELETE
|
||||
CORS_CREDENTIALS=true
|
||||
|
||||
# ===========================================
|
||||
# SSL (opcional)
|
||||
# ===========================================
|
||||
SSL_CONF_PRIVKEY=
|
||||
SSL_CONF_FULLCHAIN=
|
||||
|
||||
# ===========================================
|
||||
# BANCO DE DADOS
|
||||
# ===========================================
|
||||
DATABASE_PROVIDER=postgresql
|
||||
DATABASE_CONNECTION_URI=postgresql://username:password@localhost:5432/evolution_api
|
||||
DATABASE_CONNECTION_CLIENT_NAME=evolution
|
||||
|
||||
# Configurações de salvamento de dados
|
||||
DATABASE_SAVE_DATA_INSTANCE=true
|
||||
DATABASE_SAVE_DATA_NEW_MESSAGE=true
|
||||
DATABASE_SAVE_MESSAGE_UPDATE=true
|
||||
DATABASE_SAVE_DATA_CONTACTS=true
|
||||
DATABASE_SAVE_DATA_CHATS=true
|
||||
DATABASE_SAVE_DATA_HISTORIC=true
|
||||
DATABASE_SAVE_DATA_LABELS=true
|
||||
DATABASE_SAVE_IS_ON_WHATSAPP=true
|
||||
DATABASE_SAVE_IS_ON_WHATSAPP_DAYS=7
|
||||
DATABASE_DELETE_MESSAGE=false
|
||||
|
||||
# ===========================================
|
||||
# REDIS
|
||||
# ===========================================
|
||||
CACHE_REDIS_ENABLED=true
|
||||
CACHE_REDIS_URI=redis://localhost:6379
|
||||
CACHE_REDIS_PREFIX_KEY=evolution-cache
|
||||
CACHE_REDIS_TTL=604800
|
||||
CACHE_REDIS_SAVE_INSTANCES=true
|
||||
|
||||
# Cache local (fallback)
|
||||
CACHE_LOCAL_ENABLED=true
|
||||
CACHE_LOCAL_TTL=86400
|
||||
|
||||
# ===========================================
|
||||
# AUTENTICAÇÃO
|
||||
# ===========================================
|
||||
AUTHENTICATION_API_KEY=BQYHJGJHJ
|
||||
AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=false
|
||||
|
||||
# ===========================================
|
||||
# LOGS
|
||||
# ===========================================
|
||||
LOG_LEVEL=ERROR,WARN,DEBUG,INFO,LOG,VERBOSE,DARK,WEBHOOKS,WEBSOCKET
|
||||
LOG_COLOR=true
|
||||
LOG_BAILEYS=error
|
||||
|
||||
# ===========================================
|
||||
# INSTÂNCIAS
|
||||
# ===========================================
|
||||
DEL_INSTANCE=false
|
||||
DEL_TEMP_INSTANCES=true
|
||||
|
||||
# ===========================================
|
||||
# IDIOMA
|
||||
# ===========================================
|
||||
LANGUAGE=pt-BR
|
||||
|
||||
# ===========================================
|
||||
# WEBHOOK
|
||||
# ===========================================
|
||||
WEBHOOK_GLOBAL_URL=
|
||||
WEBHOOK_GLOBAL_ENABLED=false
|
||||
WEBHOOK_GLOBAL_WEBHOOK_BY_EVENTS=false
|
||||
|
||||
# Eventos de webhook
|
||||
WEBHOOK_EVENTS_APPLICATION_STARTUP=false
|
||||
WEBHOOK_EVENTS_INSTANCE_CREATE=false
|
||||
WEBHOOK_EVENTS_INSTANCE_DELETE=false
|
||||
WEBHOOK_EVENTS_QRCODE_UPDATED=false
|
||||
WEBHOOK_EVENTS_MESSAGES_SET=false
|
||||
WEBHOOK_EVENTS_MESSAGES_UPSERT=false
|
||||
WEBHOOK_EVENTS_MESSAGES_EDITED=false
|
||||
WEBHOOK_EVENTS_MESSAGES_UPDATE=false
|
||||
WEBHOOK_EVENTS_MESSAGES_DELETE=false
|
||||
WEBHOOK_EVENTS_SEND_MESSAGE=false
|
||||
WEBHOOK_EVENTS_SEND_MESSAGE_UPDATE=false
|
||||
WEBHOOK_EVENTS_CONTACTS_SET=false
|
||||
WEBHOOK_EVENTS_CONTACTS_UPDATE=false
|
||||
WEBHOOK_EVENTS_CONTACTS_UPSERT=false
|
||||
WEBHOOK_EVENTS_PRESENCE_UPDATE=false
|
||||
WEBHOOK_EVENTS_CHATS_SET=false
|
||||
WEBHOOK_EVENTS_CHATS_UPDATE=false
|
||||
WEBHOOK_EVENTS_CHATS_UPSERT=false
|
||||
WEBHOOK_EVENTS_CHATS_DELETE=false
|
||||
WEBHOOK_EVENTS_CONNECTION_UPDATE=false
|
||||
WEBHOOK_EVENTS_LABELS_EDIT=false
|
||||
WEBHOOK_EVENTS_LABELS_ASSOCIATION=false
|
||||
WEBHOOK_EVENTS_GROUPS_UPSERT=false
|
||||
WEBHOOK_EVENTS_GROUPS_UPDATE=false
|
||||
WEBHOOK_EVENTS_GROUP_PARTICIPANTS_UPDATE=false
|
||||
WEBHOOK_EVENTS_CALL=false
|
||||
WEBHOOK_EVENTS_TYPEBOT_START=false
|
||||
WEBHOOK_EVENTS_TYPEBOT_CHANGE_STATUS=false
|
||||
WEBHOOK_EVENTS_ERRORS=false
|
||||
WEBHOOK_EVENTS_ERRORS_WEBHOOK=
|
||||
|
||||
# Configurações de webhook
|
||||
WEBHOOK_REQUEST_TIMEOUT_MS=30000
|
||||
WEBHOOK_RETRY_MAX_ATTEMPTS=10
|
||||
WEBHOOK_RETRY_INITIAL_DELAY_SECONDS=5
|
||||
WEBHOOK_RETRY_USE_EXPONENTIAL_BACKOFF=true
|
||||
WEBHOOK_RETRY_MAX_DELAY_SECONDS=300
|
||||
WEBHOOK_RETRY_JITTER_FACTOR=0.2
|
||||
WEBHOOK_RETRY_NON_RETRYABLE_STATUS_CODES=400,401,403,404,422
|
||||
|
||||
# ===========================================
|
||||
# WEBSOCKET
|
||||
# ===========================================
|
||||
WEBSOCKET_ENABLED=true
|
||||
WEBSOCKET_GLOBAL_EVENTS=true
|
||||
WEBSOCKET_ALLOWED_HOSTS=
|
||||
|
||||
# ===========================================
|
||||
# RABBITMQ
|
||||
# ===========================================
|
||||
RABBITMQ_ENABLED=false
|
||||
RABBITMQ_GLOBAL_ENABLED=false
|
||||
RABBITMQ_PREFIX_KEY=
|
||||
RABBITMQ_EXCHANGE_NAME=evolution_exchange
|
||||
RABBITMQ_URI=
|
||||
RABBITMQ_FRAME_MAX=8192
|
||||
|
||||
# ===========================================
|
||||
# NATS
|
||||
# ===========================================
|
||||
NATS_ENABLED=false
|
||||
NATS_GLOBAL_ENABLED=false
|
||||
NATS_PREFIX_KEY=
|
||||
NATS_EXCHANGE_NAME=evolution_exchange
|
||||
NATS_URI=
|
||||
|
||||
# ===========================================
|
||||
# SQS
|
||||
# ===========================================
|
||||
SQS_ENABLED=false
|
||||
SQS_GLOBAL_ENABLED=false
|
||||
SQS_GLOBAL_FORCE_SINGLE_QUEUE=false
|
||||
SQS_GLOBAL_PREFIX_NAME=global
|
||||
SQS_ACCESS_KEY_ID=
|
||||
SQS_SECRET_ACCESS_KEY=
|
||||
SQS_ACCOUNT_ID=
|
||||
SQS_REGION=
|
||||
SQS_MAX_PAYLOAD_SIZE=1048576
|
||||
|
||||
# ===========================================
|
||||
# PUSHER
|
||||
# ===========================================
|
||||
PUSHER_ENABLED=false
|
||||
PUSHER_GLOBAL_ENABLED=false
|
||||
PUSHER_GLOBAL_APP_ID=
|
||||
PUSHER_GLOBAL_KEY=
|
||||
PUSHER_GLOBAL_SECRET=
|
||||
PUSHER_GLOBAL_CLUSTER=
|
||||
PUSHER_GLOBAL_USE_TLS=false
|
||||
|
||||
# ===========================================
|
||||
# WHATSAPP BUSINESS
|
||||
# ===========================================
|
||||
WA_BUSINESS_TOKEN_WEBHOOK=evolution
|
||||
WA_BUSINESS_URL=https://graph.facebook.com
|
||||
WA_BUSINESS_VERSION=v18.0
|
||||
WA_BUSINESS_LANGUAGE=en
|
||||
|
||||
# ===========================================
|
||||
# CONFIGURAÇÕES DE SESSÃO
|
||||
# ===========================================
|
||||
CONFIG_SESSION_PHONE_CLIENT=Evolution API
|
||||
CONFIG_SESSION_PHONE_NAME=Chrome
|
||||
|
||||
# ===========================================
|
||||
# QR CODE
|
||||
# ===========================================
|
||||
QRCODE_LIMIT=30
|
||||
QRCODE_COLOR=#198754
|
||||
|
||||
# ===========================================
|
||||
# INTEGRAÇÕES
|
||||
# ===========================================
|
||||
|
||||
# Typebot
|
||||
TYPEBOT_ENABLED=false
|
||||
TYPEBOT_API_VERSION=old
|
||||
TYPEBOT_SEND_MEDIA_BASE64=false
|
||||
|
||||
# Chatwoot
|
||||
CHATWOOT_ENABLED=false
|
||||
CHATWOOT_MESSAGE_DELETE=false
|
||||
CHATWOOT_MESSAGE_READ=false
|
||||
CHATWOOT_BOT_CONTACT=true
|
||||
CHATWOOT_IMPORT_DATABASE_CONNECTION_URI=
|
||||
CHATWOOT_IMPORT_PLACEHOLDER_MEDIA_MESSAGE=false
|
||||
|
||||
# OpenAI
|
||||
OPENAI_ENABLED=false
|
||||
OPENAI_API_KEY_GLOBAL=
|
||||
|
||||
# Dify
|
||||
DIFY_ENABLED=false
|
||||
|
||||
# N8N
|
||||
N8N_ENABLED=false
|
||||
|
||||
# EvoAI
|
||||
EVOAI_ENABLED=false
|
||||
|
||||
# Flowise
|
||||
FLOWISE_ENABLED=false
|
||||
|
||||
# ===========================================
|
||||
# S3 / MINIO
|
||||
# ===========================================
|
||||
S3_ENABLED=false
|
||||
S3_ACCESS_KEY=
|
||||
S3_SECRET_KEY=
|
||||
S3_ENDPOINT=
|
||||
S3_BUCKET=
|
||||
S3_PORT=9000
|
||||
S3_USE_SSL=false
|
||||
S3_REGION=
|
||||
S3_SKIP_POLICY=false
|
||||
S3_SAVE_VIDEO=false
|
||||
|
||||
# ===========================================
|
||||
# MÉTRICAS
|
||||
# ===========================================
|
||||
PROMETHEUS_METRICS=false
|
||||
METRICS_AUTH_REQUIRED=false
|
||||
METRICS_USER=
|
||||
METRICS_PASSWORD=
|
||||
METRICS_ALLOWED_IPS=
|
||||
|
||||
# ===========================================
|
||||
# TELEMETRIA
|
||||
# ===========================================
|
||||
TELEMETRY_ENABLED=true
|
||||
TELEMETRY_URL=
|
||||
|
||||
# ===========================================
|
||||
# PROXY
|
||||
# ===========================================
|
||||
PROXY_HOST=
|
||||
PROXY_PORT=
|
||||
PROXY_PROTOCOL=
|
||||
PROXY_USERNAME=
|
||||
PROXY_PASSWORD=
|
||||
|
||||
# ===========================================
|
||||
# CONVERSOR DE ÁUDIO
|
||||
# ===========================================
|
||||
API_AUDIO_CONVERTER=
|
||||
API_AUDIO_CONVERTER_KEY=
|
||||
|
||||
# ===========================================
|
||||
# FACEBOOK
|
||||
# ===========================================
|
||||
FACEBOOK_APP_ID=
|
||||
FACEBOOK_CONFIG_ID=
|
||||
FACEBOOK_USER_TOKEN=
|
||||
|
||||
# ===========================================
|
||||
# SENTRY
|
||||
# ===========================================
|
||||
SENTRY_DSN=
|
||||
|
||||
# ===========================================
|
||||
# EVENT EMITTER
|
||||
# ===========================================
|
||||
EVENT_EMITTER_MAX_LISTENERS=50
|
||||
|
||||
# ===========================================
|
||||
# PROVIDER
|
||||
# ===========================================
|
||||
PROVIDER_ENABLED=false
|
||||
PROVIDER_HOST=
|
||||
PROVIDER_PORT=5656
|
||||
PROVIDER_PREFIX=evolution
|
||||
1
evolution-manager-v2
Submodule
1
evolution-manager-v2
Submodule
Submodule evolution-manager-v2 added at f054b9bc28
238
grafana-dashboard.json.example
Normal file
238
grafana-dashboard.json.example
Normal file
@@ -0,0 +1,238 @@
|
||||
{
|
||||
"dashboard": {
|
||||
"id": null,
|
||||
"title": "Evolution API Monitoring",
|
||||
"tags": ["evolution-api", "whatsapp", "monitoring"],
|
||||
"style": "dark",
|
||||
"timezone": "browser",
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "API Status",
|
||||
"type": "stat",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "up{job=\"evolution-api\"}",
|
||||
"legendFormat": "API Status"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"mappings": [
|
||||
{
|
||||
"options": {
|
||||
"0": {
|
||||
"text": "DOWN",
|
||||
"color": "red"
|
||||
},
|
||||
"1": {
|
||||
"text": "UP",
|
||||
"color": "green"
|
||||
}
|
||||
},
|
||||
"type": "value"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Total Instances",
|
||||
"type": "stat",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "evolution_instances_total",
|
||||
"legendFormat": "Total Instances"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Instance Status Overview",
|
||||
"type": "piechart",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum by (state) (evolution_instance_state)",
|
||||
"legendFormat": "{{ state }}"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Instances by Integration Type",
|
||||
"type": "piechart",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "sum by (integration) (evolution_instance_up)",
|
||||
"legendFormat": "{{ integration }}"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Instance Uptime",
|
||||
"type": "table",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "evolution_instance_up",
|
||||
"format": "table",
|
||||
"instant": true
|
||||
}
|
||||
],
|
||||
"transformations": [
|
||||
{
|
||||
"id": "organize",
|
||||
"options": {
|
||||
"excludeByName": {
|
||||
"Time": true,
|
||||
"__name__": true
|
||||
},
|
||||
"renameByName": {
|
||||
"instance": "Instance Name",
|
||||
"integration": "Integration Type",
|
||||
"Value": "Status"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"overrides": [
|
||||
{
|
||||
"matcher": {
|
||||
"id": "byName",
|
||||
"options": "Status"
|
||||
},
|
||||
"properties": [
|
||||
{
|
||||
"id": "mappings",
|
||||
"value": [
|
||||
{
|
||||
"options": {
|
||||
"0": {
|
||||
"text": "DOWN",
|
||||
"color": "red"
|
||||
},
|
||||
"1": {
|
||||
"text": "UP",
|
||||
"color": "green"
|
||||
}
|
||||
},
|
||||
"type": "value"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 9,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 17
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"title": "Instance Status Timeline",
|
||||
"type": "timeseries",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "evolution_instance_up",
|
||||
"legendFormat": "{{ instance }} ({{ integration }})"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineInterpolation": "stepAfter",
|
||||
"lineWidth": 2,
|
||||
"fillOpacity": 10,
|
||||
"gradientMode": "none",
|
||||
"spanNulls": false,
|
||||
"insertNulls": false,
|
||||
"showPoints": "never",
|
||||
"pointSize": 5,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
},
|
||||
"axisPlacement": "auto",
|
||||
"axisLabel": "",
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"vis": false
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"min": 0,
|
||||
"max": 1
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 26
|
||||
}
|
||||
}
|
||||
],
|
||||
"time": {
|
||||
"from": "now-1h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": "-- Grafana --",
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"refresh": "30s",
|
||||
"schemaVersion": 27,
|
||||
"version": 0,
|
||||
"links": []
|
||||
}
|
||||
}
|
||||
150
local_install.sh
Executable file
150
local_install.sh
Executable file
@@ -0,0 +1,150 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Definir cores para melhor legibilidade
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Função para log
|
||||
log() {
|
||||
echo -e "${GREEN}[INFO]${NC} $1"
|
||||
}
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
log_warning() {
|
||||
echo -e "${YELLOW}[WARNING]${NC} $1"
|
||||
}
|
||||
|
||||
# Verificar se está rodando como root
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
log_error "Este script não deve ser executado como root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verificar sistema operacional
|
||||
OS="$(uname -s)"
|
||||
case "${OS}" in
|
||||
Linux*)
|
||||
if [ ! -x "$(command -v curl)" ]; then
|
||||
log_warning "Curl não está instalado. Tentando instalar..."
|
||||
if [ -x "$(command -v apt-get)" ]; then
|
||||
sudo apt-get update && sudo apt-get install -y curl
|
||||
elif [ -x "$(command -v yum)" ]; then
|
||||
sudo yum install -y curl
|
||||
else
|
||||
log_error "Não foi possível instalar curl automaticamente. Por favor, instale manualmente."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
Darwin*)
|
||||
if [ ! -x "$(command -v curl)" ]; then
|
||||
log_error "Curl não está instalado. Por favor, instale o Xcode Command Line Tools."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
log_error "Sistema operacional não suportado: ${OS}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Verificar conexão com a internet antes de prosseguir
|
||||
if ! ping -c 1 8.8.8.8 &> /dev/null; then
|
||||
log_error "Sem conexão com a internet. Por favor, verifique sua conexão."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Adicionar verificação de espaço em disco
|
||||
REQUIRED_SPACE=1000000 # 1GB em KB
|
||||
AVAILABLE_SPACE=$(df -k . | awk 'NR==2 {print $4}')
|
||||
if [ $AVAILABLE_SPACE -lt $REQUIRED_SPACE ]; then
|
||||
log_error "Espaço em disco insuficiente. Necessário pelo menos 1GB livre."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Adicionar tratamento de erro para comandos npm
|
||||
npm_install_with_retry() {
|
||||
local max_attempts=3
|
||||
local attempt=1
|
||||
|
||||
while [ $attempt -le $max_attempts ]; do
|
||||
log "Tentativa $attempt de $max_attempts para npm install"
|
||||
if npm install; then
|
||||
return 0
|
||||
fi
|
||||
attempt=$((attempt + 1))
|
||||
[ $attempt -le $max_attempts ] && log_warning "Falha na instalação. Tentando novamente em 5 segundos..." && sleep 5
|
||||
done
|
||||
|
||||
log_error "Falha ao executar npm install após $max_attempts tentativas"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Adicionar timeout para comandos
|
||||
execute_with_timeout() {
|
||||
timeout 300 $@ || log_error "Comando excedeu o tempo limite de 5 minutos: $@"
|
||||
}
|
||||
|
||||
# Verificar se o NVM já está instalado
|
||||
if [ -d "$HOME/.nvm" ]; then
|
||||
log "NVM já está instalado."
|
||||
else
|
||||
log "Instalando NVM..."
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
||||
fi
|
||||
|
||||
# Carregar o NVM no ambiente atual
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
||||
|
||||
# Verificar se a versão do Node.js já está instalada
|
||||
if command -v node >/dev/null 2>&1 && [ "$(node -v)" = "v20.10.0" ]; then
|
||||
log "Node.js v20.10.0 já está instalado."
|
||||
else
|
||||
log "Instalando Node.js v20.10.0..."
|
||||
nvm install v20.10.0
|
||||
fi
|
||||
|
||||
nvm use v20.10.0
|
||||
|
||||
# Verificar as versões instaladas
|
||||
log "Verificando as versões instaladas:"
|
||||
log "Node.js: $(node -v)"
|
||||
log "npm: $(npm -v)"
|
||||
|
||||
# Instala dependências do projeto
|
||||
log "Instalando dependências do projeto..."
|
||||
rm -rf node_modules
|
||||
npm install
|
||||
|
||||
# Deploy do banco de dados
|
||||
log "Deploy do banco de dados..."
|
||||
npm run db:generate
|
||||
npm run db:deploy
|
||||
|
||||
# Iniciar o projeto
|
||||
log "Iniciando o projeto..."
|
||||
if [ "$1" = "-dev" ]; then
|
||||
npm run dev:server
|
||||
else
|
||||
npm run build
|
||||
npm run start:prod
|
||||
fi
|
||||
|
||||
log "Instalação concluída com sucesso!"
|
||||
|
||||
# Criar arquivo de log
|
||||
LOGFILE="./installation_log_$(date +%Y%m%d_%H%M%S).log"
|
||||
exec 1> >(tee -a "$LOGFILE")
|
||||
exec 2>&1
|
||||
|
||||
# Adicionar trap para limpeza em caso de interrupção
|
||||
cleanup() {
|
||||
log "Limpando recursos temporários..."
|
||||
# Adicione comandos de limpeza aqui
|
||||
}
|
||||
trap cleanup EXIT
|
||||
BIN
manager/dist/assets/images/evolution-logo.png
vendored
Normal file
BIN
manager/dist/assets/images/evolution-logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
485
manager/dist/assets/index-CO3NSIFj.js
vendored
Normal file
485
manager/dist/assets/index-CO3NSIFj.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
manager/dist/assets/index-DsIrum0U.css
vendored
Normal file
1
manager/dist/assets/index-DsIrum0U.css
vendored
Normal file
File diff suppressed because one or more lines are too long
14
manager/dist/index.html
vendored
Normal file
14
manager/dist/index.html
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/png" href="https://evolution-api.com/files/evo/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Evolution Manager</title>
|
||||
<script type="module" crossorigin src="/assets/index-CO3NSIFj.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DsIrum0U.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
8
manager_install.sh
Executable file
8
manager_install.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#! /bin/bash
|
||||
|
||||
cd evolution-manager-v2
|
||||
npm install
|
||||
npm run build
|
||||
cd ..
|
||||
rm -rf manager/dist
|
||||
cp -r evolution-manager-v2/dist manager/dist
|
||||
16284
package-lock.json
generated
Normal file
16284
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
161
package.json
161
package.json
@@ -1,14 +1,26 @@
|
||||
{
|
||||
"name": "evolution-api",
|
||||
"version": "1.2.1",
|
||||
"version": "2.3.7",
|
||||
"description": "Rest api for communication with WhatsApp",
|
||||
"main": "./dist/src/main.js",
|
||||
"main": "./dist/main.js",
|
||||
"type": "commonjs",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"start": "ts-node --files --transpile-only ./src/main.ts",
|
||||
"start:prod": "bash start.sh",
|
||||
"dev:server": "clear && tsnd --files --transpile-only --respawn --ignore-watch node_modules ./src/main.ts",
|
||||
"test": "clear && tsnd --files --transpile-only --respawn --ignore-watch node_modules ./test/all.test.ts"
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"start": "tsx ./src/main.ts",
|
||||
"start:prod": "node dist/main",
|
||||
"dev:server": "tsx watch ./src/main.ts",
|
||||
"test": "tsx watch ./test/all.test.ts",
|
||||
"lint": "eslint --fix --ext .ts src",
|
||||
"lint:check": "eslint --ext .ts src",
|
||||
"commit": "cz",
|
||||
"commitlint": "commitlint --edit",
|
||||
"db:generate": "node runWithProvider.js \"npx prisma generate --schema ./prisma/DATABASE_PROVIDER-schema.prisma\"",
|
||||
"db:deploy": "node runWithProvider.js \"rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate deploy --schema ./prisma/DATABASE_PROVIDER-schema.prisma\"",
|
||||
"db:deploy:win": "node runWithProvider.js \"xcopy /E /I prisma\\DATABASE_PROVIDER-migrations prisma\\migrations && npx prisma migrate deploy --schema prisma\\DATABASE_PROVIDER-schema.prisma\"",
|
||||
"db:studio": "node runWithProvider.js \"npx prisma studio --schema ./prisma/DATABASE_PROVIDER-schema.prisma\"",
|
||||
"db:migrate:dev": "node runWithProvider.js \"rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate dev --schema ./prisma/DATABASE_PROVIDER-schema.prisma && cp -r ./prisma/migrations/* ./prisma/DATABASE_PROVIDER-migrations\"",
|
||||
"db:migrate:dev:win": "node runWithProvider.js \"xcopy /E /I prisma\\DATABASE_PROVIDER-migrations prisma\\migrations && npx prisma migrate dev --schema prisma\\DATABASE_PROVIDER-schema.prisma\"",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -32,64 +44,115 @@
|
||||
],
|
||||
"author": {
|
||||
"name": "Davidson Gomes",
|
||||
"email": "contato@agenciadgcode.com"
|
||||
"email": "contato@evolution-api.com"
|
||||
},
|
||||
"license": "GPL-3.0",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/EvolutionAPI/evolution-api/issues"
|
||||
},
|
||||
"homepage": "https://github.com/EvolutionAPI/evolution-api#readme",
|
||||
"lint-staged": {
|
||||
"src/**/*.{ts,js}": [
|
||||
"eslint --fix"
|
||||
],
|
||||
"src/**/*.ts": [
|
||||
"sh -c 'tsc --noEmit'"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "cz-conventional-changelog"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@adiwajshing/keyed-db": "^0.2.4",
|
||||
"@aws-sdk/client-sqs": "^3.891.0",
|
||||
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
||||
"@figuro/chatwoot-sdk": "^1.1.16",
|
||||
"@hapi/boom": "^10.0.1",
|
||||
"@whiskeysockets/baileys": "github:DavidsonGomes/Baileys",
|
||||
"@figuro/chatwoot-sdk": "^1.1.14",
|
||||
"axios": "^1.3.5",
|
||||
"class-validator": "^0.13.2",
|
||||
"compression": "^1.7.4",
|
||||
"@paralleldrive/cuid2": "^2.2.2",
|
||||
"@prisma/client": "^6.16.2",
|
||||
"@sentry/node": "^10.12.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"amqplib": "^0.10.5",
|
||||
"audio-decode": "^2.2.3",
|
||||
"axios": "^1.7.9",
|
||||
"baileys": "7.0.0-rc.9",
|
||||
"class-validator": "^0.14.1",
|
||||
"compression": "^1.7.5",
|
||||
"cors": "^2.8.5",
|
||||
"cross-env": "^7.0.3",
|
||||
"dayjs": "^1.11.7",
|
||||
"dayjs": "^1.11.13",
|
||||
"dotenv": "^16.4.7",
|
||||
"emoji-regex": "^10.4.0",
|
||||
"eventemitter2": "^6.4.9",
|
||||
"exiftool-vendored": "^22.0.0",
|
||||
"express": "^4.18.2",
|
||||
"express": "^4.21.2",
|
||||
"express-async-errors": "^3.1.1",
|
||||
"hbs": "^4.2.0",
|
||||
"jimp": "^0.16.13",
|
||||
"join": "^3.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"fluent-ffmpeg": "^2.1.3",
|
||||
"form-data": "^4.0.1",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"fetch-socks": "^1.3.2",
|
||||
"i18next": "^23.7.19",
|
||||
"jimp": "^1.6.0",
|
||||
"json-schema": "^0.4.0",
|
||||
"jsonschema": "^1.4.1",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"link-preview-js": "^3.0.4",
|
||||
"mongoose": "^6.10.5",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"kafkajs": "^2.2.4",
|
||||
"libphonenumber-js": "^1.12.25",
|
||||
"link-preview-js": "^3.0.13",
|
||||
"long": "^5.2.3",
|
||||
"mediainfo.js": "^0.3.4",
|
||||
"mime": "^4.0.0",
|
||||
"mime-types": "^2.1.35",
|
||||
"minio": "^8.0.3",
|
||||
"multer": "^2.0.2",
|
||||
"nats": "^2.29.1",
|
||||
"node-cache": "^5.1.2",
|
||||
"node-mime-types": "^1.1.0",
|
||||
"pino": "^8.11.0",
|
||||
"proxy-agent": "^6.2.1",
|
||||
"qrcode": "^1.5.1",
|
||||
"node-cron": "^3.0.3",
|
||||
"openai": "^4.77.3",
|
||||
"pg": "^8.13.1",
|
||||
"pino": "^9.10.0",
|
||||
"prisma": "^6.1.0",
|
||||
"pusher": "^5.2.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"qrcode-terminal": "^0.12.0",
|
||||
"redis": "^4.6.5",
|
||||
"sharp": "^0.30.7",
|
||||
"uuid": "^9.0.0"
|
||||
"redis": "^4.7.0",
|
||||
"rxjs": "^7.8.2",
|
||||
"sharp": "^0.34.2",
|
||||
"socket.io": "^4.8.1",
|
||||
"socket.io-client": "^4.8.1",
|
||||
"socks-proxy-agent": "^8.0.5",
|
||||
"swagger-ui-express": "^5.0.1",
|
||||
"tsup": "^8.3.5",
|
||||
"undici": "^7.16.0",
|
||||
"uuid": "^13.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/compression": "^1.7.2",
|
||||
"@types/cors": "^2.8.13",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/jsonwebtoken": "^8.5.9",
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/qrcode": "^1.5.0",
|
||||
"@types/qrcode-terminal": "^0.12.0",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
||||
"@typescript-eslint/parser": "^5.57.1",
|
||||
"eslint": "^8.38.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"prettier": "^2.8.7",
|
||||
"ts-node-dev": "^2.0.0",
|
||||
"typescript": "^4.9.5"
|
||||
"@commitlint/cli": "^19.8.1",
|
||||
"@commitlint/config-conventional": "^19.8.1",
|
||||
"@types/compression": "^1.7.5",
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^4.17.18",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/mime": "^4.0.0",
|
||||
"@types/mime-types": "^2.1.4",
|
||||
"@types/node": "^24.5.2",
|
||||
"@types/node-cron": "^3.0.11",
|
||||
"@types/qrcode": "^1.5.5",
|
||||
"@types/qrcode-terminal": "^0.12.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.44.0",
|
||||
"@typescript-eslint/parser": "^8.44.0",
|
||||
"commitizen": "^4.3.1",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"eslint": "^8.45.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^16.1.6",
|
||||
"prettier": "^3.4.2",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"tsx": "^4.20.5",
|
||||
"typescript": "^5.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
588
prisma/mysql-migrations/20240809105427_init/migration.sql
Normal file
588
prisma/mysql-migrations/20240809105427_init/migration.sql
Normal file
@@ -0,0 +1,588 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `Instance` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`connectionStatus` ENUM('open', 'close', 'connecting') NOT NULL DEFAULT 'open',
|
||||
`ownerJid` VARCHAR(100) NULL,
|
||||
`profileName` VARCHAR(100) NULL,
|
||||
`profilePicUrl` VARCHAR(500) NULL,
|
||||
`integration` VARCHAR(100) NULL,
|
||||
`number` VARCHAR(100) NULL,
|
||||
`businessId` VARCHAR(100) NULL,
|
||||
`token` VARCHAR(255) NULL,
|
||||
`clientName` VARCHAR(100) NULL,
|
||||
`disconnectionReasonCode` INTEGER NULL,
|
||||
`disconnectionObject` JSON NULL,
|
||||
`disconnectionAt` TIMESTAMP NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NULL,
|
||||
|
||||
UNIQUE INDEX `Instance_name_key`(`name`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Session` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`sessionId` VARCHAR(191) NOT NULL,
|
||||
`creds` TEXT NULL,
|
||||
`createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
UNIQUE INDEX `Session_sessionId_key`(`sessionId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Chat` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`remoteJid` VARCHAR(100) NOT NULL,
|
||||
`labels` JSON NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Contact` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`remoteJid` VARCHAR(100) NOT NULL,
|
||||
`pushName` VARCHAR(100) NULL,
|
||||
`profilePicUrl` VARCHAR(500) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Message` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`key` JSON NOT NULL,
|
||||
`pushName` VARCHAR(100) NULL,
|
||||
`participant` VARCHAR(100) NULL,
|
||||
`messageType` VARCHAR(100) NOT NULL,
|
||||
`message` JSON NOT NULL,
|
||||
`contextInfo` JSON NULL,
|
||||
`source` ENUM('ios', 'android', 'web', 'unknown', 'desktop') NOT NULL,
|
||||
`messageTimestamp` INTEGER NOT NULL,
|
||||
`chatwootMessageId` INTEGER NULL,
|
||||
`chatwootInboxId` INTEGER NULL,
|
||||
`chatwootConversationId` INTEGER NULL,
|
||||
`chatwootContactInboxSourceId` VARCHAR(100) NULL,
|
||||
`chatwootIsRead` BOOLEAN NULL DEFAULT false,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
`typebotSessionId` VARCHAR(191) NULL,
|
||||
`openaiSessionId` VARCHAR(191) NULL,
|
||||
`webhookUrl` VARCHAR(500) NULL,
|
||||
`difySessionId` VARCHAR(191) NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `MessageUpdate` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`keyId` VARCHAR(100) NOT NULL,
|
||||
`remoteJid` VARCHAR(100) NOT NULL,
|
||||
`fromMe` BOOLEAN NOT NULL,
|
||||
`participant` VARCHAR(100) NULL,
|
||||
`pollUpdates` JSON NULL,
|
||||
`status` VARCHAR(30) NOT NULL,
|
||||
`messageId` VARCHAR(191) NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Webhook` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`url` VARCHAR(500) NOT NULL,
|
||||
`enabled` BOOLEAN NULL DEFAULT true,
|
||||
`events` JSON NULL,
|
||||
`webhookByEvents` BOOLEAN NULL DEFAULT false,
|
||||
`webhookBase64` BOOLEAN NULL DEFAULT false,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Webhook_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Chatwoot` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NULL DEFAULT true,
|
||||
`accountId` VARCHAR(100) NULL,
|
||||
`token` VARCHAR(100) NULL,
|
||||
`url` VARCHAR(500) NULL,
|
||||
`nameInbox` VARCHAR(100) NULL,
|
||||
`signMsg` BOOLEAN NULL DEFAULT false,
|
||||
`signDelimiter` VARCHAR(100) NULL,
|
||||
`number` VARCHAR(100) NULL,
|
||||
`reopenConversation` BOOLEAN NULL DEFAULT false,
|
||||
`conversationPending` BOOLEAN NULL DEFAULT false,
|
||||
`mergeBrazilContacts` BOOLEAN NULL DEFAULT false,
|
||||
`importContacts` BOOLEAN NULL DEFAULT false,
|
||||
`importMessages` BOOLEAN NULL DEFAULT false,
|
||||
`daysLimitImportMessages` INTEGER NULL,
|
||||
`organization` VARCHAR(100) NULL,
|
||||
`logo` VARCHAR(500) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Chatwoot_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Label` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`labelId` VARCHAR(100) NULL,
|
||||
`name` VARCHAR(100) NOT NULL,
|
||||
`color` VARCHAR(100) NOT NULL,
|
||||
`predefinedId` VARCHAR(100) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Label_labelId_key`(`labelId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Proxy` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT false,
|
||||
`host` VARCHAR(100) NOT NULL,
|
||||
`port` VARCHAR(100) NOT NULL,
|
||||
`protocol` VARCHAR(100) NOT NULL,
|
||||
`username` VARCHAR(100) NOT NULL,
|
||||
`password` VARCHAR(100) NOT NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Proxy_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Setting` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`rejectCall` BOOLEAN NOT NULL DEFAULT false,
|
||||
`msgCall` VARCHAR(100) NULL,
|
||||
`groupsIgnore` BOOLEAN NOT NULL DEFAULT false,
|
||||
`alwaysOnline` BOOLEAN NOT NULL DEFAULT false,
|
||||
`readMessages` BOOLEAN NOT NULL DEFAULT false,
|
||||
`readStatus` BOOLEAN NOT NULL DEFAULT false,
|
||||
`syncFullHistory` BOOLEAN NOT NULL DEFAULT false,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Setting_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Rabbitmq` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT false,
|
||||
`events` JSON NOT NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Rabbitmq_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Sqs` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT false,
|
||||
`events` JSON NOT NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Sqs_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Websocket` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT false,
|
||||
`events` JSON NOT NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Websocket_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Typebot` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT true,
|
||||
`description` VARCHAR(255) NULL,
|
||||
`url` VARCHAR(500) NOT NULL,
|
||||
`typebot` VARCHAR(100) NOT NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`triggerType` ENUM('all', 'keyword', 'none') NULL,
|
||||
`triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
|
||||
`triggerValue` VARCHAR(191) NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `TypebotSession` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`remoteJid` VARCHAR(100) NOT NULL,
|
||||
`pushName` VARCHAR(100) NULL,
|
||||
`sessionId` VARCHAR(100) NOT NULL,
|
||||
`status` ENUM('opened', 'closed', 'paused') NOT NULL,
|
||||
`prefilledVariables` JSON NULL,
|
||||
`awaitUser` BOOLEAN NOT NULL DEFAULT false,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`typebotId` VARCHAR(191) NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `TypebotSetting` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`typebotIdFallback` VARCHAR(100) NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `TypebotSetting_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Media` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`fileName` VARCHAR(500) NOT NULL,
|
||||
`type` VARCHAR(100) NOT NULL,
|
||||
`mimetype` VARCHAR(100) NOT NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`messageId` VARCHAR(191) NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Media_fileName_key`(`fileName`),
|
||||
UNIQUE INDEX `Media_messageId_key`(`messageId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `OpenaiCreds` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(255) NULL,
|
||||
`apiKey` VARCHAR(255) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `OpenaiCreds_name_key`(`name`),
|
||||
UNIQUE INDEX `OpenaiCreds_apiKey_key`(`apiKey`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `OpenaiBot` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT true,
|
||||
`description` VARCHAR(255) NULL,
|
||||
`botType` ENUM('assistant', 'chatCompletion') NOT NULL,
|
||||
`assistantId` VARCHAR(255) NULL,
|
||||
`functionUrl` VARCHAR(500) NULL,
|
||||
`model` VARCHAR(100) NULL,
|
||||
`systemMessages` JSON NULL,
|
||||
`assistantMessages` JSON NULL,
|
||||
`userMessages` JSON NULL,
|
||||
`maxTokens` INTEGER NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`triggerType` ENUM('all', 'keyword', 'none') NULL,
|
||||
`triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
|
||||
`triggerValue` VARCHAR(191) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`openaiCredsId` VARCHAR(191) NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `OpenaiSession` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`sessionId` VARCHAR(255) NOT NULL,
|
||||
`remoteJid` VARCHAR(100) NOT NULL,
|
||||
`status` ENUM('opened', 'closed', 'paused') NOT NULL,
|
||||
`awaitUser` BOOLEAN NOT NULL DEFAULT false,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`openaiBotId` VARCHAR(191) NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `OpenaiSetting` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`speechToText` BOOLEAN NULL DEFAULT false,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`openaiCredsId` VARCHAR(191) NOT NULL,
|
||||
`openaiIdFallback` VARCHAR(100) NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `OpenaiSetting_openaiCredsId_key`(`openaiCredsId`),
|
||||
UNIQUE INDEX `OpenaiSetting_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Template` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`templateId` VARCHAR(255) NOT NULL,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`template` JSON NOT NULL,
|
||||
`webhookUrl` VARCHAR(500) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Template_templateId_key`(`templateId`),
|
||||
UNIQUE INDEX `Template_name_key`(`name`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Dify` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT true,
|
||||
`description` VARCHAR(255) NULL,
|
||||
`botType` ENUM('chatBot', 'textGenerator', 'agent', 'workflow') NOT NULL,
|
||||
`apiUrl` VARCHAR(255) NULL,
|
||||
`apiKey` VARCHAR(255) NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`triggerType` ENUM('all', 'keyword', 'none') NULL,
|
||||
`triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
|
||||
`triggerValue` VARCHAR(191) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `DifySession` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`sessionId` VARCHAR(255) NOT NULL,
|
||||
`remoteJid` VARCHAR(100) NOT NULL,
|
||||
`status` ENUM('opened', 'closed', 'paused') NOT NULL,
|
||||
`awaitUser` BOOLEAN NOT NULL DEFAULT false,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`difyId` VARCHAR(191) NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `DifySetting` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`difyIdFallback` VARCHAR(100) NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `DifySetting_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Session` ADD CONSTRAINT `Session_sessionId_fkey` FOREIGN KEY (`sessionId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Chat` ADD CONSTRAINT `Chat_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Contact` ADD CONSTRAINT `Contact_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Message` ADD CONSTRAINT `Message_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Message` ADD CONSTRAINT `Message_typebotSessionId_fkey` FOREIGN KEY (`typebotSessionId`) REFERENCES `TypebotSession`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Message` ADD CONSTRAINT `Message_openaiSessionId_fkey` FOREIGN KEY (`openaiSessionId`) REFERENCES `OpenaiSession`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Message` ADD CONSTRAINT `Message_difySessionId_fkey` FOREIGN KEY (`difySessionId`) REFERENCES `DifySession`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `MessageUpdate` ADD CONSTRAINT `MessageUpdate_messageId_fkey` FOREIGN KEY (`messageId`) REFERENCES `Message`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `MessageUpdate` ADD CONSTRAINT `MessageUpdate_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Webhook` ADD CONSTRAINT `Webhook_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Chatwoot` ADD CONSTRAINT `Chatwoot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Label` ADD CONSTRAINT `Label_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Proxy` ADD CONSTRAINT `Proxy_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Setting` ADD CONSTRAINT `Setting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Rabbitmq` ADD CONSTRAINT `Rabbitmq_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Sqs` ADD CONSTRAINT `Sqs_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Websocket` ADD CONSTRAINT `Websocket_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Typebot` ADD CONSTRAINT `Typebot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `TypebotSession` ADD CONSTRAINT `TypebotSession_typebotId_fkey` FOREIGN KEY (`typebotId`) REFERENCES `Typebot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `TypebotSession` ADD CONSTRAINT `TypebotSession_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `TypebotSetting` ADD CONSTRAINT `TypebotSetting_typebotIdFallback_fkey` FOREIGN KEY (`typebotIdFallback`) REFERENCES `Typebot`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `TypebotSetting` ADD CONSTRAINT `TypebotSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Media` ADD CONSTRAINT `Media_messageId_fkey` FOREIGN KEY (`messageId`) REFERENCES `Message`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Media` ADD CONSTRAINT `Media_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `OpenaiCreds` ADD CONSTRAINT `OpenaiCreds_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `OpenaiBot` ADD CONSTRAINT `OpenaiBot_openaiCredsId_fkey` FOREIGN KEY (`openaiCredsId`) REFERENCES `OpenaiCreds`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `OpenaiBot` ADD CONSTRAINT `OpenaiBot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `OpenaiSession` ADD CONSTRAINT `OpenaiSession_openaiBotId_fkey` FOREIGN KEY (`openaiBotId`) REFERENCES `OpenaiBot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `OpenaiSession` ADD CONSTRAINT `OpenaiSession_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `OpenaiSetting` ADD CONSTRAINT `OpenaiSetting_openaiCredsId_fkey` FOREIGN KEY (`openaiCredsId`) REFERENCES `OpenaiCreds`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `OpenaiSetting` ADD CONSTRAINT `OpenaiSetting_openaiIdFallback_fkey` FOREIGN KEY (`openaiIdFallback`) REFERENCES `OpenaiBot`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `OpenaiSetting` ADD CONSTRAINT `OpenaiSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Template` ADD CONSTRAINT `Template_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Dify` ADD CONSTRAINT `Dify_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `DifySession` ADD CONSTRAINT `DifySession_difyId_fkey` FOREIGN KEY (`difyId`) REFERENCES `Dify`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `DifySession` ADD CONSTRAINT `DifySession_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `DifySetting` ADD CONSTRAINT `DifySetting_difyIdFallback_fkey` FOREIGN KEY (`difyIdFallback`) REFERENCES `Dify`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `DifySetting` ADD CONSTRAINT `DifySetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
Warnings:
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- A unique constraint covering the columns `[remoteJid,instanceId]` on the table `Contact` will be added. If there are existing duplicate values, this will fail.
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat`
|
||||
ADD COLUMN `name` VARCHAR(100) NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySession`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance`
|
||||
MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSession`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session`
|
||||
MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSession`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket`
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `Contact_remoteJid_instanceId_key` ON `Contact` (`remoteJid`, `instanceId`);
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX `Label_labelId_key` ON `Label`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot` ADD COLUMN `ignoreJids` JSON NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to drop the column `difySessionId` on the `Message` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `openaiSessionId` on the `Message` table. All the data in the column will be lost.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to drop the `DifySession` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `OpenaiSession` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `TypebotSession` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `DifySession` DROP FOREIGN KEY `DifySession_difyId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `DifySession` DROP FOREIGN KEY `DifySession_instanceId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Message` DROP FOREIGN KEY `Message_difySessionId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Message` DROP FOREIGN KEY `Message_openaiSessionId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Message` DROP FOREIGN KEY `Message_typebotSessionId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `OpenaiSession` DROP FOREIGN KEY `OpenaiSession_instanceId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `OpenaiSession` DROP FOREIGN KEY `OpenaiSession_openaiBotId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `TypebotSession` DROP FOREIGN KEY `TypebotSession_instanceId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `TypebotSession` DROP FOREIGN KEY `TypebotSession_typebotId_fkey`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Message` DROP COLUMN `difySessionId`,
|
||||
DROP COLUMN `openaiSessionId`,
|
||||
ADD COLUMN `sessionId` VARCHAR(191) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `DifySession`;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `OpenaiSession`;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `TypebotSession`;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `IntegrationSession` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`sessionId` VARCHAR(255) NOT NULL,
|
||||
`remoteJid` VARCHAR(100) NOT NULL,
|
||||
`pushName` VARCHAR(191) NULL,
|
||||
`status` ENUM('opened', 'closed', 'paused') NOT NULL,
|
||||
`awaitUser` BOOLEAN NOT NULL DEFAULT false,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
`parameters` JSON NULL,
|
||||
`openaiBotId` VARCHAR(191) NULL,
|
||||
`difyId` VARCHAR(191) NULL,
|
||||
`typebotId` VARCHAR(191) NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Message` ADD CONSTRAINT `Message_sessionId_fkey` FOREIGN KEY (`sessionId`) REFERENCES `IntegrationSession`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_openaiBotId_fkey` FOREIGN KEY (`openaiBotId`) REFERENCES `OpenaiBot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_difyId_fkey` FOREIGN KEY (`difyId`) REFERENCES `Dify`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `IntegrationSession` ADD CONSTRAINT `IntegrationSession_typebotId_fkey` FOREIGN KEY (`typebotId`) REFERENCES `Typebot`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to drop the column `difyId` on the `IntegrationSession` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `openaiBotId` on the `IntegrationSession` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `typebotId` on the `IntegrationSession` table. All the data in the column will be lost.
|
||||
- You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `IntegrationSession` DROP FOREIGN KEY `IntegrationSession_difyId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `IntegrationSession` DROP FOREIGN KEY `IntegrationSession_openaiBotId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `IntegrationSession` DROP FOREIGN KEY `IntegrationSession_typebotId_fkey`;
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX `Message_typebotSessionId_fkey` ON `Message`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify` MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IntegrationSession` DROP COLUMN `difyId`,
|
||||
DROP COLUMN `openaiBotId`,
|
||||
DROP COLUMN `typebotId`,
|
||||
ADD COLUMN `botId` VARCHAR(191) NULL,
|
||||
ADD COLUMN `context` JSON NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot` MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL,
|
||||
MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `GenericBot` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT true,
|
||||
`description` VARCHAR(255) NULL,
|
||||
`apiUrl` VARCHAR(255) NULL,
|
||||
`apiKey` VARCHAR(255) NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
|
||||
`triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
|
||||
`triggerValue` VARCHAR(191) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `GenericSetting` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`botIdFallback` VARCHAR(100) NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `GenericSetting_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Flowise` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT true,
|
||||
`description` VARCHAR(255) NULL,
|
||||
`apiUrl` VARCHAR(255) NULL,
|
||||
`apiKey` VARCHAR(255) NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
|
||||
`triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
|
||||
`triggerValue` VARCHAR(191) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `FlowiseSetting` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`flowiseIdFallback` VARCHAR(100) NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `FlowiseSetting_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `GenericBot` ADD CONSTRAINT `GenericBot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `GenericSetting` ADD CONSTRAINT `GenericSetting_botIdFallback_fkey` FOREIGN KEY (`botIdFallback`) REFERENCES `GenericBot`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `GenericSetting` ADD CONSTRAINT `GenericSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Flowise` ADD CONSTRAINT `Flowise_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `FlowiseSetting` ADD CONSTRAINT `FlowiseSetting_flowiseIdFallback_fkey` FOREIGN KEY (`flowiseIdFallback`) REFERENCES `Flowise`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `FlowiseSetting` ADD CONSTRAINT `FlowiseSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `GenericBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `GenericBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `GenericSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `GenericSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `GenericBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `GenericSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IntegrationSession` ADD COLUMN `type` VARCHAR(100) NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to drop the `GenericBot` table. If the table is not empty, all the data it contains will be lost.
|
||||
- You are about to drop the `GenericSetting` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `GenericBot` DROP FOREIGN KEY `GenericBot_instanceId_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `GenericSetting` DROP FOREIGN KEY `GenericSetting_botIdFallback_fkey`;
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `GenericSetting` DROP FOREIGN KEY `GenericSetting_instanceId_fkey`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `GenericBot`;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE `GenericSetting`;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `EvolutionBot` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT true,
|
||||
`description` VARCHAR(255) NULL,
|
||||
`apiUrl` VARCHAR(255) NULL,
|
||||
`apiKey` VARCHAR(255) NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
|
||||
`triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
|
||||
`triggerValue` VARCHAR(191) NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `EvolutionBotSetting` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`expire` INTEGER NULL DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100) NULL,
|
||||
`delayMessage` INTEGER NULL,
|
||||
`unknownMessage` VARCHAR(100) NULL,
|
||||
`listeningFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN NULL DEFAULT false,
|
||||
`keepOpen` BOOLEAN NULL DEFAULT false,
|
||||
`debounceTime` INTEGER NULL,
|
||||
`ignoreJids` JSON NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`botIdFallback` VARCHAR(100) NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `EvolutionBotSetting_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `EvolutionBot` ADD CONSTRAINT `EvolutionBot_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `EvolutionBotSetting` ADD CONSTRAINT `EvolutionBotSetting_botIdFallback_fkey` FOREIGN KEY (`botIdFallback`) REFERENCES `EvolutionBot`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `EvolutionBotSetting` ADD CONSTRAINT `EvolutionBotSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `EvolutionBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `EvolutionBotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Message` ADD COLUMN `status` INTEGER NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook` ADD COLUMN `headers` JSON NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `IsOnWhatsapp` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`remoteJid` VARCHAR(100) NOT NULL,
|
||||
`jidOptions` VARCHAR(191) NOT NULL,
|
||||
`createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
|
||||
UNIQUE INDEX `IsOnWhatsapp_remoteJid_key`(`remoteJid`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat` ADD COLUMN `unreadMessages` INTEGER NOT NULL DEFAULT 0,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `EvolutionBot` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `EvolutionBotSetting` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Flowise` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `FlowiseSetting` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IsOnWhatsapp` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Message` MODIFY `status` VARCHAR(30) NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting` ADD COLUMN `splitMessages` BOOLEAN NULL DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER NULL DEFAULT 50,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Pusher` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT false,
|
||||
`appId` VARCHAR(100) NOT NULL,
|
||||
`key` VARCHAR(100) NOT NULL,
|
||||
`secret` VARCHAR(100) NOT NULL,
|
||||
`cluster` VARCHAR(100) NOT NULL,
|
||||
`useTLS` BOOLEAN NOT NULL DEFAULT false,
|
||||
`events` JSON NOT NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Pusher_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `Chat_remoteJid_idx` ON `Chat`(`remoteJid`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `Contact_remoteJid_idx` ON `Contact`(`remoteJid`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `Setting_instanceId_idx` ON `Setting`(`instanceId`);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `Webhook_instanceId_idx` ON `Webhook`(`instanceId`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Pusher` ADD CONSTRAINT `Pusher_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- RenameIndex
|
||||
ALTER TABLE `Chat` RENAME INDEX `Chat_instanceId_fkey` TO `Chat_instanceId_idx`;
|
||||
|
||||
-- RenameIndex
|
||||
ALTER TABLE `Contact` RENAME INDEX `Contact_instanceId_fkey` TO `Contact_instanceId_idx`;
|
||||
|
||||
-- RenameIndex
|
||||
ALTER TABLE `Message` RENAME INDEX `Message_instanceId_fkey` TO `Message_instanceId_idx`;
|
||||
|
||||
-- RenameIndex
|
||||
ALTER TABLE `MessageUpdate` RENAME INDEX `MessageUpdate_instanceId_fkey` TO `MessageUpdate_instanceId_idx`;
|
||||
|
||||
-- RenameIndex
|
||||
ALTER TABLE `MessageUpdate` RENAME INDEX `MessageUpdate_messageId_fkey` TO `MessageUpdate_messageId_idx`;
|
||||
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Pusher` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Pusher` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- A unique constraint covering the columns `[instanceId,remoteJid]` on the table `Chat` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `EvolutionBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `EvolutionBotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IsOnWhatsapp` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Pusher` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting` ADD COLUMN `wavoipToken` VARCHAR(100) NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `Chat_instanceId_remoteJid_key` ON `Chat`(`instanceId`, `remoteJid`);
|
||||
@@ -0,0 +1,17 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `Nats` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT false,
|
||||
`events` JSON NOT NULL,
|
||||
`createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `Nats_instanceId_key` ON `Nats`(`instanceId`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Nats` ADD CONSTRAINT `Nats_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[remoteJid,instanceId]` on the table `Chat` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
|
||||
-- AlterTable
|
||||
SET @column_exists := (
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = DATABASE()
|
||||
AND table_name = 'Setting'
|
||||
AND column_name = 'wavoipToken'
|
||||
);
|
||||
|
||||
SET @sql := IF(@column_exists = 0,
|
||||
'ALTER TABLE Setting ADD COLUMN wavoipToken VARCHAR(100);',
|
||||
'SELECT "Column already exists";'
|
||||
);
|
||||
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
ALTER TABLE Chat ADD CONSTRAINT unique_remote_instance UNIQUE (remoteJid, instanceId);
|
||||
@@ -0,0 +1,62 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `N8n` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT true,
|
||||
`description` VARCHAR(255),
|
||||
`webhookUrl` VARCHAR(255),
|
||||
`basicAuthUser` VARCHAR(255),
|
||||
`basicAuthPass` VARCHAR(255),
|
||||
`expire` INTEGER DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100),
|
||||
`delayMessage` INTEGER,
|
||||
`unknownMessage` VARCHAR(100),
|
||||
`listeningFromMe` BOOLEAN DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN DEFAULT false,
|
||||
`keepOpen` BOOLEAN DEFAULT false,
|
||||
`debounceTime` INTEGER,
|
||||
`ignoreJids` JSON,
|
||||
`splitMessages` BOOLEAN DEFAULT false,
|
||||
`timePerChar` INTEGER DEFAULT 50,
|
||||
`triggerType` ENUM('all', 'keyword', 'none') NULL,
|
||||
`triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
|
||||
`triggerValue` VARCHAR(191) NULL,
|
||||
`createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `N8nSetting` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`expire` INTEGER DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100),
|
||||
`delayMessage` INTEGER,
|
||||
`unknownMessage` VARCHAR(100),
|
||||
`listeningFromMe` BOOLEAN DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN DEFAULT false,
|
||||
`keepOpen` BOOLEAN DEFAULT false,
|
||||
`debounceTime` INTEGER,
|
||||
`ignoreJids` JSON,
|
||||
`splitMessages` BOOLEAN DEFAULT false,
|
||||
`timePerChar` INTEGER DEFAULT 50,
|
||||
`createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`n8nIdFallback` VARCHAR(100),
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `N8nSetting_instanceId_key` ON `N8nSetting`(`instanceId`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `N8n` ADD CONSTRAINT `N8n_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `N8nSetting` ADD CONSTRAINT `N8nSetting_n8nIdFallback_fkey` FOREIGN KEY (`n8nIdFallback`) REFERENCES `N8n`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `N8nSetting` ADD CONSTRAINT `N8nSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,61 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `Evoai` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT true,
|
||||
`description` VARCHAR(255),
|
||||
`agentUrl` VARCHAR(255),
|
||||
`apiKey` VARCHAR(255),
|
||||
`expire` INTEGER DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100),
|
||||
`delayMessage` INTEGER,
|
||||
`unknownMessage` VARCHAR(100),
|
||||
`listeningFromMe` BOOLEAN DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN DEFAULT false,
|
||||
`keepOpen` BOOLEAN DEFAULT false,
|
||||
`debounceTime` INTEGER,
|
||||
`ignoreJids` JSON,
|
||||
`splitMessages` BOOLEAN DEFAULT false,
|
||||
`timePerChar` INTEGER DEFAULT 50,
|
||||
`triggerType` ENUM('all', 'keyword', 'none') NULL,
|
||||
`triggerOperator` ENUM('contains', 'equals', 'startsWith', 'endsWith', 'regex') NULL,
|
||||
`triggerValue` VARCHAR(191) NULL,
|
||||
`createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `EvoaiSetting` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`expire` INTEGER DEFAULT 0,
|
||||
`keywordFinish` VARCHAR(100),
|
||||
`delayMessage` INTEGER,
|
||||
`unknownMessage` VARCHAR(100),
|
||||
`listeningFromMe` BOOLEAN DEFAULT false,
|
||||
`stopBotFromMe` BOOLEAN DEFAULT false,
|
||||
`keepOpen` BOOLEAN DEFAULT false,
|
||||
`debounceTime` INTEGER,
|
||||
`ignoreJids` JSON,
|
||||
`splitMessages` BOOLEAN DEFAULT false,
|
||||
`timePerChar` INTEGER DEFAULT 50,
|
||||
`createdAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`evoaiIdFallback` VARCHAR(100),
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX `EvoaiSetting_instanceId_key` ON `EvoaiSetting`(`instanceId`);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Evoai` ADD CONSTRAINT `Evoai_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `EvoaiSetting` ADD CONSTRAINT `EvoaiSetting_evoaiIdFallback_fkey` FOREIGN KEY (`evoaiIdFallback`) REFERENCES `Evoai`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `EvoaiSetting` ADD CONSTRAINT `EvoaiSetting_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- DropIndex
|
||||
ALTER TABLE `Media` DROP INDEX `Media_fileName_key`;
|
||||
@@ -0,0 +1,7 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` ADD COLUMN `splitMessages` BOOLEAN DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER DEFAULT 50;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` ADD COLUMN `splitMessages` BOOLEAN DEFAULT false,
|
||||
ADD COLUMN `timePerChar` INTEGER DEFAULT 50;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `IsOnWhatsapp` ADD COLUMN `lid` VARCHAR(100);
|
||||
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `createdAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chat` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Chatwoot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Contact` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Dify` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `DifySetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Evoai` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Evoai` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `EvoaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `EvoaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `EvolutionBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `EvolutionBotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Flowise` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `FlowiseSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `disconnectionAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Instance` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IntegrationSession` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to drop the column `lid` on the `IsOnWhatsapp` table. All the data in the column will be lost.
|
||||
- You are about to alter the column `createdAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `IsOnWhatsapp` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Label` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Media` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `N8n` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `N8n` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `N8nSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `N8nSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Nats` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Nats` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiBot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiCreds` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `OpenaiSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Proxy` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Pusher` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Pusher` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Rabbitmq` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Session` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Setting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Sqs` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Template` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to drop the column `splitMessages` on the `Typebot` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `timePerChar` on the `Typebot` table. All the data in the column will be lost.
|
||||
- You are about to alter the column `createdAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Typebot` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to drop the column `splitMessages` on the `TypebotSetting` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `timePerChar` on the `TypebotSetting` table. All the data in the column will be lost.
|
||||
- You are about to alter the column `createdAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `TypebotSetting` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Webhook` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `createdAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
- You are about to alter the column `updatedAt` on the `Websocket` table. The data in that column could be lost. The data in that column will be cast from `Timestamp(0)` to `Timestamp`.
|
||||
|
||||
*/
|
||||
-- DropIndex
|
||||
DROP INDEX `unique_remote_instance` ON `Chat`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chat` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Chatwoot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Contact` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Dify` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `DifySetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Evoai` MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `EvoaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `EvolutionBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `EvolutionBotSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Flowise` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `FlowiseSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Instance` MODIFY `disconnectionAt` TIMESTAMP NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IntegrationSession` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `IsOnWhatsapp` DROP COLUMN `lid`,
|
||||
MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Label` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Media` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `N8n` MODIFY `triggerType` ENUM('all', 'keyword', 'none', 'advanced') NULL,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `N8nSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Nats` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiBot` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiCreds` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `OpenaiSetting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Proxy` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Pusher` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Rabbitmq` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Session` MODIFY `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Setting` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Sqs` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Template` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Typebot` DROP COLUMN `splitMessages`,
|
||||
DROP COLUMN `timePerChar`,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `TypebotSetting` DROP COLUMN `splitMessages`,
|
||||
DROP COLUMN `timePerChar`,
|
||||
MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Webhook` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Websocket` MODIFY `createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
MODIFY `updatedAt` TIMESTAMP NOT NULL;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `Kafka` (
|
||||
`id` VARCHAR(191) NOT NULL,
|
||||
`enabled` BOOLEAN NOT NULL DEFAULT false,
|
||||
`events` JSON NOT NULL,
|
||||
`createdAt` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` TIMESTAMP NOT NULL,
|
||||
`instanceId` VARCHAR(191) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Kafka_instanceId_key`(`instanceId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Kafka` ADD CONSTRAINT `Kafka_instanceId_fkey` FOREIGN KEY (`instanceId`) REFERENCES `Instance`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
3
prisma/mysql-migrations/migration_lock.toml
Normal file
3
prisma/mysql-migrations/migration_lock.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "mysql"
|
||||
757
prisma/mysql-schema.prisma
Normal file
757
prisma/mysql-schema.prisma
Normal file
@@ -0,0 +1,757 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "mysql"
|
||||
url = env("DATABASE_CONNECTION_URI")
|
||||
}
|
||||
|
||||
enum InstanceConnectionStatus {
|
||||
open
|
||||
close
|
||||
connecting
|
||||
}
|
||||
|
||||
enum DeviceMessage {
|
||||
ios
|
||||
android
|
||||
web
|
||||
unknown
|
||||
desktop
|
||||
}
|
||||
|
||||
enum SessionStatus {
|
||||
opened
|
||||
closed
|
||||
paused
|
||||
}
|
||||
|
||||
enum TriggerType {
|
||||
all
|
||||
keyword
|
||||
none
|
||||
advanced
|
||||
}
|
||||
|
||||
enum TriggerOperator {
|
||||
contains
|
||||
equals
|
||||
startsWith
|
||||
endsWith
|
||||
regex
|
||||
}
|
||||
|
||||
enum OpenaiBotType {
|
||||
assistant
|
||||
chatCompletion
|
||||
}
|
||||
|
||||
enum DifyBotType {
|
||||
chatBot
|
||||
textGenerator
|
||||
agent
|
||||
workflow
|
||||
}
|
||||
|
||||
model Instance {
|
||||
id String @id @default(cuid())
|
||||
name String @unique @db.VarChar(255)
|
||||
connectionStatus InstanceConnectionStatus @default(open)
|
||||
ownerJid String? @db.VarChar(100)
|
||||
profileName String? @db.VarChar(100)
|
||||
profilePicUrl String? @db.VarChar(500)
|
||||
integration String? @db.VarChar(100)
|
||||
number String? @db.VarChar(100)
|
||||
businessId String? @db.VarChar(100)
|
||||
token String? @db.VarChar(255)
|
||||
clientName String? @db.VarChar(100)
|
||||
disconnectionReasonCode Int? @db.Int
|
||||
disconnectionObject Json? @db.Json
|
||||
disconnectionAt DateTime? @db.Timestamp
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
Chat Chat[]
|
||||
Contact Contact[]
|
||||
Message Message[]
|
||||
Webhook Webhook?
|
||||
Chatwoot Chatwoot?
|
||||
Label Label[]
|
||||
Proxy Proxy?
|
||||
Setting Setting?
|
||||
Rabbitmq Rabbitmq?
|
||||
Nats Nats?
|
||||
Sqs Sqs?
|
||||
Kafka Kafka?
|
||||
Websocket Websocket?
|
||||
Typebot Typebot[]
|
||||
Session Session?
|
||||
MessageUpdate MessageUpdate[]
|
||||
TypebotSetting TypebotSetting?
|
||||
Media Media[]
|
||||
OpenaiCreds OpenaiCreds[]
|
||||
OpenaiBot OpenaiBot[]
|
||||
OpenaiSetting OpenaiSetting?
|
||||
Template Template[]
|
||||
Dify Dify[]
|
||||
DifySetting DifySetting?
|
||||
IntegrationSession IntegrationSession[]
|
||||
EvolutionBot EvolutionBot[]
|
||||
EvolutionBotSetting EvolutionBotSetting?
|
||||
Flowise Flowise[]
|
||||
FlowiseSetting FlowiseSetting?
|
||||
N8n N8n[]
|
||||
N8nSetting N8nSetting?
|
||||
Evoai Evoai[]
|
||||
EvoaiSetting EvoaiSetting?
|
||||
Pusher Pusher?
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
sessionId String @unique
|
||||
creds String? @db.Text
|
||||
createdAt DateTime @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
Instance Instance @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Chat {
|
||||
id String @id @default(cuid())
|
||||
remoteJid String @db.VarChar(100)
|
||||
name String? @db.VarChar(100)
|
||||
labels Json? @db.Json
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
unreadMessages Int @default(0)
|
||||
|
||||
@@unique([instanceId, remoteJid])
|
||||
@@index([instanceId])
|
||||
@@index([remoteJid])
|
||||
}
|
||||
|
||||
model Contact {
|
||||
id String @id @default(cuid())
|
||||
remoteJid String @db.VarChar(100)
|
||||
pushName String? @db.VarChar(100)
|
||||
profilePicUrl String? @db.VarChar(500)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
|
||||
@@unique([remoteJid, instanceId])
|
||||
@@index([remoteJid])
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model Message {
|
||||
id String @id @default(cuid())
|
||||
key Json @db.Json
|
||||
pushName String? @db.VarChar(100)
|
||||
participant String? @db.VarChar(100)
|
||||
messageType String @db.VarChar(100)
|
||||
message Json @db.Json
|
||||
contextInfo Json? @db.Json
|
||||
source DeviceMessage
|
||||
messageTimestamp Int @db.Int
|
||||
chatwootMessageId Int? @db.Int
|
||||
chatwootInboxId Int? @db.Int
|
||||
chatwootConversationId Int? @db.Int
|
||||
chatwootContactInboxSourceId String? @db.VarChar(100)
|
||||
chatwootIsRead Boolean? @default(false)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
typebotSessionId String?
|
||||
MessageUpdate MessageUpdate[]
|
||||
Media Media?
|
||||
webhookUrl String? @db.VarChar(500)
|
||||
status String? @db.VarChar(30)
|
||||
|
||||
sessionId String?
|
||||
session IntegrationSession? @relation(fields: [sessionId], references: [id])
|
||||
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model MessageUpdate {
|
||||
id String @id @default(cuid())
|
||||
keyId String @db.VarChar(100)
|
||||
remoteJid String @db.VarChar(100)
|
||||
fromMe Boolean
|
||||
participant String? @db.VarChar(100)
|
||||
pollUpdates Json? @db.Json
|
||||
status String @db.VarChar(30)
|
||||
Message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
|
||||
messageId String
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
|
||||
@@index([instanceId])
|
||||
@@index([messageId])
|
||||
}
|
||||
|
||||
model Webhook {
|
||||
id String @id @default(cuid())
|
||||
url String @db.VarChar(500)
|
||||
headers Json? @db.Json
|
||||
enabled Boolean? @default(true)
|
||||
events Json? @db.Json
|
||||
webhookByEvents Boolean? @default(false)
|
||||
webhookBase64 Boolean? @default(false)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model Chatwoot {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean? @default(true)
|
||||
accountId String? @db.VarChar(100)
|
||||
token String? @db.VarChar(100)
|
||||
url String? @db.VarChar(500)
|
||||
nameInbox String? @db.VarChar(100)
|
||||
signMsg Boolean? @default(false)
|
||||
signDelimiter String? @db.VarChar(100)
|
||||
number String? @db.VarChar(100)
|
||||
reopenConversation Boolean? @default(false)
|
||||
conversationPending Boolean? @default(false)
|
||||
mergeBrazilContacts Boolean? @default(false)
|
||||
importContacts Boolean? @default(false)
|
||||
importMessages Boolean? @default(false)
|
||||
daysLimitImportMessages Int? @db.Int
|
||||
organization String? @db.VarChar(100)
|
||||
logo String? @db.VarChar(500)
|
||||
ignoreJids Json?
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Label {
|
||||
id String @id @default(cuid())
|
||||
labelId String? @db.VarChar(100)
|
||||
name String @db.VarChar(100)
|
||||
color String @db.VarChar(100)
|
||||
predefinedId String? @db.VarChar(100)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model Proxy {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false)
|
||||
host String @db.VarChar(100)
|
||||
port String @db.VarChar(100)
|
||||
protocol String @db.VarChar(100)
|
||||
username String @db.VarChar(100)
|
||||
password String @db.VarChar(100)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Setting {
|
||||
id String @id @default(cuid())
|
||||
rejectCall Boolean @default(false)
|
||||
msgCall String? @db.VarChar(100)
|
||||
groupsIgnore Boolean @default(false)
|
||||
alwaysOnline Boolean @default(false)
|
||||
readMessages Boolean @default(false)
|
||||
readStatus Boolean @default(false)
|
||||
syncFullHistory Boolean @default(false)
|
||||
wavoipToken String? @db.VarChar(100)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
|
||||
@@index([instanceId])
|
||||
}
|
||||
|
||||
model Rabbitmq {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false)
|
||||
events Json @db.Json
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Nats {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false)
|
||||
events Json @db.Json
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Sqs {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false)
|
||||
events Json @db.Json
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Kafka {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false)
|
||||
events Json @db.Json
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Websocket {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false)
|
||||
events Json @db.Json
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Pusher {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(false)
|
||||
appId String @db.VarChar(100)
|
||||
key String @db.VarChar(100)
|
||||
secret String @db.VarChar(100)
|
||||
cluster String @db.VarChar(100)
|
||||
useTLS Boolean @default(false)
|
||||
events Json @db.Json
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Typebot {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true)
|
||||
description String? @db.VarChar(255)
|
||||
url String @db.VarChar(500)
|
||||
typebot String @db.VarChar(100)
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime? @updatedAt @db.Timestamp
|
||||
ignoreJids Json?
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
TypebotSetting TypebotSetting[]
|
||||
}
|
||||
|
||||
model TypebotSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
typebotIdFallback String? @db.VarChar(100)
|
||||
ignoreJids Json?
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback Typebot? @relation(fields: [typebotIdFallback], references: [id])
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model IntegrationSession {
|
||||
id String @id @default(cuid())
|
||||
sessionId String @db.VarChar(255)
|
||||
remoteJid String @db.VarChar(100)
|
||||
pushName String?
|
||||
status SessionStatus
|
||||
awaitUser Boolean @default(false)
|
||||
context Json?
|
||||
type String? @db.VarChar(100)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Message Message[]
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
parameters Json?
|
||||
|
||||
botId String?
|
||||
}
|
||||
|
||||
model Media {
|
||||
id String @id @default(cuid())
|
||||
fileName String @db.VarChar(500)
|
||||
type String @db.VarChar(100)
|
||||
mimetype String @db.VarChar(100)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
Message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
|
||||
messageId String @unique
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model OpenaiCreds {
|
||||
id String @id @default(cuid())
|
||||
name String? @unique @db.VarChar(255)
|
||||
apiKey String? @unique @db.VarChar(255)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
OpenaiAssistant OpenaiBot[]
|
||||
OpenaiSetting OpenaiSetting?
|
||||
}
|
||||
|
||||
model OpenaiBot {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true)
|
||||
description String? @db.VarChar(255)
|
||||
botType OpenaiBotType
|
||||
assistantId String? @db.VarChar(255)
|
||||
functionUrl String? @db.VarChar(500)
|
||||
model String? @db.VarChar(100)
|
||||
systemMessages Json? @db.Json
|
||||
assistantMessages Json? @db.Json
|
||||
userMessages Json? @db.Json
|
||||
maxTokens Int? @db.Int
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
OpenaiCreds OpenaiCreds @relation(fields: [openaiCredsId], references: [id], onDelete: Cascade)
|
||||
openaiCredsId String
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
OpenaiSetting OpenaiSetting[]
|
||||
}
|
||||
|
||||
model OpenaiSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
speechToText Boolean? @default(false)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
OpenaiCreds OpenaiCreds? @relation(fields: [openaiCredsId], references: [id])
|
||||
openaiCredsId String @unique
|
||||
Fallback OpenaiBot? @relation(fields: [openaiIdFallback], references: [id])
|
||||
openaiIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Template {
|
||||
id String @id @default(cuid())
|
||||
templateId String @unique @db.VarChar(255)
|
||||
name String @unique @db.VarChar(255)
|
||||
template Json @db.Json
|
||||
webhookUrl String? @db.VarChar(500)
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model Dify {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true)
|
||||
description String? @db.VarChar(255)
|
||||
botType DifyBotType
|
||||
apiUrl String? @db.VarChar(255)
|
||||
apiKey String? @db.VarChar(255)
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
DifySetting DifySetting[]
|
||||
}
|
||||
|
||||
model DifySetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback Dify? @relation(fields: [difyIdFallback], references: [id])
|
||||
difyIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model EvolutionBot {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true)
|
||||
description String? @db.VarChar(255)
|
||||
apiUrl String? @db.VarChar(255)
|
||||
apiKey String? @db.VarChar(255)
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
EvolutionBotSetting EvolutionBotSetting[]
|
||||
}
|
||||
|
||||
model EvolutionBotSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback EvolutionBot? @relation(fields: [botIdFallback], references: [id])
|
||||
botIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Flowise {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true)
|
||||
description String? @db.VarChar(255)
|
||||
apiUrl String? @db.VarChar(255)
|
||||
apiKey String? @db.VarChar(255)
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
FlowiseSetting FlowiseSetting[]
|
||||
}
|
||||
|
||||
model FlowiseSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback Flowise? @relation(fields: [flowiseIdFallback], references: [id])
|
||||
flowiseIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model IsOnWhatsapp {
|
||||
id String @id @default(cuid())
|
||||
remoteJid String @unique @db.VarChar(100)
|
||||
jidOptions String
|
||||
createdAt DateTime @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
}
|
||||
|
||||
model N8n {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true) @db.TinyInt()
|
||||
description String? @db.VarChar(255)
|
||||
webhookUrl String? @db.VarChar(255)
|
||||
basicAuthUser String? @db.VarChar(255)
|
||||
basicAuthPass String? @db.VarChar(255)
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
N8nSetting N8nSetting[]
|
||||
}
|
||||
|
||||
model N8nSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback N8n? @relation(fields: [n8nIdFallback], references: [id])
|
||||
n8nIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Evoai {
|
||||
id String @id @default(cuid())
|
||||
enabled Boolean @default(true) @db.TinyInt()
|
||||
description String? @db.VarChar(255)
|
||||
agentUrl String? @db.VarChar(255)
|
||||
apiKey String? @db.VarChar(255)
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
triggerType TriggerType?
|
||||
triggerOperator TriggerOperator?
|
||||
triggerValue String?
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String
|
||||
EvoaiSetting EvoaiSetting[]
|
||||
}
|
||||
|
||||
model EvoaiSetting {
|
||||
id String @id @default(cuid())
|
||||
expire Int? @default(0) @db.Int
|
||||
keywordFinish String? @db.VarChar(100)
|
||||
delayMessage Int? @db.Int
|
||||
unknownMessage String? @db.VarChar(100)
|
||||
listeningFromMe Boolean? @default(false)
|
||||
stopBotFromMe Boolean? @default(false)
|
||||
keepOpen Boolean? @default(false)
|
||||
debounceTime Int? @db.Int
|
||||
ignoreJids Json?
|
||||
splitMessages Boolean? @default(false)
|
||||
timePerChar Int? @default(50) @db.Int
|
||||
createdAt DateTime? @default(dbgenerated("CURRENT_TIMESTAMP")) @db.Timestamp
|
||||
updatedAt DateTime @updatedAt @db.Timestamp
|
||||
Fallback Evoai? @relation(fields: [evoaiIdFallback], references: [id])
|
||||
evoaiIdFallback String? @db.VarChar(100)
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user