@memberjunction/actions-apollo 2.112.0 → 2.113.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.
@@ -1,8 +1,8 @@
1
- import { BaseAction } from '@memberjunction/actions';
2
- import { Metadata, UserInfo } from '@memberjunction/global';
3
- import { AxiosResponse } from 'axios';
4
- import { ProcessSingleDomainParams, TechnologyMap } from './generic/apollo.types';
5
- import { ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
1
+ import { BaseAction } from "@memberjunction/actions";
2
+ import { Metadata, UserInfo } from "@memberjunction/core";
3
+ import { AxiosResponse } from "axios";
4
+ import { ProcessSingleDomainParams, TechnologyMap } from "./generic/apollo.types";
5
+ import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
6
6
  /**
7
7
  * Action that enriches account records using Apollo.io's organization and people data
8
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAmC,QAAQ,EAAW,QAAQ,EAAgB,MAAM,wBAAwB,CAAC;AACpH,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAML,yBAAyB,EAIzB,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAchG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBACa,8BAA+B,SAAQ,UAAU;IAC5D;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkE;IAEhG;;;;;;;;;;;OAWG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA4BvF;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAc7B;;;;;OAKG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;OAWG;cACa,cAAc,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAE,MAAU,GAAG,OAAO,CAAC,aAAa,CAAC;IAoCnJ;;;;;;OAMG;YACW,OAAO;CAGxB;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,SAEjD"}
package/dist/accounts.js CHANGED
@@ -36,7 +36,7 @@ exports.LoadApolloAccountsEnrichmentAction = exports.ApolloEnrichmentAccountsAct
36
36
  const actions_1 = require("@memberjunction/actions");
37
37
  const global_1 = require("@memberjunction/global");
38
38
  const Config = __importStar(require("./config"));
39
- const global_2 = require("@memberjunction/global");
39
+ const core_1 = require("@memberjunction/core");
40
40
  const axios_1 = __importDefault(require("axios"));
41
41
  /**
42
42
  * Action that enriches account records using Apollo.io's organization and people data
@@ -118,11 +118,11 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
118
118
  return await this.processAllAccountRecords(actionParams, params.ContextUser, 1);
119
119
  }
120
120
  catch (error) {
121
- (0, global_2.LogError)('Unexpected error in ApolloAccountsEnrichmentAction', undefined, error);
121
+ (0, core_1.LogError)('Unexpected error in ApolloAccountsEnrichmentAction', undefined, error);
122
122
  return {
123
123
  Success: false,
124
124
  Message: `Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}`,
125
- ResultCode: 'FAILED',
125
+ ResultCode: "FAILED"
126
126
  };
127
127
  }
128
128
  }
@@ -137,8 +137,8 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
137
137
  error: {
138
138
  Success: false,
139
139
  Message: 'Apollo.io API key not found in configuration',
140
- ResultCode: 'CONFIGURATION_ERROR',
141
- },
140
+ ResultCode: "CONFIGURATION_ERROR"
141
+ }
142
142
  };
143
143
  }
144
144
  return { success: true };
@@ -157,8 +157,8 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
157
157
  error: {
158
158
  Success: false,
159
159
  Message: 'Missing required parameter: AccountEntityFieldMappings',
160
- ResultCode: 'VALIDATION_ERROR',
161
- },
160
+ ResultCode: "VALIDATION_ERROR"
161
+ }
162
162
  };
163
163
  }
164
164
  let accountEntityFields;
@@ -174,8 +174,8 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
174
174
  error: {
175
175
  Success: false,
176
176
  Message: 'Invalid AccountEntityFieldMappings parameter: must be valid JSON or object',
177
- ResultCode: 'VALIDATION_ERROR',
178
- },
177
+ ResultCode: "VALIDATION_ERROR"
178
+ }
179
179
  };
180
180
  }
181
181
  // Extract optional parameters
@@ -190,8 +190,8 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
190
190
  accountTechnologyEntityFields,
191
191
  technologyCategoryEntityFields,
192
192
  contactEntityFields,
193
- contactEducationHistoryEntityFields,
194
- },
193
+ contactEducationHistoryEntityFields
194
+ }
195
195
  };
196
196
  }
197
197
  /**
@@ -201,7 +201,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
201
201
  * @returns The parameter if found, null otherwise
202
202
  */
203
203
  getRequiredParam(params, paramName) {
204
- const param = params.Params.find((p) => p.Name === paramName);
204
+ const param = params.Params.find(p => p.Name === paramName);
205
205
  return param || null;
206
206
  }
207
207
  /**
@@ -211,7 +211,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
211
211
  * @returns Parsed object of type T or null if not provided/invalid
212
212
  */
213
213
  parseOptionalJSONParam(params, paramName) {
214
- const param = params.Params.find((p) => p.Name === paramName);
214
+ const param = params.Params.find(p => p.Name === paramName);
215
215
  if (!param || !param.Value) {
216
216
  return null;
217
217
  }
@@ -219,7 +219,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
219
219
  return this.parseJSONParam(param.Value) || null;
220
220
  }
221
221
  catch (error) {
222
- (0, global_2.LogError)(`Error parsing ${paramName}`, undefined, error);
222
+ (0, core_1.LogError)(`Error parsing ${paramName}`, undefined, error);
223
223
  return null;
224
224
  }
225
225
  }
