@@ -12,7 +12,7 @@ import {
12
12
ContactDelta ,
13
13
ContactTemplate ,
14
14
ContactUpdate ,
15
- ContactsChangedData ,
15
+ IntegrationEntitiesChangedData ,
16
16
ServerError ,
17
17
} from '.' ;
18
18
import { calendarEventsSchema , contactsSchema } from '../schemas' ;
@@ -35,7 +35,7 @@ import {
35
35
PubSubContactsMessage ,
36
36
PubSubContactsState ,
37
37
} from './pubsub-contacts-message.model' ;
38
- import { PubSubContactsChangedClient } from './pubsub-contacts -changed-client.model' ;
38
+ import { PubSubIntegrationEntitiesChangedClient } from './pubsub-integration-entities -changed-client.model' ;
39
39
40
40
const CONTACT_FETCH_TIMEOUT = 5000 ;
41
41
@@ -54,7 +54,7 @@ export class Controller {
54
54
private contactCache : ContactCache | null ;
55
55
private ajv : Ajv ;
56
56
private pubSubClient : PubSubClient | null = null ;
57
- private pubSubContactsChangedClient : PubSubContactsChangedClient | null =
57
+ private pubSubIntegrationEntitiesChangedClient : PubSubIntegrationEntitiesChangedClient | null =
58
58
null ;
59
59
private integrationName : string = 'UNKNOWN' ;
60
60
private streamingPromises = new Map < string , Promise < void > > ( ) ;
@@ -67,16 +67,19 @@ export class Controller {
67
67
if ( this . adapter . streamContacts ) {
68
68
const {
69
69
PUBSUB_TOPIC_NAME : topicName ,
70
- PUBSUB_CONTACTS_CHANGED_TOPIC_NAME : contactsChangedTopicName ,
70
+ PUBSUB_INTEGRATION_ENTITIES_CHANGED_TOPIC_NAME :
71
+ integrationEntitiesChangedTopicName ,
71
72
INTEGRATION_NAME : integrationName ,
72
73
} = process . env ;
73
74
74
75
if ( ! topicName ) {
75
76
throw new Error ( 'No PUBSUB_TOPIC_NAME provided.' ) ;
76
77
}
77
78
78
- if ( ! contactsChangedTopicName ) {
79
- throw new Error ( 'No PUBSUB_CONTACTS_CHANGED_TOPIC_NAME provided.' ) ;
79
+ if ( ! integrationEntitiesChangedTopicName ) {
80
+ throw new Error (
81
+ 'No PUBSUB_INTEGRATION_ENTITIES_CHANGED_TOPIC_NAME provided.' ,
82
+ ) ;
80
83
}
81
84
82
85
if ( ! integrationName ) {
@@ -90,12 +93,13 @@ export class Controller {
90
93
`Initialized PubSub client with topic ${ topicName } ` ,
91
94
) ;
92
95
93
- this . pubSubContactsChangedClient = new PubSubContactsChangedClient (
94
- contactsChangedTopicName ,
95
- ) ;
96
+ this . pubSubIntegrationEntitiesChangedClient =
97
+ new PubSubIntegrationEntitiesChangedClient (
98
+ integrationEntitiesChangedTopicName ,
99
+ ) ;
96
100
infoLogger (
97
101
'Controller' ,
98
- `Initialized PubSub client with topic ${ contactsChangedTopicName } ` ,
102
+ `Initialized PubSub client with topic ${ integrationEntitiesChangedTopicName } ` ,
99
103
) ;
100
104
}
101
105
}
@@ -1309,11 +1313,11 @@ export class Controller {
1309
1313
throw new ServerError ( 501 , 'Webhook handling not implemented' ) ;
1310
1314
}
1311
1315
1312
- const contactsChangedData : ContactsChangedData =
1316
+ const changedData : IntegrationEntitiesChangedData =
1313
1317
await this . adapter . handleWebhook ( req . body ) ;
1314
1318
1315
- console . log ( 'sending webhook to pubsub' , contactsChangedData ) ;
1316
- this . pubSubContactsChangedClient ?. publishMessage ( contactsChangedData ) ;
1319
+ console . log ( 'sending webhook to pubsub' , changedData ) ;
1320
+ this . pubSubIntegrationEntitiesChangedClient ?. publishMessage ( changedData ) ;
1317
1321
1318
1322
res . sendStatus ( 200 ) ;
1319
1323
} catch ( error ) {
0 commit comments