@greatapps/greatagents 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/package.json +1 -1
  2. package/src/modules/objectives/index.js +1 -1
  3. package/src/modules/objectives/properties.js +8 -7
  4. package/src/product.js +1 -25
  5. package/docs/ERD_GAGents_Database.mmd +0 -331
  6. package/scripts/MIGRATION_COMPLETE_DOCUMENTATION.md +0 -672
  7. package/scripts/README.md +0 -165
  8. package/scripts/constraints.sql +0 -585
  9. package/scripts/indexes.sql +0 -661
  10. package/scripts/migrate_v1.sql +0 -1225
  11. package/scripts/tables/001_accounts.sql +0 -51
  12. package/scripts/tables/002_users.sql +0 -69
  13. package/scripts/tables/003_people.sql +0 -70
  14. package/scripts/tables/004_tags.sql +0 -62
  15. package/scripts/tables/005_credentials.sql +0 -79
  16. package/scripts/tables/006_agents.sql +0 -70
  17. package/scripts/tables/007_tools.sql +0 -68
  18. package/scripts/tables/008_channels.sql +0 -75
  19. package/scripts/tables/009_leads.sql +0 -85
  20. package/scripts/tables/010_missions.sql +0 -62
  21. package/scripts/tables/011_objectives.sql +0 -68
  22. package/scripts/tables/012_conversations.sql +0 -80
  23. package/scripts/tables/013_objectives_tools.sql +0 -66
  24. package/scripts/tables/014_messages.sql +0 -78
  25. package/scripts/tables/015_companies.sql +0 -77
  26. package/scripts/tables/016_conversations_tags.sql +0 -64
  27. package/scripts/tables/017_leads_tags.sql +0 -64
  28. package/scripts/triggers.sql +0 -497
  29. package/src/modules/channels/index.js +0 -10
  30. package/src/modules/channels/properties.js +0 -150
  31. package/src/modules/companies/index.js +0 -10
  32. package/src/modules/companies/properties.js +0 -168
  33. package/src/modules/conversations/index.js +0 -10
  34. package/src/modules/conversations/properties.js +0 -163
  35. package/src/modules/conversations_tags/index.js +0 -10
  36. package/src/modules/conversations_tags/properties.js +0 -84
  37. package/src/modules/credentials/index.js +0 -10
  38. package/src/modules/credentials/properties.js +0 -271
  39. package/src/modules/leads/index.js +0 -10
  40. package/src/modules/leads/properties.js +0 -193
  41. package/src/modules/leads_tags/index.js +0 -10
  42. package/src/modules/leads_tags/properties.js +0 -84
  43. package/src/modules/messages/index.js +0 -10
  44. package/src/modules/messages/properties.js +0 -152
  45. package/src/modules/missions/index.js +0 -10
  46. package/src/modules/missions/properties.js +0 -101
  47. package/src/modules/objectives_tools/index.js +0 -10
  48. package/src/modules/objectives_tools/properties.js +0 -109
  49. package/src/modules/people/index.js +0 -10
  50. package/src/modules/people/properties.js +0 -161
  51. package/src/modules/tags/index.js +0 -10
  52. package/src/modules/tags/properties.js +0 -80
  53. package/src/modules/tools/index.js +0 -10
  54. package/src/modules/tools/properties.js +0 -121
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatapps/greatagents",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Schemas para GreatAgents",
5
5
  "main": "./src/product.js",
6
6
  "type": "module"
@@ -4,7 +4,7 @@ export default {
4
4
  product: "greatagents",
5
5
  name: "objectives",
6
6
  cache: { ttlView: 30, ttlList: 0 },
7
- params: ["id_account", "id_agent", "id_mission"],
7
+ params: [ "id_account", "id_agent" ],
8
8
  properties: properties,
9
9
  routes: {}
10
10
  };
@@ -45,23 +45,24 @@ export const properties = {
45
45
  disabled: true
46
46
  }
47
47
  },