@@ -253,8 +253,8 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
253
253
  * @returns Promise indicating overall success/failure of the batch
254
254
  */
255
255
  async processAllAccountRecords(actionParams, contextUser, executionCount = 1) {
256
- const md = new global_2.Metadata();
257
- const rv = new global_2.RunView();
256
+ const md = new core_1.Metadata();
257
+ const rv = new core_1.RunView();
258
258
  // Initial query to get accounts to process
259
259
  const runViewResult = await rv.RunView({
260
260
  EntityName: actionParams.accountEntityFields.EntityName,
@@ -264,32 +264,32 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
264
264
  return {
265
265
  Success: false,
266
266
  Message: runViewResult.ErrorMessage,
267
- ResultCode: 'FAILED',
267
+ ResultCode: "FAILED"
268
268
  };
269
269
  }
270
270
  const results = runViewResult.Results;
271
271
  const resultLength = results.length;
272
272
  if (resultLength === 0) {
273
- (0, global_2.LogStatus)('+++ Completed domain enrichment, no records left to process.');
273
+ (0, core_1.LogStatus)('+++ Completed domain enrichment, no records left to process.');
274
274
  return {
275
275
  Success: true,
276
- Message: 'ApolloAccountsEnrichment executed successfully.',
277
- ResultCode: 'SUCCESS',
276
+ Message: "ApolloAccountsEnrichment executed successfully.",
277
+ ResultCode: "SUCCESS"
278
278
  };
279
279
  }
280
280
  // Check execution limit to prevent infinite recursion
281
281
  if (executionCount >= 5) {
282
- (0, global_2.LogStatus)(`+++ Reached maximum execution limit (${executionCount}), stopping to prevent infinite recursion.`);
282
+ (0, core_1.LogStatus)(`+++ Reached maximum execution limit (${executionCount}), stopping to prevent infinite recursion.`);
283
283
  return {
284
284
  Success: true,
285
285
  Message: `ApolloAccountsEnrichment stopped after ${executionCount} executions to prevent infinite recursion. ${resultLength} records may remain unprocessed.`,
286
- ResultCode: 'SUCCESS',
286
+ ResultCode: "SUCCESS"
287
287
  };
288
288
  }
289
289
  // Process accounts in concurrent groups
290
290
  await this.processAccountGroups(results, actionParams, md, contextUser);
291
291
  // Check if there are more records to process by running the query again
292
- (0, global_2.LogStatus)(`--- Checking for remaining records... (execution ${executionCount + 1}/5)`);
292
+ (0, core_1.LogStatus)(`--- Checking for remaining records... (execution ${executionCount + 1}/5)`);
293
293
  return await this.processAllAccountRecords(actionParams, contextUser, executionCount + 1);
294
294
  }
295
295
  /**
@@ -311,7 +311,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
311
311
  AccountTechnologyEntity: actionParams.accountTechnologyEntityFields || null,
312
312
  TechnologyCategoryEntity: actionParams.technologyCategoryEntityFields || null,
313
313
  ContactEntity: actionParams.contactEntityFields || null,
314
- ContactEducationHistoryEntity: actionParams.contactEducationHistoryEntityFields || null,
314
+ ContactEducationHistoryEntity: actionParams.contactEducationHistoryEntityFields || null
315
315
  };
316
316
  const task = this.ProcessSingleDomain(processParams, index, resultLength, md, contextUser);
317
317
  tasks.push(task);
@@ -356,11 +356,11 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
356
356
  const record = params.Record;
357
357
  const orgQueryString = {
358
358
  api_key: Config.ApolloAPIKey,
359
- domain: record[params.AccountEntity.DomainField],
359
+ domain: record[params.AccountEntity.DomainField]
360
360
  };
361
361
  const headers = {
362
362
  'Cache-Control': 'no-cache',
363
- 'Content-Type': 'application/json',
363
+ 'Content-Type': 'application/json'
364
364
  };
365
365
  // Get the organization enrichment data
366
366
  const orgResponse = await this.WrapApolloCall('get', 'organizations/enrich', null, { params: orgQueryString, headers: headers });
@@ -373,20 +373,18 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
373
373
  bSuccess = await this.updateAccountWithOrganizationData(result.organization, params, record, md, currentUser);
374
374
  if (params.AccountTechnologyEntity && bSuccess) {
375
375
  const accountID = record[params.AccountEntity.AccountIDField];
376
- bSuccess =
377
- bSuccess &&
378
- (await this.CreateAccountTechnologyRecords(params, accountID, result.organization.current_technologies, md, currentUser));
376
+ bSuccess = bSuccess && await this.CreateAccountTechnologyRecords(params, accountID, result.organization.current_technologies, md, currentUser);
379
377
  }
380
378
  }
381
379
  else {
382
380
  // No match found, but still update enriched timestamp
383
- (0, global_2.LogStatus)(` > No matches found for this domain: ${params.Record[params.AccountEntity.DomainField]}`);
381
+ (0, core_1.LogStatus)(` > No matches found for this domain: ${params.Record[params.AccountEntity.DomainField]}`);
384
382
  bSuccess = await this.updateAccountEnrichedTimestamp(params, record, md, currentUser);
385
383
  }
386
384
  return bSuccess;
387
385
  }
388
386
  catch (error) {
389
- (0, global_2.LogError)('Error enriching organization', undefined, error);
387
+ (0, core_1.LogError)('Error enriching organization', undefined, error);
390
388
  return false;
391
389
  }
392
390
  }
@@ -403,7 +401,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
403
401
  */
404
402
  async updateAccountWithOrganizationData(organization, params, record, md, currentUser) {
405
403
  try {
406
- const accountEntity = await md.GetEntityObject(params.AccountEntity.EntityName, global_2.CompositeKey.FromID(record.ID), currentUser);
404
+ const accountEntity = await md.GetEntityObject(params.AccountEntity.EntityName, core_1.CompositeKey.FromID(record.ID), currentUser);
407
405
  // Set organization data fields
408
406
  this.setFieldIfExists(accountEntity, params.AccountEntity.AddressField, organization.street_address);
409
407
  this.setFieldIfExists(accountEntity, params.AccountEntity.CityField, organization.city);
@@ -419,12 +417,12 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
419
417
  this.setFieldIfExists(accountEntity, params.AccountEntity.EnrichedAtField, new Date());
420
418
  const saveResult = await accountEntity.Save();
421
419
  if (!saveResult) {
422
- (0, global_2.LogError)('Error updating account record with enriched data', undefined, accountEntity.LatestResult);
420
+ (0, core_1.LogError)('Error updating account record with enriched data', undefined, accountEntity.LatestResult);
423
421
  }
424
422
  return saveResult;
425
423
  }
426
424
  catch (error) {
427
- (0, global_2.LogError)('Error updating account with organization data', undefined, error);
425
+ (0, core_1.LogError)('Error updating account with organization data', undefined, error);
428
426
  return false;
429
427
  }
430
428
  }
@@ -440,16 +438,16 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
440
438
  */
441
439
  async updateAccountEnrichedTimestamp(params, record, md, currentUser) {
442
440
  try {
443
- const accountEntity = await md.GetEntityObject('Accounts', global_2.CompositeKey.FromID(record.ID), currentUser);
441
+ const accountEntity = await md.GetEntityObject('Accounts', core_1.CompositeKey.FromID(record.ID), currentUser);
444
442
  accountEntity.Set(params.AccountEntity.EnrichedAtField, new Date());
445
443
  const saveResult = await accountEntity.Save();
446
444
  if (!saveResult) {
447
- (0, global_2.LogError)('Error updating account record with enriched timestamp', undefined, accountEntity.LatestResult);
445
+ (0, core_1.LogError)('Error updating account record with enriched timestamp', undefined, accountEntity.LatestResult);
448
446
  }
449
447
  return saveResult;
450
448
  }
451
449
  catch (error) {
452
- (0, global_2.LogError)('Error updating account enriched timestamp', undefined, error);
450
+ (0, core_1.LogError)('Error updating account enriched timestamp', undefined, error);
453
451
  return false;
454
452
  }
455
453
  }
@@ -486,13 +484,13 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
486
484
  let bSuccess = true;
487
485
  const ATEntity = params.AccountTechnologyEntity;
488
486
  if (ATEntity.TechnologyIDField && ATEntity.TechnologyField && ATEntity.CategoryField) {
489
- const rv = new global_2.RunView();
487
+ const rv = new core_1.RunView();
490
488
  const runViewResult = await rv.RunView({
491
489
  EntityName: ATEntity.EntityName,
492
- ExtraFilter: `${ATEntity.AccountIDField} = ${accountID}`,
490
+ ExtraFilter: `${ATEntity.AccountIDField} = ${accountID}`
493
491
  }, currentUser);
494
492
  if (!runViewResult.Success) {
495
- (0, global_2.LogError)('Error querying for existing Account Technologies', undefined, runViewResult.ErrorMessage);
493
+ (0, core_1.LogError)('Error querying for existing Account Technologies', undefined, runViewResult.ErrorMessage);
496
494
  return false;
497
495
  }
498
496
  // Process each technology
@@ -506,7 +504,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
506
504
  at.NewRecord();
507
505
  at.Set(ATEntity.AccountIDField, accountID);
508
506
  at.Set(ATEntity.TechnologyIDField, await this.getOrCreateTechnologyId(technology.name, categoryId, md, currentUser));
509
- bSuccess = bSuccess && (await at.Save());
507
+ bSuccess = bSuccess && await at.Save();
510
508
  }
511
509
  else {
512
510
  existingRow.matchFound = true;
@@ -515,11 +513,11 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
515
513
  // Mark unmatched technologies as ended
516
514
  for (const record of runViewResult.Results) {
517
515
  if (!record.matchFound) {
518
- const entity = await md.GetEntityObject(ATEntity.EntityName, global_2.CompositeKey.FromID(record.ID), currentUser);
516
+ const entity = await md.GetEntityObject(ATEntity.EntityName, core_1.CompositeKey.FromID(record.ID), currentUser);
519
517
  entity.Set(ATEntity.EndedUseAtField, new Date());
520
518
  const saveResult = await entity.Save();
521
519
  if (!saveResult) {
522
- (0, global_2.LogError)('Error updating Account Technology record', undefined, entity.LatestResult);
520
+ (0, core_1.LogError)('Error updating Account Technology record', undefined, entity.LatestResult);
523
521
  }
524
522
  bSuccess = bSuccess && saveResult;
525
523
  }
@@ -528,7 +526,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
528
526
  return bSuccess;
529
527
  }
530
528
  catch (error) {
531
- (0, global_2.LogError)('Error creating account technology records', undefined, error);
529
+ (0, core_1.LogError)('Error creating account technology records', undefined, error);
532
530
  return false;
533
531
  }
534
532
  }
@@ -548,13 +546,13 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
548
546
  return 0;
549
547
  }
