@memberjunction/integration-engine 6.1.4 → 6.2.0-edge.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.
Files changed (85) hide show
  1. package/dist/ActionMetadataGenerator.d.ts +17 -17
  2. package/dist/ActionMetadataGenerator.js +70 -70
  3. package/dist/BaseIntegrationConnector.js +6 -6
  4. package/dist/BaseRESTIntegrationConnector.d.ts +28 -28
  5. package/dist/BaseRESTIntegrationConnector.js +97 -97
  6. package/dist/ConflictRecency.d.ts +4 -0
  7. package/dist/ConflictRecency.d.ts.map +1 -1
  8. package/dist/ConflictRecency.js +12 -4
  9. package/dist/ConflictRecency.js.map +1 -1
  10. package/dist/ConnectorFactory.d.ts +1 -1
  11. package/dist/ConnectorFactory.js +2 -2
  12. package/dist/ContentHash.d.ts +6 -0
  13. package/dist/ContentHash.d.ts.map +1 -1
  14. package/dist/ContentHash.js +17 -26
  15. package/dist/ContentHash.js.map +1 -1
  16. package/dist/CustomColumnPromotion.d.ts +12 -0
  17. package/dist/CustomColumnPromotion.d.ts.map +1 -1
  18. package/dist/CustomColumnPromotion.js +32 -8
  19. package/dist/CustomColumnPromotion.js.map +1 -1
  20. package/dist/CustomOverflow.d.ts +8 -0
  21. package/dist/CustomOverflow.d.ts.map +1 -1
  22. package/dist/CustomOverflow.js +20 -4
  23. package/dist/CustomOverflow.js.map +1 -1
  24. package/dist/EnrichSchemaConstraints.d.ts +1 -1
  25. package/dist/EnrichSchemaConstraints.js +2 -2
  26. package/dist/FieldMappingEngine.d.ts +3 -3
  27. package/dist/FieldMappingEngine.js +11 -11
  28. package/dist/HashDiff.d.ts +8 -0
  29. package/dist/HashDiff.d.ts.map +1 -1
  30. package/dist/HashDiff.js +22 -6
  31. package/dist/HashDiff.js.map +1 -1
  32. package/dist/IntegrationActionGenerator.d.ts +1 -1
  33. package/dist/IntegrationActionGenerator.js +2 -2
  34. package/dist/IntegrationConnectorCreationPipeline.d.ts +6 -6
  35. package/dist/IntegrationConnectorCreationPipeline.js +14 -14
  36. package/dist/IntegrationEngine.d.ts +38 -38
  37. package/dist/IntegrationEngine.js +132 -132
  38. package/dist/IntegrationSchemaSync.d.ts +47 -4
  39. package/dist/IntegrationSchemaSync.d.ts.map +1 -1
  40. package/dist/IntegrationSchemaSync.js +62 -30
  41. package/dist/IntegrationSchemaSync.js.map +1 -1
  42. package/dist/KeySerialization.d.ts +2 -0
  43. package/dist/KeySerialization.d.ts.map +1 -1
  44. package/dist/KeySerialization.js +5 -1
  45. package/dist/KeySerialization.js.map +1 -1
  46. package/dist/MatchEngine.d.ts +11 -11
  47. package/dist/MatchEngine.js +33 -33
  48. package/dist/RecordFlatten.d.ts +5 -1
  49. package/dist/RecordFlatten.d.ts.map +1 -1
  50. package/dist/RecordFlatten.js +11 -3
  51. package/dist/RecordFlatten.js.map +1 -1
  52. package/dist/RecordMapBatch.js +2 -2
  53. package/dist/StreamingDiscovery.d.ts +11 -0
  54. package/dist/StreamingDiscovery.d.ts.map +1 -1
  55. package/dist/StreamingDiscovery.js +22 -6
  56. package/dist/StreamingDiscovery.js.map +1 -1
  57. package/dist/SyncLogger.d.ts +15 -3
  58. package/dist/SyncLogger.d.ts.map +1 -1
  59. package/dist/SyncLogger.js +33 -9
  60. package/dist/SyncLogger.js.map +1 -1
  61. package/dist/WatermarkService.d.ts +2 -2
  62. package/dist/WatermarkService.js +4 -4
  63. package/dist/auth-helpers/BasicAuthHeaderBuilder.d.ts +6 -0
  64. package/dist/auth-helpers/BasicAuthHeaderBuilder.d.ts.map +1 -1
  65. package/dist/auth-helpers/BasicAuthHeaderBuilder.js +10 -2
  66. package/dist/auth-helpers/BasicAuthHeaderBuilder.js.map +1 -1
  67. package/dist/auth-helpers/OAuth1aSigner.d.ts +2 -0
  68. package/dist/auth-helpers/OAuth1aSigner.d.ts.map +1 -1
  69. package/dist/auth-helpers/OAuth1aSigner.js +10 -6
  70. package/dist/auth-helpers/OAuth1aSigner.js.map +1 -1
  71. package/dist/auth-helpers/OAuth2TokenManager.d.ts +2 -2
  72. package/dist/auth-helpers/OAuth2TokenManager.js +4 -4
  73. package/dist/auth-helpers/index.d.ts +2 -2
  74. package/dist/auth-helpers/index.d.ts.map +1 -1
  75. package/dist/auth-helpers/index.js +2 -2
  76. package/dist/auth-helpers/index.js.map +1 -1
  77. package/dist/index.d.ts +8 -8
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +8 -8
  80. package/dist/index.js.map +1 -1
  81. package/dist/prefetchFilter.d.ts +4 -0
  82. package/dist/prefetchFilter.d.ts.map +1 -1
  83. package/dist/prefetchFilter.js +10 -2
  84. package/dist/prefetchFilter.js.map +1 -1
  85. package/package.json +7 -7
@@ -1,8 +1,8 @@
1
1
  import { RunView } from '@memberjunction/core';
2
2
  import { UUIDsEqual } from '@memberjunction/global';
3
3
  import { IntegrationEngineBase } from '@memberjunction/integration-engine-base';
4
- import { computeContentHash } from './ContentHash.js';
5
- import { serializeKeyValue } from './KeySerialization.js';
4
+ import { ComputeContentHash } from './ContentHash.js';
5
+ import { SerializeKeyValue } from './KeySerialization.js';
6
6
  import { PK_STAT_MIN_ROWS_FOR_SIGNIFICANCE } from './StreamingDiscovery.js';
7
7
  import { BaseIntegrationConnector, } from './BaseIntegrationConnector.js';
8
8
  /** Maximum number of pages to fetch before stopping (safety limit to prevent infinite loops) */
