@reachy/audience-module 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SUMMARY.md +169 -0
- package/package.json +1 -1
package/SUMMARY.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# @reachy/audience-module - Resumo Completo
|
|
2
|
+
|
|
3
|
+
## ✅ Status: Módulo Criado e Pronto para Uso!
|
|
4
|
+
|
|
5
|
+
### 📦 **O que foi criado:**
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
/Users/vitorhugo/reachy/audience-module/
|
|
9
|
+
├── package.json ✅ Configurado para NPM
|
|
10
|
+
├── tsconfig.json ✅ TypeScript configurado
|
|
11
|
+
├── README.md ✅ Documentação
|
|
12
|
+
├── PUBLISH.md ✅ Guia de publicação
|
|
13
|
+
├── dist/ ✅ Código compilado
|
|
14
|
+
│ ├── index.js
|
|
15
|
+
│ ├── index.d.ts
|
|
16
|
+
│ ├── AudienceModule.js
|
|
17
|
+
│ ├── builders/
|
|
18
|
+
│ ├── executors/
|
|
19
|
+
│ └── types/
|
|
20
|
+
└── src/
|
|
21
|
+
├── index.ts ✅ Export principal
|
|
22
|
+
├── AudienceModule.ts ✅ Classe principal
|
|
23
|
+
├── types/
|
|
24
|
+
│ └── index.ts ✅ Tipos TypeScript
|
|
25
|
+
├── builders/
|
|
26
|
+
│ ├── CriteriaParser.ts ✅ Parser de critérios
|
|
27
|
+
│ └── QueryBuilder.ts ✅ Construtor de queries
|
|
28
|
+
└── executors/
|
|
29
|
+
└── StaticAudienceExecutor.ts ✅ Executor de queries
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 🔗 **Integração com reachy-api:**
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
/Users/vitorhugo/reachy/reachy-api/
|
|
36
|
+
├── package.json ✅ Dependência adicionada
|
|
37
|
+
│ "dependencies": {
|
|
38
|
+
│ "@reachy/audience-module": "file:../audience-module"
|
|
39
|
+
│ }
|
|
40
|
+
├── src/services/audienceModuleService.ts ✅ Configuração singleton
|
|
41
|
+
└── AUDIENCE_MODULE_USAGE.md ✅ Exemplos de uso
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🚀 **Como Usar Agora:**
|
|
47
|
+
|
|
48
|
+
### **1. Desenvolvimento Local (Atual)**
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// Em qualquer serviço do reachy-api
|
|
52
|
+
import { audienceModule } from './services/audienceModuleService'
|
|
53
|
+
|
|
54
|
+
// Executar query
|
|
55
|
+
const result = await audienceModule.executeQuery(criteria, {
|
|
56
|
+
organizationId: 'org-123',
|
|
57
|
+
projectId: 'proj-456'
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
console.log(`Encontrados ${result.count} contatos`)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### **2. Para Deploy (GitLab CI/CD)**
|
|
64
|
+
|
|
65
|
+
#### **Opção A: Continuar com Link Local**
|
|
66
|
+
|
|
67
|
+
No GitLab, configure o CI para copiar o módulo:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
before_script:
|
|
71
|
+
- cp -r ../audience-module ./
|
|
72
|
+
- npm ci
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### **Opção B: Publicar no NPM (Recomendado)**
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# 1. Publicar módulo
|
|
79
|
+
cd /Users/vitorhugo/reachy/audience-module
|
|
80
|
+
npm login
|
|
81
|
+
npm publish --access public
|
|
82
|
+
|
|
83
|
+
# 2. Atualizar reachy-api/package.json
|
|
84
|
+
{
|
|
85
|
+
"dependencies": {
|
|
86
|
+
"@reachy/audience-module": "^1.0.0" // ← Do NPM
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# 3. GitLab CI funciona automaticamente!
|
|
91
|
+
# O npm ci baixa do NPM e instala normalmente
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 📋 **Funcionalidades do Módulo:**
|
|
97
|
+
|
|
98
|
+
### ✅ **Criadas e Funcionando:**
|
|
99
|
+
|
|
100
|
+
1. **CriteriaParser** - Parse e normalização de critérios
|
|
101
|
+
- Suporta múltiplos formatos (filters, groups, conditions)
|
|
102
|
+
- Validação de critérios
|
|
103
|
+
- Detecção de tipo (static/live)
|
|
104
|
+
|
|
105
|
+
2. **QueryBuilder** - Construção de queries Supabase
|
|
106
|
+
- Suporte a operadores complexos
|
|
107
|
+
- Mapeamento de campos
|
|
108
|
+
- Queries otimizadas
|
|
109
|
+
|
|
110
|
+
3. **StaticAudienceExecutor** - Execução de audiences estáticas
|
|
111
|
+
- Query com paginação
|
|
112
|
+
- Contagem rápida
|
|
113
|
+
- Metadata de execução
|
|
114
|
+
|
|
115
|
+
4. **AudienceModule** - API principal
|
|
116
|
+
- executeQuery() - Executar query completa
|
|
117
|
+
- getContactCount() - Apenas contagem
|
|
118
|
+
- getContactIds() - Apenas IDs
|
|
119
|
+
- createAudience() - Criar audience
|
|
120
|
+
- updateAudience() - Atualizar audience
|
|
121
|
+
- validateCriteria() - Validar critérios
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 📖 **Documentação Criada:**
|
|
126
|
+
|
|
127
|
+
1. **README.md** - Uso básico do módulo
|
|
128
|
+
2. **PUBLISH.md** - Como publicar no NPM
|
|
129
|
+
3. **AUDIENCE_MODULE_USAGE.md** (reachy-api) - Exemplos práticos
|
|
130
|
+
4. **GITLAB_DEPLOY_AUDIENCE_MODULE.md** (reachy-api) - Deploy via GitLab
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🎯 **Próximos Passos:**
|
|
135
|
+
|
|
136
|
+
### **Imediato (Desenvolvimento Local):**
|
|
137
|
+
✅ Módulo já está funcionando via `file:../audience-module`
|
|
138
|
+
✅ Pode começar a usar nos serviços
|
|
139
|
+
|
|
140
|
+
### **Para Deploy:**
|
|
141
|
+
|
|
142
|
+
**Opção 1: NPM Público (Recomendado)**
|
|
143
|
+
```bash
|
|
144
|
+
cd /Users/vitorhugo/reachy/audience-module
|
|
145
|
+
npm publish --access public
|
|
146
|
+
```
|
|
147
|
+
Depois atualiza `reachy-api/package.json` para: `"^1.0.0"`
|
|
148
|
+
|
|
149
|
+
**Opção 2: GitLab Package Registry**
|
|
150
|
+
Usar o registry do próprio GitLab (grátis, privado)
|
|
151
|
+
|
|
152
|
+
**Opção 3: Copiar no CI**
|
|
153
|
+
Manter como está e copiar o módulo no pipeline
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 💡 **Recomendação:**
|
|
158
|
+
|
|
159
|
+
Use **NPM público** porque:
|
|
160
|
+
- ✅ Zero configuração no GitLab CI
|
|
161
|
+
- ✅ Funciona em qualquer ambiente
|
|
162
|
+
- ✅ Fácil de atualizar
|
|
163
|
+
- ✅ Versionamento automático
|
|
164
|
+
- ✅ Gratuito
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
**Tudo pronto!** O módulo foi criado, compilado e integrado com sucesso! 🎉
|
|
169
|
+
|