550
548
  try {
551
- const rv = new global_2.RunView();
549
+ const rv = new core_1.RunView();
552
550
  const runViewResult = await rv.RunView({
553
551
  EntityName: TCEntity.EntityName,
554
- ExtraFilter: `${TCEntity.NameField} = '${this.EscapeSingleQuotes(categoryName)}'`,
552
+ ExtraFilter: `${TCEntity.NameField} = '${this.EscapeSingleQuotes(categoryName)}'`
555
553
  }, currentUser);
556
554
  if (!runViewResult.Success) {
557
- (0, global_2.LogError)('Error querying for existing Technology Categories', undefined, runViewResult.ErrorMessage);
555
+ (0, core_1.LogError)('Error querying for existing Technology Categories', undefined, runViewResult.ErrorMessage);
558
556
  return 0;
559
557
  }
560
558
  if (runViewResult.Results.length > 0) {
@@ -566,13 +564,13 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
566
564
  entity.Set(TCEntity.NameField, categoryName);
567
565
  const saveResult = await entity.Save();
568
566
  if (!saveResult) {
569
- (0, global_2.LogError)('Error creating new Technology Category record', undefined, entity.LatestResult);
567
+ (0, core_1.LogError)('Error creating new Technology Category record', undefined, entity.LatestResult);
570
568
  return 0;
571
569
  }
572
570
  return entity.Get(TCEntity.IDField);
573
571
  }
574
572
  catch (error) {
575
- (0, global_2.LogError)('Error getting or creating technology category', undefined, error);
573
+ (0, core_1.LogError)('Error getting or creating technology category', undefined, error);
576
574
  return 0;
577
575
  }
578
576
  }