@@ -94,7 +94,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
94
94
  async DiscoverFields(companyIntegration, objectName, _contextUser) {
95
95
  const obj = this.GetCachedObject(companyIntegration.IntegrationID, objectName);
96
96
  const fields = this.GetCachedFields(obj.ID);
97
- return fields.map(f => this.FieldEntityToSchema(f));
97
+ return fields.map(f => this.fieldEntityToSchema(f));
98
98
  }
99
99
  /**
100
100
  * Builds SourceSchemaInfo from IntegrationEngineBase cached metadata.
@@ -111,7 +111,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
111
111
  const result = { Objects: [], IsAuthoritative: false };
112
112
  for (const obj of objects) {
113
113
  const fields = this.GetCachedFields(obj.ID);
114
- const sourceObject = this.BuildSourceObjectInfo(obj, fields, objects);
114
+ const sourceObject = this.buildSourceObjectInfo(obj, fields, objects);
115
115
  result.Objects.push(sourceObject);
116
116
  }
117
117
  return result;
@@ -125,11 +125,11 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
125
125
  const fields = this.GetCachedFields(obj.ID);
126
126
  const auth = await this.Authenticate(ctx.CompanyIntegration, ctx.ContextUser);
127
127
  const baseURL = this.GetBaseURL(ctx.CompanyIntegration, auth);
128
- const templateVars = this.DetectTemplateVars(obj.APIPath);
128
+ const templateVars = this.detectTemplateVars(obj.APIPath);
129
129
  if (templateVars.length > 0) {
130
- return this.FetchWithTemplateVars(auth, baseURL, obj, fields, templateVars, ctx);
130
+ return this.fetchWithTemplateVars(auth, baseURL, obj, fields, templateVars, ctx);
131
131
  }
132
- return this.FetchFlat(auth, baseURL, obj, fields, ctx);
132
+ return this.fetchFlat(auth, baseURL, obj, fields, ctx);
133
133
  }
134
134
  // ── Generic metadata-driven CRUD ─────────────────────────────────
135
135
  //
@@ -158,7 +158,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
158
158
  const auth = await this.Authenticate(ci, contextUser);
159
159
  const baseURL = this.GetBaseURL(ci, auth);
160
160
  const headers = this.BuildHeaders(auth);
161
- const url = this.BuildFullURL(baseURL, obj.CreateAPIPath);
161
+ const url = this.buildFullURL(baseURL, obj.CreateAPIPath);
162
162
  const body = this.BuildOperationBody(ctx.Attributes, obj.CreateBodyShape, obj.CreateBodyKey);
163
163
  const response = await this.MakeHTTPRequest(auth, url, obj.CreateMethod, headers, body);
164
164
  if (response.Status >= 200 && response.Status < 300) {
@@ -183,7 +183,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
183
183
  const auth = await this.Authenticate(ci, contextUser);
184
184
  const baseURL = this.GetBaseURL(ci, auth);
185
185
  const headers = this.BuildHeaders(auth);
186
- const url = this.BuildFullURL(baseURL, this.SubstituteIDInPath(obj.UpdateAPIPath, ctx.ExternalID, obj.UpdateIDLocation));
186
+ const url = this.buildFullURL(baseURL, this.SubstituteIDInPath(obj.UpdateAPIPath, ctx.ExternalID, obj.UpdateIDLocation));
187
187
  const body = this.BuildOperationBody(ctx.Attributes, obj.UpdateBodyShape, obj.UpdateBodyKey);
188
188
  const response = await this.MakeHTTPRequest(auth, url, obj.UpdateMethod, headers, body);
189
189
  if (response.Status >= 200 && response.Status < 300) {
@@ -207,7 +207,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
207
207
  const auth = await this.Authenticate(ci, contextUser);
208
208
  const baseURL = this.GetBaseURL(ci, auth);
209
209
  const headers = this.BuildHeaders(auth);
210
- const url = this.BuildFullURL(baseURL, this.SubstituteIDInPath(obj.DeleteAPIPath, ctx.ExternalID, obj.DeleteIDLocation));
210
+ const url = this.buildFullURL(baseURL, this.SubstituteIDInPath(obj.DeleteAPIPath, ctx.ExternalID, obj.DeleteIDLocation));
211
211
  const response = await this.MakeHTTPRequest(auth, url, obj.DeleteMethod, headers);
212
212
  if (response.Status >= 200 && response.Status < 300) {
213
213
  return { Success: true, StatusCode: response.Status, ExternalID: ctx.ExternalID };
@@ -231,7 +231,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
231
231
  const getPath = obj.UpdateAPIPath
232
232
  ? this.SubstituteIDInPath(obj.UpdateAPIPath, ctx.ExternalID, obj.UpdateIDLocation)
233
233
  : `${obj.APIPath.replace(/\/+$/, '')}/${encodeURIComponent(ctx.ExternalID)}`;
234
- const url = this.BuildFullURL(baseURL, getPath);
234
+ const url = this.buildFullURL(baseURL, getPath);
235
235
  const response = await this.MakeHTTPRequest(auth, url, 'GET', headers);
236
236
  if (response.Status === 404)
237
237
  return null;
@@ -242,7 +242,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
242
242
  if (records.length === 0)
243
243
  return null;
244
244
  const transformed = this.applyTransformPreservingKeys(records[0], obj, fields);
245
- return this.ToExternalRecord(transformed, ctx.ObjectName, this.FindPrimaryKeyFieldNames(fields));
245
+ return this.toExternalRecord(transformed, ctx.ObjectName, this.findPrimaryKeyFieldNames(fields));
246
246
  }
247
247
  // ── CRUD helpers ─────────────────────────────────────────────────
248
248
  /**
@@ -319,12 +319,12 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
319
319
  /**
320
320
  * Fetches records from a flat endpoint (no template variable substitution).
321
321
  */
