@reachy/audience-module 1.0.18 → 1.0.20
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/.gitlab/merge_request_templates/Default.md +31 -0
- package/.gitlab-ci.yml +59 -49
- package/CLAUDE.md +134 -0
- package/dist/AudienceModule.d.ts.map +1 -1
- package/dist/AudienceModule.js +1 -0
- package/dist/AudienceModule.js.map +1 -1
- package/dist/engine/V2AudienceEngine.d.ts +5 -0
- package/dist/engine/V2AudienceEngine.d.ts.map +1 -1
- package/dist/engine/V2AudienceEngine.js +210 -72
- package/dist/engine/V2AudienceEngine.js.map +1 -1
- package/dist/executors/ClickHouseEventQueryExecutor.d.ts +23 -0
- package/dist/executors/ClickHouseEventQueryExecutor.d.ts.map +1 -0
- package/dist/executors/ClickHouseEventQueryExecutor.js +803 -0
- package/dist/executors/ClickHouseEventQueryExecutor.js.map +1 -0
- package/dist/repositories/SupabaseContactRepository.d.ts +1 -0
- package/dist/repositories/SupabaseContactRepository.d.ts.map +1 -1
- package/dist/repositories/SupabaseContactRepository.js +1 -0
- package/dist/repositories/SupabaseContactRepository.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/jest.config.js +8 -0
- package/package.json +7 -2
- package/src/AudienceModule.ts +1 -0
- package/src/__tests__/AudienceModule.test.ts +382 -0
- package/src/__tests__/CriteriaParser.test.ts +130 -0
- package/src/__tests__/QueryBuilder.test.ts +198 -0
- package/src/__tests__/RfmEngine.test.ts +284 -0
- package/src/__tests__/RfmSegmentBuilder.test.ts +210 -0
- package/src/__tests__/StaticAudienceExecutor.test.ts +134 -0
- package/src/__tests__/SupabaseContactRepository.test.ts +81 -0
- package/src/engine/V2AudienceEngine.ts +240 -85
- package/src/executors/ClickHouseEventQueryExecutor.ts +853 -0
- package/src/repositories/SupabaseContactRepository.ts +2 -1
- package/src/types/index.ts +6 -0
|
@@ -8,10 +8,11 @@ export class SupabaseContactRepository {
|
|
|
8
8
|
private supabase: any
|
|
9
9
|
private engine: V2AudienceEngine
|
|
10
10
|
|
|
11
|
-
constructor(params: { supabaseClient: any; debug?: boolean; logger?: any }) {
|
|
11
|
+
constructor(params: { supabaseClient: any; clickhouseClient?: any; debug?: boolean; logger?: any }) {
|
|
12
12
|
this.supabase = params.supabaseClient
|
|
13
13
|
this.engine = new V2AudienceEngine({
|
|
14
14
|
supabaseClient: params.supabaseClient,
|
|
15
|
+
clickhouseClient: params.clickhouseClient,
|
|
15
16
|
debug: params.debug,
|
|
16
17
|
logger: params.logger
|
|
17
18
|
})
|
package/src/types/index.ts
CHANGED
|
@@ -130,6 +130,12 @@ export interface AudienceBuilderConfig {
|
|
|
130
130
|
* sem depender de repositórios do reachy-api.
|
|
131
131
|
*/
|
|
132
132
|
supabaseClient?: any
|
|
133
|
+
/**
|
|
134
|
+
* Quando fornecido, o engine V2 usa ClickHouse para avaliar rules de evento (kind='event')
|
|
135
|
+
* em vez do Supabase — elimina N queries paginadas + JS aggregation.
|
|
136
|
+
* Requer AUDIENCE_EVENTS_BACKEND=clickhouse na aplicação que instancia o módulo.
|
|
137
|
+
*/
|
|
138
|
+
clickhouseClient?: any
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
export interface CreateAudienceData {
|