@@ -588,13 +586,13 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
588
586
  */
589
587
  async getOrCreateTechnologyId(name, categoryId, md, currentUser) {
590
588
  try {
591
- const rv = new global_2.RunView();
589
+ const rv = new core_1.RunView();
592
590
  const runViewResult = await rv.RunView({
593
591
  EntityName: 'Technologies',
594
- ExtraFilter: `Name = '${this.EscapeSingleQuotes(name)}' AND CategoryID = ${categoryId}`,
592
+ ExtraFilter: `Name = '${this.EscapeSingleQuotes(name)}' AND CategoryID = ${categoryId}`
595
593
  }, currentUser);
596
594
  if (!runViewResult.Success) {
597
- (0, global_2.LogError)('Error querying for existing Technologies', undefined, runViewResult.ErrorMessage);
595
+ (0, core_1.LogError)('Error querying for existing Technologies', undefined, runViewResult.ErrorMessage);
598
596
  return 0;
599
597
  }
600
598
  if (runViewResult.Results.length > 0) {
@@ -607,13 +605,13 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
607
605
  technologyEntity.Set('CategoryID', categoryId);
608
606
  const saveResult = await technologyEntity.Save();
609
607
  if (!saveResult) {
610
- (0, global_2.LogError)('Error creating new Technology record', undefined, technologyEntity.LatestResult);
608
+ (0, core_1.LogError)('Error creating new Technology record', undefined, technologyEntity.LatestResult);
611
609
  return 0;
612
610
  }
613
611
  return technologyEntity.Get('ID');
614
612
  }
615
613
  catch (error) {
616
- (0, global_2.LogError)('Error getting or creating technology', undefined, error);
614
+ (0, core_1.LogError)('Error getting or creating technology', undefined, error);
617
615
  return 0;
618
616
  }
619
617
  }
@@ -639,21 +637,21 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
639
637
  api_key: Config.ApolloAPIKey,
640
638
  reveal_personal_emails: true,
641
639
  q_organization_domains: domain,
642
- page: 1,
640
+ page: 1
643
641
  };