48
- id_mission: {
48
+ id_agent: {
49
49
  type: "number",
50
- filterable: true,
51
50
  required: true,
51
+ updatable: false,
52
+ filterable: true,
52
53
  index: true,
53
54
  reference: {
54
- module: "missions",
55
+ module: "agents",
55
56
  label: "title",
56
57
  value: "id",
57
- disabled: true
58
58
  },
59
59
  interface: {
60
60
  label: {
61
- "pt-br": "ID da missão",
62
- "en": "Mission ID"
61
+ "pt-br": "Agente",
62
+ "en": "Agent"
63
63
  },
64
- component: "number"
64
+ component: "select",
65
+ disabled: true
65
66
  }
66
67
  },
67
68
  order: {
package/src/product.js CHANGED
@@ -3,19 +3,7 @@
3
3
  import accounts from './modules/accounts/index.js';
4
4
  import users from './modules/users/index.js';
5
5
  import agents from './modules/agents/index.js';
6
- import channels from './modules/channels/index.js';
7
- import companies from './modules/companies/index.js';
8
- import conversations from './modules/conversations/index.js';
9
- import conversations_tags from './modules/conversations_tags/index.js';
10
- import credentials from './modules/credentials/index.js';
11
- import leads from './modules/leads/index.js';
12
- import leads_tags from './modules/leads_tags/index.js';
13
- import messages from './modules/messages/index.js';
14
- import missions from './modules/missions/index.js';
15
6
  import objectives from './modules/objectives/index.js';
16
- import objectives_tools from './modules/objectives_tools/index.js';
17
- import tags from './modules/tags/index.js';
18
- import tools from './modules/tools/index.js';
19
7
 
20
8
  /* Shared */
21
9
 
@@ -43,19 +31,7 @@ export default {
43
31
  accounts,
44
32
  users,
45
33
  agents,
46
- channels,
47
- companies,
48
- conversations,
49
- conversations_tags,
50
- credentials,
51
- leads,
52
- leads_tags,
53
- messages,
54
- missions,
55
- objectives,
56
- objectives_tools,
57
- tags,
58
- tools
34
+ objectives
59
35
  },
60
36
  documentation: {
61
37
  title: "GreatAgents API",
@@ -1,331 +0,0 @@
1
- %%{init: {
2
- 'title': 'GAGents Database - Entity Relationship Diagram',
3
- 'theme': 'base',
4
- 'themeVariables': {
5
- 'primaryColor': '#2E86AB',
6
- 'primaryTextColor': '#000000',
7
- 'primaryBorderColor': '#A23B72',
8
- 'lineColor': '#F18F01',
9
- 'sectionBkgColor': '#A23B72',
10
- 'altSectionBkgColor': '#C73E1D'
11
- }
12
- }}%%
13
-
14
- erDiagram
15
-
16
- accounts {
17
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
18
- VARCHAR(100) name "searchable, maxLength=100"
19
- BOOLEAN deleted "DEFAULT false"
20
- TIMESTAMP datetime_add "filterable, updatable=false"
21
- TIMESTAMP datetime_alt "filterable"
22
- TIMESTAMP datetime_del "filterable"
23
- }
24
-
25
- users {
26
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
27
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
28
- VARCHAR(50) name "searchable, maxLength=50"
29
- VARCHAR last_name "searchable"
30
- VARCHAR email "NOT NULL, searchable, filterable, format=email"
31
- VARCHAR profile "DEFAULT 'collaborator'"
32
- IMAGE photo "types=[png,jpg,jpeg,gif,svg,webp], storage=gapps-r1-storage, 160x160"
33
- BOOLEAN deleted "DEFAULT false"
34
- TIMESTAMP datetime_add "filterable, updatable=false"
35
- TIMESTAMP datetime_alt "filterable"
36
- TIMESTAMP datetime_del "filterable"
37
- }
38
-
39
- people {
40
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
41
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
42
- VARCHAR(255) full_name "searchable, maxLength=255"
43
- VARCHAR(255) first_name "searchable, maxLength=255"
44
- VARCHAR(255) last_name "searchable, maxLength=255"
45
- IMAGE photo "types=[png,jpg,jpeg,gif,svg,webp], storage=gpages, 200x200"
46
- VARCHAR(50) document "searchable, maxLength=50"
47
- DATE birth_date "filterable"
48
- BOOLEAN deleted "DEFAULT false, filterable"
49
- TIMESTAMP datetime_add "filterable, updatable=false"
50
- TIMESTAMP datetime_alt "filterable"
51
- TIMESTAMP datetime_del "filterable"
52
- }
53
-
54
- tags {
55
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
56
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
57
- VARCHAR(255) name "NOT NULL, searchable, filterable, maxLength=255"
58
- VARCHAR color "DEFAULT '#000000', filterable"
59
- BOOLEAN deleted "DEFAULT false, filterable"
60
- TIMESTAMP datetime_add "filterable, updatable=false"
61
- TIMESTAMP datetime_alt "filterable"
62
- TIMESTAMP datetime_del "filterable"
63
- }
64
-
65
- credentials {
66
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
67
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
68
- VARCHAR(255) title "NOT NULL, searchable, filterable, maxLength=255"
69
- VARCHAR provider "NOT NULL, filterable, DEFAULT 'web-chat'"
70
- VARCHAR authType "NOT NULL, filterable, DEFAULT 'none'"
71
- VARCHAR userName
72
- VARCHAR password
73
- VARCHAR apiKey
74
- VARCHAR token
75
- VARCHAR paramName
76
- VARCHAR refreshToken
77
- VARCHAR clientSecret
78
- VARCHAR clientId
79
- VARCHAR sendIn "DEFAULT 'none'"
80
- VARCHAR scheme "DEFAULT 'none'"
81
- VARCHAR prefix
82
- BOOLEAN deleted "DEFAULT false, filterable"
83
- TIMESTAMP datetime_add "filterable, updatable=false"
84
- TIMESTAMP datetime_alt "filterable"
85
- TIMESTAMP datetime_del "filterable"
86
- }
87
-
88
- %% ==========================================
89
- %% AI & AUTOMATION DOMAIN (Domínio de IA)
90
- %% ==========================================
91
-
92
- agents {
93
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
94
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
95
- VARCHAR(255) title "NOT NULL, searchable, filterable, maxLength=255"
96
- IMAGE photo "types=[png,jpg,jpeg,gif,svg,webp], storage=gpages, 200x200"
97
- TEXT prompt
98
- INTEGER delay_typing "DEFAULT 0, filterable"
99
- INTEGER waiting_time "DEFAULT 0, filterable"
100
- BOOLEAN deleted "DEFAULT false, filterable"
101
- TIMESTAMP datetime_add "filterable, updatable=false"
102
- TIMESTAMP datetime_alt "filterable"
103
- TIMESTAMP datetime_del "filterable"
104
- }
105
-
106
- tools {
107
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
108
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
109
- VARCHAR(255) title "NOT NULL, searchable, filterable, maxLength=255"
110
- VARCHAR type "filterable, DEFAULT 'mcp'"
111
- VARCHAR(1000) description "searchable, filterable, maxLength=1000"
112
- INTEGER id_credential FK "filterable, index, optional"
113
- BOOLEAN deleted "DEFAULT false, filterable"
114
- TIMESTAMP datetime_add "filterable, updatable=false"
115
- TIMESTAMP datetime_alt "filterable"
116
- TIMESTAMP datetime_del "filterable"
117
- }
118
-
119
- missions {
120
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
121
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
122
- INTEGER id_agent FK "NOT NULL, filterable, index, reference=agents.id"
123
- VARCHAR(255) title "NOT NULL, searchable, filterable, maxLength=255"
124
- TEXT prompt
125
- BOOLEAN deleted "DEFAULT false, filterable"
126
- TIMESTAMP datetime_add "filterable, updatable=false"
127
- TIMESTAMP datetime_alt "filterable"
128
- TIMESTAMP datetime_del "filterable"
129
- }
130
-
131
- objectives {
132
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
133
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
134
- INTEGER id_mission FK "NOT NULL, filterable, index, reference=missions.id"
135
- INTEGER order "NOT NULL, filterable, DEFAULT 0"
136
- VARCHAR(255) title "NOT NULL, searchable, filterable, maxLength=255"
137
- TEXT prompt
138
- BOOLEAN deleted "DEFAULT false, filterable"
139
- TIMESTAMP datetime_add "filterable, updatable=false"
140
- TIMESTAMP datetime_alt "filterable"
141
- TIMESTAMP datetime_del "filterable"
142
- }
143
-
144
- objectives_tools {
145
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
146
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
147
- INTEGER id_objective FK "NOT NULL, filterable, index, reference=objectives.id"
148
- INTEGER id_tool FK "NOT NULL, filterable, index, reference=tools.id"
149
- TEXT instructions
150
- BOOLEAN wait "DEFAULT false"
151
- BOOLEAN deleted "DEFAULT false, filterable"
152
- TIMESTAMP datetime_add "filterable, updatable=false"
153
- TIMESTAMP datetime_alt "filterable"
154
- TIMESTAMP datetime_del "filterable"
155
- }
156
-
157
- %% ==========================================
158
- %% COMMUNICATION DOMAIN (Domínio de Comunicação)
159
- %% ==========================================
160
-
161
- channels {
162
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
163
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
164
- VARCHAR(255) title "NOT NULL, searchable, filterable, maxLength=255"
165
- VARCHAR provider "NOT NULL, filterable, DEFAULT 'web-chat'"
166
- VARCHAR url
167
- BOOLEAN active "DEFAULT true, filterable"
168
- INTEGER id_credential FK "optional, reference=credentials.id"
169
- VARCHAR(255) handle "filterable, maxLength=255"
170
- BOOLEAN deleted "DEFAULT false, filterable"
171
- TIMESTAMP datetime_add "filterable, updatable=false"
172
- TIMESTAMP datetime_alt "filterable"
173
- TIMESTAMP datetime_del "filterable"
174
- }
175
-
176
- conversations {
177
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
178
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
179
- INTEGER id_lead FK "NOT NULL, filterable, index, reference=leads.id"
180
- INTEGER id_channel FK "NOT NULL, filterable, index, reference=channels.id"
181
- INTEGER id_assignee FK "filterable, index, reference=users.id"
182
- TIMESTAMP last_message_at "filterable, optional"
183
- INTEGER id_last_message FK "filterable, index, optional, reference=messages.id"
184
- BOOLEAN stop_ai "DEFAULT false, filterable"
185
- VARCHAR status "filterable, DEFAULT 'open'"
186
- BOOLEAN deleted "DEFAULT false, filterable"
187
- TIMESTAMP datetime_add "filterable, updatable=false"
188
- TIMESTAMP datetime_alt "filterable"
189
- TIMESTAMP datetime_del "filterable"
190
- }
191
-
192
- messages {
193
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
194
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
195
- INTEGER id_conversation FK "NOT NULL, filterable, index, reference=conversations.id"
196
- INTEGER id_agent FK "filterable, index, optional, reference=agents.id"
197
- INTEGER id_user FK "filterable, index, optional, reference=users.id"
198
- VARCHAR direction "DEFAULT 'in', filterable"
199
- VARCHAR role "DEFAULT 'user', filterable"
200
- TEXT content "NOT NULL"
201
- BOOLEAN deleted "DEFAULT false, filterable"
202
- TIMESTAMP datetime_add "filterable, updatable=false"
203
- TIMESTAMP datetime_alt "filterable"
204
- TIMESTAMP datetime_del "filterable"
205
- }
206
-
207
- %% ==========================================
208
- %% CRM & ORGANIZATION DOMAIN (Domínio CRM)
209
- %% ==========================================
210
-
211
- leads {
212
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
213
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
214
- INTEGER id_person FK "NOT NULL, filterable, reference=people.id"
215
- VARCHAR(255) email "searchable, maxLength=255, pattern=email"
216
- VARCHAR(20) phone "searchable, maxLength=20, pattern=phone"
217
- INTEGER id_user_owner FK "filterable, index, reference=users.id"
218
- INTEGER id_current_agent FK "filterable, index, reference=agents.id"
219
- INTEGER id_current_mission FK "filterable, index, reference=missions.id"
220
- INTEGER id_current_objective FK "filterable, index, reference=objectives.id"
221
- TEXT notes "searchable"
222
- BOOLEAN deleted "DEFAULT false, filterable"
223
- TIMESTAMP datetime_add "filterable, updatable=false"
224
- TIMESTAMP datetime_alt "filterable"
225
- TIMESTAMP datetime_del "filterable"
226
- }
227
-
228
- companies {
229
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
230
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
231
- INTEGER id_lead FK "NOT NULL, filterable, reference=leads.id"
232
- VARCHAR(255) name "searchable, maxLength=255"
233
- VARCHAR(255) website "searchable, maxLength=255, pattern=url"
234
- VARCHAR(50) document "searchable, maxLength=50"
235
- TEXT notes "searchable"
236
- VARCHAR industry "searchable"
237
- VARCHAR size "searchable"
238
- BOOLEAN deleted "DEFAULT false, filterable"
239
- TIMESTAMP datetime_add "filterable, updatable=false"
240
- TIMESTAMP datetime_alt "filterable"
241
- TIMESTAMP datetime_del "filterable"
242
- }
243
-
244
- conversations_tags {
245
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
246
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
247
- INTEGER id_conversation FK "filterable, index, reference=conversations.id"
248
- INTEGER id_tag FK "filterable, index, reference=tags.id"
249
- BOOLEAN deleted "DEFAULT false, filterable"
250
- TIMESTAMP datetime_add "filterable, updatable=false"
251
- TIMESTAMP datetime_alt "filterable"
252
- TIMESTAMP datetime_del "filterable"
253
- }
254
-
255
- leads_tags {
256
- SERIAL id PK "AUTO_INCREMENT, UNIQUE, INDEX"
257
- INTEGER id_account FK "NOT NULL, filterable, reference=accounts.id"
258
- INTEGER id_lead FK "filterable, index, reference=leads.id"
259
- INTEGER id_tag FK "filterable, index, reference=tags.id"
260
- BOOLEAN deleted "DEFAULT false, filterable"
261
- TIMESTAMP datetime_add "filterable, updatable=false"
262
- TIMESTAMP datetime_alt "filterable"
263
- TIMESTAMP datetime_del "filterable"
264
- }
265
-
266
- %% ==========================================
267
- %% RELACIONAMENTOS 1:N (Um para Muitos)
268
- %% ==========================================
269
-
270
- %% ACCOUNTS como entidade central (Multi-tenancy)
271
- accounts ||--o{ users : "Multi-tenant"
272
- accounts ||--o{ people : "Multi-tenant"
273
- accounts ||--o{ tags : "Multi-tenant"
274
- accounts ||--o{ credentials : "Multi-tenant"
275
- accounts ||--o{ agents : "Multi-tenant"
276
- accounts ||--o{ tools : "Multi-tenant"
277
- accounts ||--o{ missions : "Multi-tenant"
278
- accounts ||--o{ objectives : "Multi-tenant"
279
- accounts ||--o{ objectives_tools : "Multi-tenant"
280
- accounts ||--o{ channels : "Multi-tenant"
281
- accounts ||--o{ conversations : "Multi-tenant"
282
- accounts ||--o{ messages : "Multi-tenant"
283
- accounts ||--o{ leads : "Multi-tenant"
284
- accounts ||--o{ companies : "Multi-tenant"
285
- accounts ||--o{ conversations_tags : "Multi-tenant"
286
- accounts ||--o{ leads_tags : "Multi-tenant"
287
-
288
- %% RELACIONAMENTOS PRINCIPAIS
289
- people ||--o{ leads : "Person-Lead"
290
- leads ||--o{ companies : "Lead-Company"
291
- leads ||--o{ conversations : "Lead-Conversation"
292
-
293
- %% AI & AUTOMATION RELATIONSHIPS
294
- agents ||--o{ missions : "Agent-Mission"
295
- missions ||--o{ objectives : "Mission-Objective"
296
- objectives ||--o{ objectives_tools : "Objective-ObjectiveTool"
297
- tools ||--o{ objectives_tools : "Tool-ObjectiveTool"
298
-
299
- %% COMMUNICATION RELATIONSHIPS
300
- channels ||--o{ conversations : "Channel-Conversation"
301
- conversations ||--o{ messages : "Conversation-Message"
302
-
303
- %% USER ASSIGNMENTS
304
- users ||--o{ conversations : "User-ConversationAssignee"
305
- users ||--o{ leads : "User-LeadOwner"
306
- users ||--o{ messages : "User-Message"
307
-
308
- %% AGENT RELATIONSHIPS
309
- agents ||--o{ messages : "Agent-Message"
310
- agents ||--o{ leads : "Agent-CurrentAgent"
311
-
312
- %% MISSION & OBJECTIVE CURRENT STATES
313
- missions ||--o{ leads : "Mission-CurrentMission"
314
- objectives ||--o{ leads : "Objective-CurrentObjective"
315
-
316
- %% CREDENTIAL RELATIONSHIPS
317
- credentials ||--o{ tools : "Credential-Tool"
318
- credentials ||--o{ channels : "Credential-Channel"
319
-
320
- %% TAG RELATIONSHIPS
321
- tags ||--o{ conversations_tags : "Tag-ConversationTag"
322
- tags ||--o{ leads_tags : "Tag-LeadTag"
323
- conversations ||--o{ conversations_tags : "Conversation-ConversationTag"
324
- leads ||--o{ leads_tags : "Lead-LeadTag"
325
-
326
- %% ==========================================
327
- %% RELACIONAMENTO CÍCLICO ESPECIAL
328
- %% ==========================================
329
-
330
- %% CYCLIC REFERENCE: conversations ↔ messages
331
- conversations ||--o| messages : "LastMessage"