322
- async FetchFlat(auth, baseURL, obj, fields, ctx) {
323
- const fullPath = this.BuildFullURL(baseURL, obj.APIPath);
324
- const result = await this.FetchWithPagination(auth, fullPath, obj, ctx);
325
- const pkFieldNames = this.FindPrimaryKeyFieldNames(fields);
322
+ async fetchFlat(auth, baseURL, obj, fields, ctx) {
323
+ const fullPath = this.buildFullURL(baseURL, obj.APIPath);
324
+ const result = await this.fetchWithPagination(auth, fullPath, obj, ctx);
325
+ const pkFieldNames = this.findPrimaryKeyFieldNames(fields);
326
326
  return {
327
- Records: result.Records.map(r => this.ToExternalRecord(this.applyTransformPreservingKeys(r, obj, fields), ctx.ObjectName, pkFieldNames)),
327
+ Records: result.Records.map(r => this.toExternalRecord(this.applyTransformPreservingKeys(r, obj, fields), ctx.ObjectName, pkFieldNames)),
328
328
  HasMore: result.HasMore,
329
329
  NextPage: result.NextPage,
330
330
  NextOffset: result.NextOffset,
@@ -344,11 +344,11 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
344
344
  * This is the connector-side realization of the topological traversal the engine
345
345
  * already uses for sync ORDER. A single-var path behaves exactly as before.
346
346
  */
347
- async FetchWithTemplateVars(auth, baseURL, obj, fields, templateVars, ctx) {
347
+ async fetchWithTemplateVars(auth, baseURL, obj, fields, templateVars, ctx) {
348
348
  const resolutions = [];
349
349
  const seenParents = new Set();
350
350
  for (const tVar of templateVars) {
351
- const info = this.ResolveParentForVar(obj, fields, tVar, ctx.CompanyIntegration.IntegrationID);
351
+ const info = this.resolveParentForVar(obj, fields, tVar, ctx.CompanyIntegration.IntegrationID);
352
352
  if (!info) {
353
353
  return { Records: [], HasMore: false, Warnings: [{
354
354
  Code: 'PARENT_UNRESOLVED',
@@ -368,7 +368,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
368
368
  seenParents.add(info.parentObjectID);
369
369
  resolutions.push(info);
370
370
  }
371
- const pkFieldNames = this.FindPrimaryKeyFieldNames(fields);
371
+ const pkFieldNames = this.findPrimaryKeyFieldNames(fields);
372
372
  // ── TOP-LEVEL parent iteration: RESUMABLE + BOUNDED-BATCH + CONCURRENT + ADAPTIVELY RATE-LIMITED ──
373
373
  // A second-layer object fires one request PER PARENT. Doing that for all parents in a single
374
374
  // FetchChanges call (a) blows the engine's per-call op-timeout once there are many parents, and
@@ -381,7 +381,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
381
381
  // child no longer routes through here — the REST DiscoverySampleRecordStream override drives it via
382
382
  // StreamRecordsForDiscovery (which fetches parents live), so FetchWithTemplateVars is sync-exclusive
383
383
  // and an unsynced parent correctly yields ZERO_PARENTS ("sync the parent first").
384
- const allParentIDs = this.SortIdsStable(await this.LoadParentIDs(top.parentObjectID, ctx.ContextUser, []));
384
+ const allParentIDs = this.sortIdsStable(await this.loadParentIDs(top.parentObjectID, ctx.ContextUser, []));
385
385
  if (allParentIDs.length === 0) {
386
386
  const parentObj = IntegrationEngineBase.Instance.GetIntegrationObjectByID(top.parentObjectID);
387
387
  return { Records: [], HasMore: false, Warnings: [{
@@ -391,17 +391,17 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
391
391
  }] };
392
392
  }
393
393
  const after = ctx.AfterKeyValue ?? null;
394
- const remaining = after != null ? allParentIDs.filter(id => this.CompareIds(id, after) > 0) : allParentIDs;
394
+ const remaining = after != null ? allParentIDs.filter(id => this.compareIds(id, after) > 0) : allParentIDs;
395
395
  const batchParents = remaining.slice(0, Math.max(1, this.TemplateVarParentBatchSize()));
396
396
  const out = [];
397
- await this.RunBounded(batchParents, Math.max(1, ctx.MaxConcurrency ?? 1), async (parentID) => {
397
+ await this.runBounded(batchParents, Math.max(1, ctx.MaxConcurrency ?? 1), async (parentID) => {
398
398
  if (ctx.RateLimitAcquire)
399
399
  await ctx.RateLimitAcquire(); // adaptive token (replaces fixed self-throttle)
400
- const nextPath = this.SubstituteTemplateVars(obj.APIPath, top.templateVar, parentID);
400
+ const nextPath = this.substituteTemplateVars(obj.APIPath, top.templateVar, parentID);
401
401
  const nextTags = { [top.fkFieldName]: parentID };
402
402
  const sub = [];
403
403
  try {
404
- await this.DescendTemplateVars(auth, baseURL, obj, fields, resolutions, 1, nextPath, nextTags, [{ objectID: top.parentObjectID, idValue: parentID }], ctx, pkFieldNames, sub);
404
+ await this.descendTemplateVars(auth, baseURL, obj, fields, resolutions, 1, nextPath, nextTags, [{ objectID: top.parentObjectID, idValue: parentID }], ctx, pkFieldNames, sub);
405
405
  ctx.RateLimitReport?.(); // clean fetch → ramp the adaptive rate up
406
406
  }
407
407
  catch (e) {
@@ -457,7 +457,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
457
457
  */
458
458
  async *DiscoverySampleRecordStream(companyIntegration, objectName, contextUser, batchSize, maxRecords, deadlineMs, watchKey) {
459
459
  const obj = this.GetCachedObject(companyIntegration.IntegrationID, objectName);
460
- if (this.DetectTemplateVars(obj.APIPath).length === 0) {
460
+ if (this.detectTemplateVars(obj.APIPath).length === 0) {
461
461
  // FORWARD THE DEADLINE. Dropping it here silently un-bounds every REST connector that
462
462
  // lands on this fallback — which is every connector expressing parent scope as
463
463
  // CONFIGURATION rather than as URL template vars.
@@ -472,7 +472,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
472
472
  return;
473
473
  }
474
474
  let yielded = 0;
475
- for await (const rec of this.StreamRecordsForDiscovery(companyIntegration, obj.ID, contextUser, maxRecords, 0)) {
475
+ for await (const rec of this.streamRecordsForDiscovery(companyIntegration, obj.ID, contextUser, maxRecords, 0)) {
476
476
  yield rec.Fields;
477
477
  if (++yielded >= maxRecords)
478
478
  return;
@@ -495,8 +495,8 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
495
495
  * Record-constrained (unlike sync, which walks ALL rows via the DAG): a million-row ancestor is
496
496
  * streamed and cut off early. Pure HTTP — no SQL, dialect-agnostic.
497
497
  */
498
- async *StreamRecordsForDiscovery(companyIntegration, objectID, contextUser, target, depth) {
499
- const maxDepth = this.ReadDiscoveryConfig(companyIntegration)
498
+ async *streamRecordsForDiscovery(companyIntegration, objectID, contextUser, target, depth) {
499
+ const maxDepth = this.readDiscoveryConfig(companyIntegration)
500
500
  .int('discoverySampleMaxDepth', 'MJ_INTEGRATION_DISCOVERY_SAMPLE_MAX_DEPTH', this.DiscoverySampleMaxDepth());
501
501
  if (depth > maxDepth)
502
502
  return;
@@ -506,13 +506,13 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
506
506
  const fields = this.GetCachedFields(obj.ID);
507
507
  const auth = await this.Authenticate(companyIntegration, contextUser);
508
508
  const baseURL = this.GetBaseURL(companyIntegration, auth);
509
- const templateVars = this.DetectTemplateVars(obj.APIPath);
510
- const pkFieldNames = this.FindPrimaryKeyFieldNames(fields);
509
+ const templateVars = this.detectTemplateVars(obj.APIPath);
510
+ const pkFieldNames = this.findPrimaryKeyFieldNames(fields);
511
511
  // TOP-LEVEL: paginate the flat endpoint lazily; the caller stops pulling at its own target.
512
512
  if (templateVars.length === 0) {
513
513
  let pageCtx = { CompanyIntegration: companyIntegration, ObjectName: obj.Name, WatermarkValue: null, BatchSize: target, ContextUser: contextUser };
514
514
  for (let guard = 0; guard < 100_000; guard++) {
515
- const batch = await this.FetchFlat(auth, baseURL, obj, fields, pageCtx);
515
+ const batch = await this.fetchFlat(auth, baseURL, obj, fields, pageCtx);
516
516
  for (const rec of batch.Records)
517
517
  yield rec;
518
518
  if (!batch.HasMore)
@@ -535,7 +535,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
535
535
  // fields, caught at first real sync via FetchWithTemplateVars — and everything BENEATH it
536
536
  // was previously dead too, which is the cascade this branch exists to end.
537
537
  if (templateVars.length > 1) {
538
- yield* this.StreamMultiVarChildForDiscovery(companyIntegration, obj, fields, templateVars, contextUser, target, depth, auth, baseURL, pkFieldNames);
538
+ yield* this.streamMultiVarChildForDiscovery(companyIntegration, obj, fields, templateVars, contextUser, target, depth, auth, baseURL, pkFieldNames);
539
539
  return;
540
540
  }
541
541
  // CHILD (single template var): stream the PARENT recursively via this SAME routine — so a
@@ -549,7 +549,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
549
549
  // next parent — which lazily pulls the next grandparent, and so on to the highest ancestor. That is
550
550
  // where the "fill to N" completion actually happens — at the top of the dependency chain, not
551
551
  // locally.
552
- const parentInfo = this.ResolveParentForVar(obj, fields, templateVars[0], companyIntegration.IntegrationID);
552
+ const parentInfo = this.resolveParentForVar(obj, fields, templateVars[0], companyIntegration.IntegrationID);
553
553
  if (!parentInfo)
554
554
  return;
555
555
  const parentObj = IntegrationEngineBase.Instance.GetIntegrationObjectByID(parentInfo.parentObjectID);
@@ -567,23 +567,23 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
567
567
  // classifier needs MIN_ROWS_FOR_SIGNIFICANCE rows to call a key significant; buffering the
568
568
  // leaf's full target instead pulled up to 10x that — and because a parent may itself be a
569
569
  // child, those pulls recurse up the whole chain before one child record is yielded.
570
- const classifySampleSize = Math.min(target, this.ReadDiscoveryConfig(companyIntegration)
570
+ const classifySampleSize = Math.min(target, this.readDiscoveryConfig(companyIntegration)
571
571
  .int('discoveryParentKeySampleRows', 'MJ_INTEGRATION_DISCOVERY_PARENT_KEY_SAMPLE_ROWS', this.DiscoveryParentKeySampleRows()));
572
572
  const fetchChildren = async function* (key, parentRec) {
573
573
  const idVal = parentRec.Fields?.[key];
574
574
  if (idVal == null || String(idVal) === '')
575
575
  return;
576
- const path = this.SubstituteTemplateVars(obj.APIPath, parentInfo.templateVar, String(idVal));
577
- const fullURL = this.BuildFullURL(baseURL, path);
576
+ const path = this.substituteTemplateVars(obj.APIPath, parentInfo.templateVar, String(idVal));
577
+ const fullURL = this.buildFullURL(baseURL, path);
578
578
  const ctx = { CompanyIntegration: companyIntegration, ObjectName: obj.Name, WatermarkValue: null, BatchSize: target, ContextUser: contextUser };
579
- const result = await this.FetchWithPagination(auth, fullURL, obj, ctx);
579
+ const result = await this.fetchWithPagination(auth, fullURL, obj, ctx);
580
580
  for (const r of result.Records) {
581
581
  r[parentInfo.fkFieldName] = String(idVal); // tag the resolved parent FK onto the child row
582
582
  const transformed = this.applyTransformPreservingKeys(r, obj, fields);
583
- yield this.ToExternalRecord(transformed, obj.Name, pkFieldNames);
583
+ yield this.toExternalRecord(transformed, obj.Name, pkFieldNames);
584
584
  }
585
585
  }.bind(this);
586
- for await (const parentRec of this.StreamRecordsForDiscovery(companyIntegration, parentInfo.parentObjectID, contextUser, target, depth + 1)) {
586
+ for await (const parentRec of this.streamRecordsForDiscovery(companyIntegration, parentInfo.parentObjectID, contextUser, target, depth + 1)) {
587
587
  if (parentKey) {
588
588
  yield* fetchChildren(parentKey, parentRec);
589
589
  continue;
@@ -594,7 +594,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
594
594
  // above it — which is why it is sized to the classifier, not to the leaf's target.
595
595
  buffer.push(parentRec);
596
596
  if (buffer.length >= classifySampleSize) {
597
- parentKey = await this.ResolveParentKeyField(parentObj, buffer);
597
+ parentKey = await this.resolveParentKeyField(parentObj, buffer);
598
598
  if (!parentKey)
599
599
  return; // parent genuinely keyless → adjourn
600
600
  for (const bp of buffer)
@@ -604,7 +604,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
604
604
  }
605
605
  // Parent stream ended before `target`: classify on whatever we buffered, then flush its children.
606
606
  if (!parentKey && buffer.length > 0) {
607
- parentKey = await this.ResolveParentKeyField(parentObj, buffer);
607
+ parentKey = await this.resolveParentKeyField(parentObj, buffer);
608
608
  if (parentKey)
609
609
  for (const bp of buffer)
610
610
  yield* fetchChildren(parentKey, bp);
@@ -630,11 +630,11 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
630
630
  * parent classification, because it is the same question — "how many rows before we admit this
631
631
  * stream cannot answer".
632
632
  */
633
- async *StreamMultiVarChildForDiscovery(companyIntegration, obj, fields, templateVars, contextUser, target, depth, auth, baseURL, pkFieldNames) {
633
+ async *streamMultiVarChildForDiscovery(companyIntegration, obj, fields, templateVars, contextUser, target, depth, auth, baseURL, pkFieldNames) {
634
634
  // Resolve every var; any unresolvable var means the tuple can never be completed from data.
635
635
  const resolved = [];
636
636
  for (const tVar of templateVars) {
637
- const info = this.ResolveParentForVar(obj, fields, tVar, companyIntegration.IntegrationID);
637
+ const info = this.resolveParentForVar(obj, fields, tVar, companyIntegration.IntegrationID);
638
638
  if (!info) {
639
639
  console.warn(`[DiscoverySampleStream] "${obj.Name}" multi-var: no parent resolves {${tVar}} — adjourning (declared-only fields)`);
640
640
  return;
@@ -647,11 +647,11 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
647
647
  const p = IntegrationEngineBase.Instance.GetIntegrationObjectByID(parentObjectID);
648
648
  if (!p)
649
649
  return -1;
650
- const vars = new Set(this.DetectTemplateVars(p.APIPath).map(v => v.toLowerCase()));
650
+ const vars = new Set(this.detectTemplateVars(p.APIPath).map(v => v.toLowerCase()));
651
651
  return templateVars.filter(v => v.toLowerCase() !== ownVar.toLowerCase() && vars.has(v.toLowerCase())).length;
652
652
  };
653
653
  const candidates = [...resolved].sort((a, b) => otherVarsInPath(b.parentObjectID, b.templateVar) - otherVarsInPath(a.parentObjectID, a.templateVar));
654
- const probeSlice = Math.min(target, this.ReadDiscoveryConfig(companyIntegration)
654
+ const probeSlice = Math.min(target, this.readDiscoveryConfig(companyIntegration)
655
655
  .int('discoveryParentKeySampleRows', 'MJ_INTEGRATION_DISCOVERY_PARENT_KEY_SAMPLE_ROWS', this.DiscoveryParentKeySampleRows()));
656
656
  for (const candidate of candidates) {
657
657
  const parentObj = IntegrationEngineBase.Instance.GetIntegrationObjectByID(candidate.parentObjectID);
@@ -662,7 +662,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
662
662
  // parent's declared key when the record lacks the var-named field.
663
663
  const parentDeclaredKey = this.GetCachedFields(parentObj.ID).find(f => f.IsPrimaryKey)?.Name ?? null;
664
664
  let scanned = 0, covered = 0, yielded = 0;
665
- for await (const parentRec of this.StreamRecordsForDiscovery(companyIntegration, candidate.parentObjectID, contextUser, target, depth + 1)) {
665
+ for await (const parentRec of this.streamRecordsForDiscovery(companyIntegration, candidate.parentObjectID, contextUser, target, depth + 1)) {
666
666
  scanned++;
667
667
  const recFields = parentRec.Fields ?? {};
668
668
  const lower = new Map(Object.entries(recFields).map(([k, v]) => [k.toLowerCase(), v]));
@@ -687,17 +687,17 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
687
687
  covered++;
688
688
  let path = obj.APIPath;
689
689
  for (const [tVar, val] of values)
690
- path = this.SubstituteTemplateVars(path, tVar, val);
691
- const fullURL = this.BuildFullURL(baseURL, path);
690
+ path = this.substituteTemplateVars(path, tVar, val);
691
+ const fullURL = this.buildFullURL(baseURL, path);
692
692
  const ctx = { CompanyIntegration: companyIntegration, ObjectName: obj.Name, WatermarkValue: null, BatchSize: target, ContextUser: contextUser };
693
- const result = await this.FetchWithPagination(auth, fullURL, obj, ctx);
693
+ const result = await this.fetchWithPagination(auth, fullURL, obj, ctx);
694
694
  for (const r of result.Records) {
695
695
  // Tag EVERY resolved fk onto the child row — same contract as the single-var path,
696
696
  // extended to the whole tuple, so the child's FK columns are discoverable.
697
697
  for (const v of resolved)
698
698
  r[v.fkFieldName] = values.get(v.templateVar);
699
699
  const transformed = this.applyTransformPreservingKeys(r, obj, fields);
700
- yield this.ToExternalRecord(transformed, obj.Name, pkFieldNames);
700
+ yield this.toExternalRecord(transformed, obj.Name, pkFieldNames);
701
701
  if (++yielded >= target)
702
702
  return;
703
703
  }
@@ -713,7 +713,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
713
713
  * Returns null when the parent is genuinely keyless (→ the caller adjourns). No conventional identity
714
714
  * name is ever guessed — a name is never assumed for a field the data doesn't prove is the key.
715
715
  */
716
- async ResolveParentKeyField(parentObj, records) {
716
+ async resolveParentKeyField(parentObj, records) {
717
717
  // (1) metadata: a declared PK sticks.
718
718
  const declared = this.GetCachedFields(parentObj.ID).find(f => f.IsPrimaryKey);
719
719
  if (declared)
@@ -732,7 +732,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
732
732
  return null;
733
733
  }
734
734
  /** Reads the discovery knob precedence — per-connection Configuration (int) → operator env → default. */
735
- ReadDiscoveryConfig(ci) {
735
+ readDiscoveryConfig(ci) {
736
736
  let cfg = {};
737
737
  try {
738
738
  if (ci.Configuration)
@@ -751,11 +751,11 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
751
751
  };
752
752
  }
753
753
  /** Stable total order over ID strings — numeric when ALL are integer-like, else lexical. */
754
- SortIdsStable(ids) {
755
- return [...ids].sort((a, b) => this.CompareIds(a, b));
754
+ sortIdsStable(ids) {
755
+ return [...ids].sort((a, b) => this.compareIds(a, b));
756
756
  }
757
757
  /** Total-order comparator matching SortIdsStable, used for keyset resume (id > AfterKeyValue). */
758
- CompareIds(a, b) {
758
+ compareIds(a, b) {
759
759
  const na = Number(a), nb = Number(b);
760
760
  if (Number.isFinite(na) && Number.isFinite(nb) && /^\d+$/.test(a) && /^\d+$/.test(b)) {
761
761
  return na === nb ? 0 : (na < nb ? -1 : 1);
@@ -763,7 +763,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
763
763
  return a < b ? -1 : (a > b ? 1 : 0);
764
764
  }
765
765
  /** Runs `worker` over `items` with at most `concurrency` in flight. Rejects on the first worker error. */
766
- async RunBounded(items, concurrency, worker) {
766
+ async runBounded(items, concurrency, worker) {
767
767
  let idx = 0;
768
768
  const runners = [];
769
769
  const next = async () => {
@@ -788,9 +788,9 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
788
788
  * (all vars substituted) it fetches with pagination and tags each record with the
789
789
  * resolved parent FK values.
790
790
  */
791
- async DescendTemplateVars(auth, baseURL, obj, fields, resolutions, level, path, fkTags, outerStack, ctx, pkFieldNames, out) {
791
+ async descendTemplateVars(auth, baseURL, obj, fields, resolutions, level, path, fkTags, outerStack, ctx, pkFieldNames, out) {
792
792
  if (level >= resolutions.length) {
793
- const fullURL = this.BuildFullURL(baseURL, path);
793
+ const fullURL = this.buildFullURL(baseURL, path);
794
794
  // Leaf-scoped context: the outer ctx.BatchSize bounds how many PARENTS this call
795
795
  // processes (see the resumable AfterKeyValue loop above the first call into this
796
796
  // method) — it is NOT a per-parent record cap. Passing ctx as-is here made
@@ -806,12 +806,12 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
806
806
  // data for an item the engine chose to sync this call; drain it to completion instead
807
807
  // of truncating it.
808
808
  const leafCtx = { ...ctx, BatchSize: Number.MAX_SAFE_INTEGER, CurrentPage: undefined, CurrentOffset: undefined, CurrentCursor: undefined };
809
- const result = await this.FetchWithPagination(auth, fullURL, obj, leafCtx);
809
+ const result = await this.fetchWithPagination(auth, fullURL, obj, leafCtx);
810
810
  for (const r of result.Records) {
811
811
  for (const [k, v] of Object.entries(fkTags))
812
812
  r[k] = v;
813
813
  const transformed = this.applyTransformPreservingKeys(r, obj, fields);
814
- out.push(this.ToExternalRecord(transformed, ctx.ObjectName, pkFieldNames));
814
+ out.push(this.toExternalRecord(transformed, ctx.ObjectName, pkFieldNames));
815
815
  }
816
816
  return;
817
817
  }
@@ -819,15 +819,15 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
819
819
  // Prune to the valid subset: one AND-filter per prior layer this parent has an FK to.
820
820
  const filters = [];
821
821
  for (const prior of outerStack) {
822
- const fkCol = this.FindFKColumnToParent(res.parentObjectID, prior.objectID);
822
+ const fkCol = this.findFKColumnToParent(res.parentObjectID, prior.objectID);
823
823
  if (fkCol)
824
824
  filters.push({ column: fkCol, value: prior.idValue });
825
825
  }
826
- const parentIDs = await this.LoadParentIDs(res.parentObjectID, ctx.ContextUser, filters);
826
+ const parentIDs = await this.loadParentIDs(res.parentObjectID, ctx.ContextUser, filters);
827
827
  for (const parentID of parentIDs) {
828
- const nextPath = this.SubstituteTemplateVars(path, res.templateVar, parentID);
828
+ const nextPath = this.substituteTemplateVars(path, res.templateVar, parentID);
829
829
  const nextTags = { ...fkTags, [res.fkFieldName]: parentID };
830
- await this.DescendTemplateVars(auth, baseURL, obj, fields, resolutions, level + 1, nextPath, nextTags, [...outerStack, { objectID: res.parentObjectID, idValue: parentID }], ctx, pkFieldNames, out);
830
+ await this.descendTemplateVars(auth, baseURL, obj, fields, resolutions, level + 1, nextPath, nextTags, [...outerStack, { objectID: res.parentObjectID, idValue: parentID }], ctx, pkFieldNames, out);
831
831
  }
832
832
  }
833
833
  /**
@@ -842,7 +842,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
842
842
  * Returns null when neither strategy matches.
843
843
  */
844
844
  /** Reads a trimmed string value from an IntegrationObject's Configuration JSON (tolerant of absent/invalid). */
845
- ReadObjectConfigString(obj, key) {
845
+ readObjectConfigString(obj, key) {
846
846
  const raw = obj.Configuration;
847
847
  if (!raw || typeof raw !== 'string')
848
848
  return null;
@@ -858,7 +858,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
858
858
  /** Reads an OBJECT-valued key from an IntegrationObject's Configuration JSON as a string→string map
859
859
  * with lowercased keys (tolerant of absent/invalid). Used for the per-var parent maps that let a
860
860
  * MULTI-LEVEL template-var path resolve each variable to its own parent. */
861
- ReadObjectConfigStringMap(obj, key) {
861
+ readObjectConfigStringMap(obj, key) {
862
862
  const raw = obj.Configuration;
863
863
  if (!raw || typeof raw !== 'string')
864
864
  return null;
@@ -878,7 +878,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
878
878
  return null;
879
879
  }
880
880
  }
881
- ResolveParentForVar(obj, fields, templateVar, integrationID) {
881
+ resolveParentForVar(obj, fields, templateVar, integrationID) {
882
882
  const tVarLower = templateVar.toLowerCase();
883
883
  const siblingObjects = IntegrationEngineBase.Instance.GetActiveIntegrationObjects(integrationID);
884
884
  // Strategy A0 (PER-VAR MAP — for MULTI-LEVEL template-var paths): a path with MORE THAN ONE var
@@ -890,13 +890,13 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
890
890
  // parent. Checked FIRST; absent → falls through to the single-valued Strategy A. Backward-compatible
891
891
  // (existing single-parent connectors declare no parentObjectNames and are unaffected). By-name only —
892
892
  // no guessing; an unmatched entry is a LOUD skip like Strategy A.
893
- const perVarMap = this.ReadObjectConfigStringMap(obj, 'parentObjectNames');
893
+ const perVarMap = this.readObjectConfigStringMap(obj, 'parentObjectNames');
894
894
  if (perVarMap) {
895
895
  const parentName = perVarMap[tVarLower];
896
896
  if (parentName) {
897
897
  const parent = siblingObjects.find(s => s.Name.toLowerCase() === parentName.toLowerCase());
898
898
  if (parent) {
899
- const fkMap = this.ReadObjectConfigStringMap(obj, 'parentObjectIDFieldNames');
899
+ const fkMap = this.readObjectConfigStringMap(obj, 'parentObjectIDFieldNames');
900
900
  const fkFieldName = (fkMap && fkMap[tVarLower]) || templateVar;
901
901
  return { templateVar, fkFieldName, parentObjectID: parent.ID };
902
902
  }
@@ -908,11 +908,11 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
908
908
  // Configuration.parentObjectName (the extractor emits this for second-layer / {param} objects). A
909
909
  // by-name reference needs NO RelatedIntegrationObjectID FK-UUID — which a dense @lookup FK graph
910
910
  // often can't deploy (same-transaction rollback). When a valid declaration is present it WINS.
911
- const declaredParent = this.ReadObjectConfigString(obj, 'parentObjectName');
911
+ const declaredParent = this.readObjectConfigString(obj, 'parentObjectName');
912
912
  if (declaredParent) {
913
913
  const parent = siblingObjects.find(s => s.Name.toLowerCase() === declaredParent.toLowerCase());
914
914
  if (parent) {
915
- const fkFieldName = this.ReadObjectConfigString(obj, 'parentObjectIDFieldName') ?? templateVar;
915
+ const fkFieldName = this.readObjectConfigString(obj, 'parentObjectIDFieldName') ?? templateVar;
916
916
  return { templateVar, fkFieldName, parentObjectID: parent.ID };
917
917
  }
918
918
  console.warn(`[BaseRESTIntegrationConnector] "${obj.Name}": Configuration.parentObjectName="${declaredParent}" ` +
@@ -940,7 +940,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
940
940
  * filter a child level by its parent in a nested path. Returns null when no FK links
941
941
  * them, in which case that level loads unfiltered (independent vars / cartesian).
942
942
  */
943
- FindFKColumnToParent(innerObjectID, outerObjectID) {
943
+ findFKColumnToParent(innerObjectID, outerObjectID) {
944
944
  const innerFields = IntegrationEngineBase.Instance.GetIntegrationObjectFields(innerObjectID);
945
945
  const fk = innerFields.find(f => f.RelatedIntegrationObjectID && UUIDsEqual(f.RelatedIntegrationObjectID, outerObjectID));
946
946
  return fk ? fk.Name : null;
@@ -950,7 +950,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
950
950
  * Uses IntegrationEngineBase cache for object/field metadata lookups,
951
951
  * then queries the MJ entity via RunView for actual synced record IDs.
952
952
  */
953
- async LoadParentIDs(parentObjectID, contextUser, filters) {
953
+ async loadParentIDs(parentObjectID, contextUser, filters) {
954
954
  // Use engine cache for metadata lookups
955
955
  const parentObj = IntegrationEngineBase.Instance.GetIntegrationObjectByID(parentObjectID);
956
956
  if (!parentObj) {
@@ -992,16 +992,16 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
992
992
  * Fetches records from a single URL with pagination support.
993
993
  * Loops through pages until no more data or maxRecords is reached.
994
994
  */
995
- async FetchWithPagination(auth, basePath, obj, ctx) {
995
+ async fetchWithPagination(auth, basePath, obj, ctx) {
996
996
  if (!obj.SupportsPagination || obj.PaginationType === 'None') {
997
- return this.FetchSinglePage(auth, basePath, obj);
997
+ return this.fetchSinglePage(auth, basePath, obj);
998
998
  }
999
- return this.FetchPaginatedLoop(auth, basePath, obj, ctx);
999
+ return this.fetchPaginatedLoop(auth, basePath, obj, ctx);
1000
1000
  }
1001
1001
  /**
1002
1002
  * Fetches a single non-paginated page.
1003
1003
  */
1004
- async FetchSinglePage(auth, url, obj) {
1004
+ async fetchSinglePage(auth, url, obj) {
1005
1005
  const requestURL = this.AppendDefaultQueryParams(url, obj);
1006
1006
  const headers = this.BuildHeaders(auth);
1007
1007
  const response = await this.MakeHTTPRequest(auth, requestURL, 'GET', headers);
@@ -1011,7 +1011,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1011
1011
  `Skipping this object for this sync run. URL: ${requestURL}`);
1012
1012
  return { Records: [], HasMore: false };
1013
1013
  }
1014
- this.ValidateHTTPResponse(response, requestURL);
1014
+ this.validateHTTPResponse(response, requestURL);
1015
1015
  const records = this.NormalizeResponse(response.Body, obj.ResponseDataKey);
1016
1016
  return { Records: records, HasMore: false };
1017
1017
  }
@@ -1022,7 +1022,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1022
1022
  * Cursor state is maintained internally within the batch, avoiding the need to
1023
1023
  * externalize it through FetchBatchResult (which would break cursor-based connectors).
1024
1024
  */
1025
- async FetchPaginatedLoop(auth, basePath, obj, ctx) {
1025
+ async fetchPaginatedLoop(auth, basePath, obj, ctx) {
1026
1026
  const allRecords = [];
1027
1027
  const batchLimit = ctx.BatchSize ?? Number.MAX_SAFE_INTEGER;
1028
1028
  let page = ctx.CurrentPage ?? 1;
@@ -1044,7 +1044,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1044
1044
  `Skipping this object for this sync run. URL: ${requestURL}`);
1045
1045
  return { Records: allRecords, HasMore: false };
1046
1046
  }
1047
- this.ValidateHTTPResponse(response, requestURL);
1047
+ this.validateHTTPResponse(response, requestURL);
1048
1048
  const records = this.NormalizeResponse(response.Body, obj.ResponseDataKey);
1049
1049
  if (records.length === 0) {
1050
1050
  hasMore = false;
@@ -1078,7 +1078,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1078
1078
  /**
1079
1079
  * Combines baseURL and apiPath into a full URL.
1080
1080
  */
1081
- BuildFullURL(baseURL, apiPath) {
1081
+ buildFullURL(baseURL, apiPath) {
1082
1082
  const base = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL;
1083
1083
  const path = apiPath.startsWith('/') ? apiPath : `/${apiPath}`;
1084
1084
  return `${base}${path}`;
@@ -1121,7 +1121,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1121
1121
  if (entries.length === 0)
1122
1122
  return url;
1123
1123
  // Extract existing param keys from the URL (case-insensitive) to avoid duplicates
1124
- const existingKeys = this.ExtractURLParamKeys(url);
1124
+ const existingKeys = this.extractURLParamKeys(url);
1125
1125
  // Filter out any default params whose key already exists in the URL
1126
1126
  const filtered = entries.filter(([k]) => !existingKeys.has(k.toLowerCase()));
1127
1127
  if (filtered.length === 0)
@@ -1141,7 +1141,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1141
1141
  * Extracts query parameter keys from a URL, returned as a Set of lowercase strings.
1142
1142
  * Used to detect duplicates between pagination params and DefaultQueryParams.
1143
1143
  */
1144
- ExtractURLParamKeys(url) {
1144
+ extractURLParamKeys(url) {
1145
1145
  const keys = new Set();
1146
1146
  const qIndex = url.indexOf('?');
1147
1147
  if (qIndex < 0)
@@ -1159,14 +1159,14 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1159
1159
  * Detects template variables in an API path. Template variables use
1160
1160
  * the format {VariableName} (e.g., "/profiles/{ProfileID}/events").
1161
1161
  */
1162
- DetectTemplateVars(apiPath) {
1162
+ detectTemplateVars(apiPath) {
1163
1163
  const matches = apiPath.match(/\{(\w+)\}/g);
1164
1164
  return matches ? matches.map(m => m.slice(1, -1)) : [];
1165
1165
  }
1166
1166
  /**
1167
1167
  * Substitutes a single template variable in a path.
1168
1168
  */
1169
- SubstituteTemplateVars(apiPath, varName, value) {
1169
+ substituteTemplateVars(apiPath, varName, value) {
1170
1170
  return apiPath.replace(`{${varName}}`, encodeURIComponent(value));
1171
1171
  }
1172
1172
  // ── Cached metadata accessors ───────────────────────────────────
@@ -1225,7 +1225,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1225
1225
  * Converts a raw API record object to the ExternalRecord format.
1226
1226
  * For composite primary keys, joins all PK values with '|' to form a unique ExternalID.
1227
1227
  */
1228
- ToExternalRecord(raw, objectType, pkFieldNames) {
1228
+ toExternalRecord(raw, objectType, pkFieldNames) {
1229
1229
  // §4 synthetic-PK fallback: only treat the PK as usable when EVERY component is present
1230
1230
  // (a composite key with a missing part — e.g. "abc|" — is not a stable identity). When any
1231
1231
  // part is missing, fall back to a deterministic content-derived identity (identity hash) so
@@ -1234,9 +1234,9 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1234
1234
  // so an object-valued PK (a connector that surfaces a nested {id,...} blob as its key) yields
1235
1235
  // a stable, distinct ExternalID instead of every record collapsing to "[object Object]".
1236
1236
  const allPkPresent = pkFieldNames.length > 0
1237
- && pkFieldNames.every(name => raw[name] != null && serializeKeyValue(raw[name]).length > 0);
1238
- const externalID = pkFieldNames.map(name => serializeKeyValue(raw[name])).join('|');
1239
- const resolvedID = allPkPresent ? externalID : computeContentHash(raw);
1237
+ && pkFieldNames.every(name => raw[name] != null && SerializeKeyValue(raw[name]).length > 0);
1238
+ const externalID = pkFieldNames.map(name => SerializeKeyValue(raw[name])).join('|');
1239
+ const resolvedID = allPkPresent ? externalID : ComputeContentHash(raw);
1240
1240
  // §4 cont'd — write the synthetic identity INTO the PK column. When the source never populates the
1241
1241
  // declared PK (nested/derived records: contact phones, event sponsors, scheduled billing, …) the row
1242
1242
  // has no usable storage key: the codegen-generated spCreate reloads the inserted row `WHERE [pk]=@pk`,
@@ -1246,7 +1246,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1246
1246
  // are idempotent (same content → same hash → upsert match). Single-PK only; the full source record is
1247
1247
  // otherwise preserved (full-record pass-through), so this never drops a source key.
1248
1248
  let fields = raw;
1249
- if (!allPkPresent && pkFieldNames.length === 1 && (raw[pkFieldNames[0]] == null || serializeKeyValue(raw[pkFieldNames[0]]).length === 0)) {
1249
+ if (!allPkPresent && pkFieldNames.length === 1 && (raw[pkFieldNames[0]] == null || SerializeKeyValue(raw[pkFieldNames[0]]).length === 0)) {
1250
1250
  fields = { ...raw, [pkFieldNames[0]]: resolvedID };
1251
1251
  }
1252
1252
  return {
@@ -1260,7 +1260,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1260
1260
  * sorted by Sequence. For composite PKs, returns all PK fields.
1261
1261
  * Falls back to ["ID"] if no PK fields are explicitly marked.
1262
1262
  */
1263
- FindPrimaryKeyFieldNames(fields) {
1263
+ findPrimaryKeyFieldNames(fields) {
1264
1264
  const pkFields = fields
1265
1265
  .filter(f => f.IsPrimaryKey)
1266
1266
  .sort((a, b) => a.Sequence - b.Sequence);
@@ -1269,7 +1269,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1269
1269
  /**
1270
1270
  * Converts an IntegrationObjectFieldEntity to the ExternalFieldSchema format.
1271
1271
  */
1272
- FieldEntityToSchema(f) {
1272
+ fieldEntityToSchema(f) {
1273
1273
  return {
1274
1274
  Name: f.Name,
1275
1275
  Label: f.DisplayName ?? f.Name,
@@ -1286,8 +1286,8 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1286
1286
  * Builds a SourceObjectInfo from an IntegrationObject and its fields.
1287
1287
  * Resolves FK relationships using the RelatedIntegrationObjectID.
1288
1288
  */
1289
- BuildSourceObjectInfo(obj, fields, allObjects) {
1290
- const relationships = this.BuildRelationships(fields, allObjects);
1289
+ buildSourceObjectInfo(obj, fields, allObjects) {
1290
+ const relationships = this.buildRelationships(fields, allObjects);
1291
1291
  return {
1292
1292
  ExternalName: obj.Name,
1293
1293
  ExternalLabel: obj.DisplayName ?? obj.Name,
@@ -1313,7 +1313,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1313
1313
  /**
1314
1314
  * Builds SourceRelationshipInfo entries from FK fields.
1315
1315
  */
1316
- BuildRelationships(fields, allObjects) {
1316
+ buildRelationships(fields, allObjects) {
1317
1317
  const relationships = [];
1318
1318
  for (const field of fields) {
1319
1319
  if (!field.RelatedIntegrationObjectID)
@@ -1333,7 +1333,7 @@ export class BaseRESTIntegrationConnector extends BaseIntegrationConnector {
1333
1333
  /**
1334
1334
  * Validates an HTTP response and throws a descriptive error on non-2xx status.
1335
1335
  */
1336
- ValidateHTTPResponse(response, url) {
1336
+ validateHTTPResponse(response, url) {
1337
1337
  if (response.Status < 200 || response.Status >= 300) {
1338
1338
  const bodyPreview = typeof response.Body === 'string'
1339
1339
  ? response.Body.slice(0, 500)