644
642
  const headers = {
645
643
  'Cache-Control': 'no-cache',
646
- 'Content-Type': 'application/json',
644
+ 'Content-Type': 'application/json'
647
645
  };
648
646
  const response = await this.WrapApolloCall('post', 'mixed_people/search', APIparams, { headers: headers });
649
647
  if (!response || response.status !== 200) {
650
- (0, global_2.LogError)(`Error fetching data from Apollo.io: ${response?.statusText}`);
648
+ (0, core_1.LogError)(`Error fetching data from Apollo.io: ${response?.statusText}`);
651
649
  return false;
652
650
  }
653
651
  const data = response.data;
654
652
  const allPeople = data.people;
655
653
  // Fetch additional pages
656
- for (let i = 1; i < data.pagination.total_pages && i < Config.MaxPeopleToEnrichPerOrg / 10; i++) {
654
+ for (let i = 1; i < data.pagination.total_pages && i < (Config.MaxPeopleToEnrichPerOrg / 10); i++) {
657
655
  APIparams.page = i + 1;
658
656
  const nextResponse = await this.WrapApolloCall('post', 'mixed_people/search', APIparams, { headers: headers });
659
657
  if (nextResponse.status !== 200) {
@@ -664,7 +662,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
664
662
  allPeople.push(...nextResult.people);
665
663
  }
666
664
  if (allPeople.length === 0) {
667
- (0, global_2.LogStatus)(`No people found for this domain: ${domain}`);
665
+ (0, core_1.LogStatus)(`No people found for this domain: ${domain}`);
668
666
  return true;
669
667
  }
670
668
  // Process all people
@@ -674,12 +672,12 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
674
672
  if (this.shouldSkipPerson(person, domain)) {
675
673
  continue;
676
674
  }
677
- bSuccess = bSuccess && (await this.createAndEnrichContact(params, accountID, person, md, currentUser, i, allPeople.length));
675
+ bSuccess = bSuccess && await this.createAndEnrichContact(params, accountID, person, md, currentUser, i, allPeople.length);
678
676
  }
679
677
  return bSuccess;
680
678
  }
681
679
  catch (error) {
682
- (0, global_2.LogError)('Error creating and enriching people', undefined, error);
680
+ (0, core_1.LogError)('Error creating and enriching people', undefined, error);
683
681
  return false;
684
682
  }
685
683
  }
@@ -694,12 +692,12 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
694
692
  shouldSkipPerson(person, domain) {
695
693
  // Check for missing required data
696
694
  if (!person.last_name || !person.email || person.email.split('@')[1] !== domain) {
697
- (0, global_2.LogStatus)(`Skipping person: ${person.first_name} ${person.last_name} because email is missing or does not match domain`);
695
+ (0, core_1.LogStatus)(`Skipping person: ${person.first_name} ${person.last_name} because email is missing or does not match domain`);
698
696
  return true;
699
697
  }
700
698
  // Check for excluded titles
701
699
  if (this.IsExcludedTitle(person.title)) {
702
- (0, global_2.LogStatus)(`Skipping person: ${person.first_name} ${person.last_name} because title is excluded`);
700
+ (0, core_1.LogStatus)(`Skipping person: ${person.first_name} ${person.last_name} because title is excluded`);
703
701
  return true;
704
702
  }
705
703
  return false;
@@ -723,7 +721,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
723
721
  return false;
724
722
  }
725
723
  try {
726
- (0, global_2.LogStatus)(`Enriching contact for person: ${person.first_name} ${person.last_name}, accountID: ${accountID} (${sequence} of ${total})`);
724
+ (0, core_1.LogStatus)(`Enriching contact for person: ${person.first_name} ${person.last_name}, accountID: ${accountID} (${sequence} of ${total})`);
727
725
  const contact = await this.getOrCreateContact(params, accountID, person, md, currentUser);
728
726
  if (!contact) {
729
727
  return false;
@@ -732,17 +730,17 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
732
730
  this.updateContactFields(contact, person, CEntity);
733
731
  const saveResult = await contact.Save();
734
732
  if (!saveResult) {
735
- (0, global_2.LogError)('Error updating contact record with enriched data', undefined, contact.LatestResult);
733
+ (0, core_1.LogError)('Error updating contact record with enriched data', undefined, contact.LatestResult);
736
734
  return false;
737
735
  }
738
736
  // Update employment and education history if configured
739
737
  if (params.ContactEducationHistoryEntity) {
740
- return await this.createUpdateContactEmploymentAndEducationHistory(params, contact.Get('ID'), person, md, currentUser);
738
+ return await this.createUpdateContactEmploymentAndEducationHistory(params, contact.Get("ID"), person, md, currentUser);
741
739
  }
742
740
  return true;
743
741
  }
744
742
  catch (error) {
745
- (0, global_2.LogError)('Error creating and enriching contact', undefined, error);
743
+ (0, core_1.LogError)('Error creating and enriching contact', undefined, error);
746
744
  return false;
747
745
  }
748
746
  }
@@ -785,28 +783,28 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
785
783
  return null;
786
784
  }
787
785
  try {
788
- const rv = new global_2.RunView();
786
+ const rv = new core_1.RunView();
789
787
  // Check if contact exists with different account
790
788
  const conflictResult = await rv.RunView({
791
789
  EntityName: CEntity.EntityName,
792
- ExtraFilter: `${CEntity.EmailField} = '${this.EscapeSingleQuotes(person.email)}' AND ${CEntity.AccountIDField} <> ${accountID}`,
790
+ ExtraFilter: `${CEntity.EmailField} = '${this.EscapeSingleQuotes(person.email)}' AND ${CEntity.AccountIDField} <> ${accountID}`
793
791
  }, currentUser);
794
792
  if (!conflictResult.Success) {
795
- (0, global_2.LogError)('Error querying for existing Contacts', undefined, conflictResult.ErrorMessage);
793
+ (0, core_1.LogError)('Error querying for existing Contacts', undefined, conflictResult.ErrorMessage);
796
794
  return null;
797
795
  }
798
796
  if (conflictResult.Results.length > 0) {
799
797
  const existing = conflictResult.Results[0];
800
- (0, global_2.LogError)(`*** SKIPPING new contact record for ${person.first_name} ${person.last_name} because they are already associated with AccountID: ${existing.AccountID} - ContactID: ${existing.ID}`);
798
+ (0, core_1.LogError)(`*** SKIPPING new contact record for ${person.first_name} ${person.last_name} because they are already associated with AccountID: ${existing.AccountID} - ContactID: ${existing.ID}`);
801
799
  return null;
802
800
  }
803
801
  // Check if contact exists for this account
804
802
  const existingResult = await rv.RunView({
805
803
  EntityName: CEntity.EntityName,
806
- ExtraFilter: `(${CEntity.EmailField} = '${this.EscapeSingleQuotes(person.email)}' OR (${CEntity.FirstNameField} = '${this.EscapeSingleQuotes(person.first_name)}' AND ${CEntity.LastNameField} = '${this.EscapeSingleQuotes(person.last_name)}')) AND ${CEntity.AccountIDField} = ${accountID}`,
804
+ ExtraFilter: `(${CEntity.EmailField} = '${this.EscapeSingleQuotes(person.email)}' OR (${CEntity.FirstNameField} = '${this.EscapeSingleQuotes(person.first_name)}' AND ${CEntity.LastNameField} = '${this.EscapeSingleQuotes(person.last_name)}')) AND ${CEntity.AccountIDField} = ${accountID}`
807
805
  }, currentUser);
808
806
  if (!existingResult.Success) {
809
- (0, global_2.LogError)('Error querying for existing Contacts', undefined, existingResult.ErrorMessage);
807
+ (0, core_1.LogError)('Error querying for existing Contacts', undefined, existingResult.ErrorMessage);
810
808
  return null;
811
809
  }
812
810
  let contactEntity = null;
@@ -817,7 +815,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
817
815
  }
818
816
  else {
819
817
  // Create new contact
820
- (0, global_2.LogStatus)(` > Creating new contact record for ${person.first_name} ${person.last_name}`);
818
+ (0, core_1.LogStatus)(` > Creating new contact record for ${person.first_name} ${person.last_name}`);
821
819
  contactEntity = await md.GetEntityObject(CEntity.EntityName, currentUser);
822
820
  contactEntity.NewRecord();
823
821
  contactEntity.Set(CEntity.EmailField, person.email);
@@ -828,7 +826,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
828
826
  return contactEntity;
829
827
  }
830
828
  catch (error) {
831
- (0, global_2.LogError)('Error getting or creating contact', undefined, error);
829
+ (0, core_1.LogError)('Error getting or creating contact', undefined, error);
832
830
  return null;
833
831
  }
834
832
  }
@@ -850,21 +848,21 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
850
848
  }
851
849
  try {
852
850
  let bSuccess = true;
853
- const rv = new global_2.RunView();
851
+ const rv = new core_1.RunView();
854
852
  for (const history of person.employment_history) {
855
853
  if (history.degree && history.degree.length > 0) {
856
854
  const EHRunViewResult = await rv.RunView({
857
855
  EntityName: CEntity.EntityName,
858
- ExtraFilter: `${CEntity.ContactIDField} = ${contactID} AND ${CEntity.InstitutionField} = '${this.EscapeSingleQuotes(history.organization_name)}' AND ${CEntity.DegreeField} = '${this.EscapeSingleQuotes(history.degree)}'`,
856
+ ExtraFilter: `${CEntity.ContactIDField} = ${contactID} AND ${CEntity.InstitutionField} = '${this.EscapeSingleQuotes(history.organization_name)}' AND ${CEntity.DegreeField} = '${this.EscapeSingleQuotes(history.degree)}'`
859
857
  }, currentUser);
860
858
  if (!EHRunViewResult.Success) {
861
- (0, global_2.LogError)('Error querying for existing Employment History', undefined, EHRunViewResult.ErrorMessage);
859
+ (0, core_1.LogError)('Error querying for existing Employment History', undefined, EHRunViewResult.ErrorMessage);
862
860
  bSuccess = false;
863
861
  continue;
864
862
  }
865
863
  let historyEntity = null;
866
864
  if (EHRunViewResult.Results.length > 0) {
867
- historyEntity = await md.GetEntityObject(CEntity.EntityName, global_2.CompositeKey.FromID(EHRunViewResult.Results[0].ID), currentUser);
865
+ historyEntity = await md.GetEntityObject(CEntity.EntityName, core_1.CompositeKey.FromID(EHRunViewResult.Results[0].ID), currentUser);
868
866
  }
869
867
  else {
870
868
  historyEntity = await md.GetEntityObject(CEntity.EntityName, currentUser);
@@ -884,7 +882,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
884
882
  historyEntity.Set(CEntity.IsCurrentField, history.current);
885
883
  const saveResult = await historyEntity.Save();
886
884
  if (!saveResult) {
887
- (0, global_2.LogError)('Error saving Employment History record', undefined, historyEntity.LatestResult);
885
+ (0, core_1.LogError)('Error saving Employment History record', undefined, historyEntity.LatestResult);
888
886
  bSuccess = false;
889
887
  }
890
888
  }
@@ -892,7 +890,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
892
890
  return bSuccess;
893
891
  }
894
892
  catch (error) {
895
- (0, global_2.LogError)('Error creating/updating contact employment and education history', undefined, error);
893
+ (0, core_1.LogError)('Error creating/updating contact employment and education history', undefined, error);
896
894
  return false;
897
895
  }
898
896
  }
@@ -954,7 +952,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
954
952
  let response = method === 'get' ? await axios_1.default.get(url, config) : await axios_1.default.post(url, data, config);
955
953
  if (response.status === 429) {
956
954
  if (retryAttempts > 0) {
957
- (0, global_2.LogStatus)(' >>> Too many requests to Apollo.io API, waiting 1 minute and trying again...');
955
+ (0, core_1.LogStatus)(' >>> Too many requests to Apollo.io API, waiting 1 minute and trying again...');
958
956
  await this.Timeout(60000); // wait 1 minute
959
957
  return await this.WrapApolloCall(method, endpoint, data, config, retryAttempts - 1);
960
958
  }
@@ -968,7 +966,7 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
968
966
  // axios could throw an exception for a 429 instead of a response, so we need to handle that here
969
967
  if (apolloError && apolloError.response && apolloError.response.status === 429) {
970
968
  if (retryAttempts > 0) {
971
- (0, global_2.LogStatus)(' >>> Too many requests to Apollo.io API, waiting 1 minute and trying again...');
969
+ (0, core_1.LogStatus)(' >>> Too many requests to Apollo.io API, waiting 1 minute and trying again...');
972
970
  await this.Timeout(60000); // wait 1 minute
973
971
  return await this.WrapApolloCall(method, endpoint, data, config, retryAttempts - 1);
974
972
  }
@@ -989,12 +987,12 @@ let ApolloEnrichmentAccountsAction = class ApolloEnrichmentAccountsAction extend
989
987
  * @returns Promise that resolves after the specified delay
990
988
  */
991
989
  async Timeout(ms) {
992
- return new Promise((resolve) => setTimeout(resolve, ms));
990
+ return new Promise(resolve => setTimeout(resolve, ms));
993
991
  }
994
992
  };
995
993
  exports.ApolloEnrichmentAccountsAction = ApolloEnrichmentAccountsAction;
996
994
  exports.ApolloEnrichmentAccountsAction = ApolloEnrichmentAccountsAction = __decorate([
997
- (0, global_1.RegisterClass)(actions_1.BaseAction, 'ApolloEnrichmentAccountsAction')
995
+ (0, global_1.RegisterClass)(actions_1.BaseAction, "ApolloEnrichmentAccountsAction")
998
996
  ], ApolloEnrichmentAccountsAction);
999
997
  /**
1000
998
  * Loader function to ensure the ApolloEnrichmentAccountsAction class is included in the bundle