@memberjunction/integration-connectors 5.51.0 → 6.1.0-edge.0
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/LICENSE +7 -0
- package/README.md +109 -277
- package/dist/index.d.ts +0 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -38
- package/dist/index.js.map +1 -1
- package/package.json +14 -19
- package/dist/AptifyConnector.d.ts +0 -95
- package/dist/AptifyConnector.d.ts.map +0 -1
- package/dist/AptifyConnector.js +0 -760
- package/dist/AptifyConnector.js.map +0 -1
- package/dist/BlackbaudConnector.d.ts +0 -64
- package/dist/BlackbaudConnector.d.ts.map +0 -1
- package/dist/BlackbaudConnector.js +0 -916
- package/dist/BlackbaudConnector.js.map +0 -1
- package/dist/ConstantContactConnector.d.ts +0 -137
- package/dist/ConstantContactConnector.d.ts.map +0 -1
- package/dist/ConstantContactConnector.js +0 -663
- package/dist/ConstantContactConnector.js.map +0 -1
- package/dist/CventConnector.d.ts +0 -146
- package/dist/CventConnector.d.ts.map +0 -1
- package/dist/CventConnector.js +0 -540
- package/dist/CventConnector.js.map +0 -1
- package/dist/DynamicsDataverseConnector.d.ts +0 -296
- package/dist/DynamicsDataverseConnector.d.ts.map +0 -1
- package/dist/DynamicsDataverseConnector.js +0 -790
- package/dist/DynamicsDataverseConnector.js.map +0 -1
- package/dist/FileFeedConnector.d.ts +0 -64
- package/dist/FileFeedConnector.d.ts.map +0 -1
- package/dist/FileFeedConnector.js +0 -190
- package/dist/FileFeedConnector.js.map +0 -1
- package/dist/FontevaConnector.d.ts +0 -153
- package/dist/FontevaConnector.d.ts.map +0 -1
- package/dist/FontevaConnector.js +0 -421
- package/dist/FontevaConnector.js.map +0 -1
- package/dist/GrowthZoneConnector.d.ts +0 -183
- package/dist/GrowthZoneConnector.d.ts.map +0 -1
- package/dist/GrowthZoneConnector.js +0 -702
- package/dist/GrowthZoneConnector.js.map +0 -1
- package/dist/HivebriteConnector.d.ts +0 -151
- package/dist/HivebriteConnector.d.ts.map +0 -1
- package/dist/HivebriteConnector.js +0 -533
- package/dist/HivebriteConnector.js.map +0 -1
- package/dist/HubSpotConnector.d.ts +0 -523
- package/dist/HubSpotConnector.d.ts.map +0 -1
- package/dist/HubSpotConnector.js +0 -3110
- package/dist/HubSpotConnector.js.map +0 -1
- package/dist/IMISConnector.d.ts +0 -171
- package/dist/IMISConnector.d.ts.map +0 -1
- package/dist/IMISConnector.js +0 -695
- package/dist/IMISConnector.js.map +0 -1
- package/dist/MJToMJConnector.d.ts +0 -279
- package/dist/MJToMJConnector.d.ts.map +0 -1
- package/dist/MJToMJConnector.js +0 -893
- package/dist/MJToMJConnector.js.map +0 -1
- package/dist/MagnetMailConnector.d.ts +0 -163
- package/dist/MagnetMailConnector.d.ts.map +0 -1
- package/dist/MagnetMailConnector.js +0 -823
- package/dist/MagnetMailConnector.js.map +0 -1
- package/dist/MailchimpConnector.d.ts +0 -197
- package/dist/MailchimpConnector.d.ts.map +0 -1
- package/dist/MailchimpConnector.js +0 -791
- package/dist/MailchimpConnector.js.map +0 -1
- package/dist/MemberSuiteConnector.d.ts +0 -185
- package/dist/MemberSuiteConnector.d.ts.map +0 -1
- package/dist/MemberSuiteConnector.js +0 -762
- package/dist/MemberSuiteConnector.js.map +0 -1
- package/dist/NeonCRMConnector.d.ts +0 -273
- package/dist/NeonCRMConnector.d.ts.map +0 -1
- package/dist/NeonCRMConnector.js +0 -1039
- package/dist/NeonCRMConnector.js.map +0 -1
- package/dist/NetForumConnector.d.ts +0 -170
- package/dist/NetForumConnector.d.ts.map +0 -1
- package/dist/NetForumConnector.js +0 -778
- package/dist/NetForumConnector.js.map +0 -1
- package/dist/NetSuiteConnector.d.ts +0 -136
- package/dist/NetSuiteConnector.d.ts.map +0 -1
- package/dist/NetSuiteConnector.js +0 -703
- package/dist/NetSuiteConnector.js.map +0 -1
- package/dist/NimbleAMSConnector.d.ts +0 -142
- package/dist/NimbleAMSConnector.d.ts.map +0 -1
- package/dist/NimbleAMSConnector.js +0 -703
- package/dist/NimbleAMSConnector.js.map +0 -1
- package/dist/NoviConnector.d.ts +0 -178
- package/dist/NoviConnector.d.ts.map +0 -1
- package/dist/NoviConnector.js +0 -566
- package/dist/NoviConnector.js.map +0 -1
- package/dist/ORCIDConnector.d.ts +0 -207
- package/dist/ORCIDConnector.d.ts.map +0 -1
- package/dist/ORCIDConnector.js +0 -708
- package/dist/ORCIDConnector.js.map +0 -1
- package/dist/OpenWaterConnector.d.ts +0 -173
- package/dist/OpenWaterConnector.d.ts.map +0 -1
- package/dist/OpenWaterConnector.js +0 -893
- package/dist/OpenWaterConnector.js.map +0 -1
- package/dist/PathLMSConnector.d.ts +0 -395
- package/dist/PathLMSConnector.d.ts.map +0 -1
- package/dist/PathLMSConnector.js +0 -1281
- package/dist/PathLMSConnector.js.map +0 -1
- package/dist/PheedLoopConnector.d.ts +0 -119
- package/dist/PheedLoopConnector.d.ts.map +0 -1
- package/dist/PheedLoopConnector.js +0 -429
- package/dist/PheedLoopConnector.js.map +0 -1
- package/dist/PropFuelConnector.d.ts +0 -153
- package/dist/PropFuelConnector.d.ts.map +0 -1
- package/dist/PropFuelConnector.js +0 -450
- package/dist/PropFuelConnector.js.map +0 -1
- package/dist/QuickBooksConnector.d.ts +0 -92
- package/dist/QuickBooksConnector.d.ts.map +0 -1
- package/dist/QuickBooksConnector.js +0 -713
- package/dist/QuickBooksConnector.js.map +0 -1
- package/dist/RasaConnector.d.ts +0 -152
- package/dist/RasaConnector.d.ts.map +0 -1
- package/dist/RasaConnector.js +0 -929
- package/dist/RasaConnector.js.map +0 -1
- package/dist/Reach360Connector.d.ts +0 -175
- package/dist/Reach360Connector.d.ts.map +0 -1
- package/dist/Reach360Connector.js +0 -796
- package/dist/Reach360Connector.js.map +0 -1
- package/dist/RelationalDBConnector.d.ts +0 -108
- package/dist/RelationalDBConnector.d.ts.map +0 -1
- package/dist/RelationalDBConnector.js +0 -228
- package/dist/RelationalDBConnector.js.map +0 -1
- package/dist/RhythmConnector.d.ts +0 -188
- package/dist/RhythmConnector.d.ts.map +0 -1
- package/dist/RhythmConnector.js +0 -784
- package/dist/RhythmConnector.js.map +0 -1
- package/dist/SageIntacctConnector.d.ts +0 -337
- package/dist/SageIntacctConnector.d.ts.map +0 -1
- package/dist/SageIntacctConnector.js +0 -2081
- package/dist/SageIntacctConnector.js.map +0 -1
- package/dist/SalesforceConnector.d.ts +0 -461
- package/dist/SalesforceConnector.d.ts.map +0 -1
- package/dist/SalesforceConnector.js +0 -1862
- package/dist/SalesforceConnector.js.map +0 -1
- package/dist/SharePointConnector.d.ts +0 -188
- package/dist/SharePointConnector.d.ts.map +0 -1
- package/dist/SharePointConnector.js +0 -716
- package/dist/SharePointConnector.js.map +0 -1
- package/dist/WicketConnector.d.ts +0 -252
- package/dist/WicketConnector.d.ts.map +0 -1
- package/dist/WicketConnector.js +0 -938
- package/dist/WicketConnector.js.map +0 -1
- package/dist/WildApricotConnector.d.ts +0 -201
- package/dist/WildApricotConnector.d.ts.map +0 -1
- package/dist/WildApricotConnector.js +0 -1129
- package/dist/WildApricotConnector.js.map +0 -1
- package/dist/YourMembershipConnector.d.ts +0 -349
- package/dist/YourMembershipConnector.d.ts.map +0 -1
- package/dist/YourMembershipConnector.js +0 -4062
- package/dist/YourMembershipConnector.js.map +0 -1
- package/dist/generate-integration-actions.d.ts +0 -23
- package/dist/generate-integration-actions.d.ts.map +0 -1
- package/dist/generate-integration-actions.js +0 -201
- package/dist/generate-integration-actions.js.map +0 -1
package/dist/FontevaConnector.js
DELETED
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { RegisterClass } from '@memberjunction/global';
|
|
8
|
-
import { IntegrationEngineBase } from '@memberjunction/integration-engine-base';
|
|
9
|
-
import { BaseIntegrationConnector, } from '@memberjunction/integration-engine';
|
|
10
|
-
import { SalesforceConnector } from './SalesforceConnector.js';
|
|
11
|
-
// ─── Constants ────────────────────────────────────────────────────────
|
|
12
|
-
const DEFAULT_MANAGED_PACKAGE_NAMESPACES = ['orderapi', 'eventapi'];
|
|
13
|
-
const DEFAULT_FDSERVICE_BASE_PATH = '/services/apexrest/FDService';
|
|
14
|
-
// ─── FontevaConnector ──────────────────────────────────────────────────
|
|
15
|
-
/**
|
|
16
|
-
* Fonteva AMS connector.
|
|
17
|
-
*
|
|
18
|
-
* Fonteva is a Salesforce **managed package** (the OrderApi__ and EventApi__
|
|
19
|
-
* namespaces), so it rides the core Salesforce REST infrastructure verbatim.
|
|
20
|
-
* This connector therefore COMPOSES on {@link SalesforceConnector}, reusing —
|
|
21
|
-
* unchanged — its:
|
|
22
|
-
* - Salesforce OAuth2 bearer authentication (JWT-bearer / client-credentials),
|
|
23
|
-
* - global describe object discovery (`/services/data/vXX/sobjects/`),
|
|
24
|
-
* - per-object `/describe` field discovery,
|
|
25
|
-
* - SOQL incremental fetch with `nextRecordsUrl` cursor pagination,
|
|
26
|
-
* - `SystemModstamp` watermark incremental sync,
|
|
27
|
-
* - generic sObject CRUD (POST/PATCH/DELETE) and the `BuildCreatedResult`
|
|
28
|
-
* loud-fail-on-empty-ID write contract.
|
|
29
|
-
*
|
|
30
|
-
* The Fonteva-specific layer added here is intentionally thin:
|
|
31
|
-
* 1. **Namespace scoping** — `DiscoverObjects` filters the inherited Salesforce
|
|
32
|
-
* global describe down to the managed-package namespaces (OrderApi__ /
|
|
33
|
-
* EventApi__), so the connector surfaces ONLY Fonteva AMS objects (the
|
|
34
|
-
* standard SF CRM objects are the SalesforceConnector's job).
|
|
35
|
-
* 2. **IO-name ↔ backing-sObject translation** — the friendly IO `Name`
|
|
36
|
-
* ("Assignment") is mapped to its real sObject API name
|
|
37
|
-
* ("OrderApi__Assignment__c", read from the IO's Configuration) before
|
|
38
|
-
* every inherited Salesforce operation, and the returned records'
|
|
39
|
-
* `ObjectType` is rewritten back to the IO name for engine identity.
|
|
40
|
-
* 3. **FDService domain services** — the `/services/apexrest/FDService/*` Apex
|
|
41
|
-
* REST services are wired as an opt-in read path with the documented
|
|
42
|
-
* SearchRequest filter/fields/sort/limit query params.
|
|
43
|
-
*
|
|
44
|
-
* Discovery is the live global-describe MECHANISM (no baked catalog); the object
|
|
45
|
-
* universe is Declared (docs) + Discovered (runtime describe). Writes use the
|
|
46
|
-
* inherited generic sObject CRUD; FDService write shapes are not idiosyncratic
|
|
47
|
-
* enough to warrant overriding the sObject write path (the metadata routes all
|
|
48
|
-
* writes through the platform sObject endpoints).
|
|
49
|
-
*/
|
|
50
|
-
let FontevaConnector = class FontevaConnector extends SalesforceConnector {
|
|
51
|
-
constructor() {
|
|
52
|
-
super(...arguments);
|
|
53
|
-
this._fontevaConfig = null;
|
|
54
|
-
}
|
|
55
|
-
// ─── Identity (three-way invariant) ──────────────────────────────
|
|
56
|
-
get IntegrationName() { return 'Fonteva'; }
|
|
57
|
-
/**
|
|
58
|
-
* AUTHORITATIVE discovery (inherited rationale): the scoped global describe
|
|
59
|
-
* enumerates the COMPLETE set of Fonteva managed-package objects the
|
|
60
|
-
* credentials expose, so absence in a refresh genuinely means the object was
|
|
61
|
-
* removed and the engine may safely deactivate it. Kept explicit so the
|
|
62
|
-
* Fonteva-scoped filter doesn't quietly inherit a non-authoritative default.
|
|
63
|
-
*/
|
|
64
|
-
get DiscoveryIsAuthoritative() { return true; }
|
|
65
|
-
// ─── Config ──────────────────────────────────────────────────────
|
|
66
|
-
/**
|
|
67
|
-
* Parses the integration-level Configuration JSON for the Fonteva-specific
|
|
68
|
-
* knobs (managed-package namespaces, FDService base path, opt-in FDService
|
|
69
|
-
* read). Tolerant of missing/invalid Configuration — falls back to documented
|
|
70
|
-
* defaults so a freshly-seeded integration works without extra config.
|
|
71
|
-
*/
|
|
72
|
-
GetFontevaConfig(companyIntegration) {
|
|
73
|
-
if (this._fontevaConfig)
|
|
74
|
-
return this._fontevaConfig;
|
|
75
|
-
const defaults = {
|
|
76
|
-
ManagedPackageNamespaces: [...DEFAULT_MANAGED_PACKAGE_NAMESPACES],
|
|
77
|
-
FDServiceBasePath: DEFAULT_FDSERVICE_BASE_PATH,
|
|
78
|
-
UseFDServiceForRead: false,
|
|
79
|
-
};
|
|
80
|
-
const raw = companyIntegration.Configuration;
|
|
81
|
-
if (!raw) {
|
|
82
|
-
this._fontevaConfig = defaults;
|
|
83
|
-
return defaults;
|
|
84
|
-
}
|
|
85
|
-
try {
|
|
86
|
-
const parsed = JSON.parse(raw);
|
|
87
|
-
const namespaces = Array.isArray(parsed['ManagedPackageNamespaces'])
|
|
88
|
-
? parsed['ManagedPackageNamespaces']
|
|
89
|
-
.filter((n) => typeof n === 'string')
|
|
90
|
-
.map(n => n.toLowerCase())
|
|
91
|
-
: defaults.ManagedPackageNamespaces;
|
|
92
|
-
const fdBasePath = typeof parsed['FDServiceBasePath'] === 'string'
|
|
93
|
-
? parsed['FDServiceBasePath']
|
|
94
|
-
: defaults.FDServiceBasePath;
|
|
95
|
-
const useFDService = parsed['UseFDServiceForRead'] === true;
|
|
96
|
-
this._fontevaConfig = {
|
|
97
|
-
ManagedPackageNamespaces: namespaces.length > 0 ? namespaces : defaults.ManagedPackageNamespaces,
|
|
98
|
-
FDServiceBasePath: fdBasePath,
|
|
99
|
-
UseFDServiceForRead: useFDService,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
this._fontevaConfig = defaults;
|
|
104
|
-
}
|
|
105
|
-
return this._fontevaConfig;
|
|
106
|
-
}
|
|
107
|
-
// ─── Discovery (scoped to the managed-package namespaces) ────────
|
|
108
|
-
/**
|
|
109
|
-
* Discovers Fonteva objects by reusing the inherited Salesforce global
|
|
110
|
-
* describe and filtering it to the managed-package namespaces. NO baked
|
|
111
|
-
* catalog — the list comes entirely from the live `/sobjects/` describe; this
|
|
112
|
-
* method only scopes it and presents the friendly (namespace-stripped) IO name.
|
|
113
|
-
*/
|
|
114
|
-
async DiscoverObjects(companyIntegration, contextUser) {
|
|
115
|
-
const cfg = this.GetFontevaConfig(companyIntegration);
|
|
116
|
-
const all = await super.DiscoverObjects(companyIntegration, contextUser);
|
|
117
|
-
const sObjectToIOName = this.BuildBackingSObjectReverseMap(companyIntegration);
|
|
118
|
-
return all
|
|
119
|
-
.filter(o => this.IsInManagedPackage(o.Name, cfg.ManagedPackageNamespaces))
|
|
120
|
-
.map(o => ({
|
|
121
|
-
...o,
|
|
122
|
-
// Prefer the DECLARED IO name whose Configuration.BackingSObject matches this sObject —
|
|
123
|
-
// this lets IOs whose name diverges from the mechanical derivation map correctly
|
|
124
|
-
// (Term → OrderApi__Renewal__c, EventChatterGroup → EventApi__Event_Chatter_Groups__c).
|
|
125
|
-
// Fall back to the mechanical namespace-strip + PascalCase when no declared mapping exists
|
|
126
|
-
// (a genuinely Discovered object the metadata doesn't yet name).
|
|
127
|
-
Name: sObjectToIOName.get(o.Name.toLowerCase()) ?? this.SObjectToFriendlyName(o.Name),
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Builds a reverse map (lower-cased backing sObject API name → declared IO Name) from the
|
|
132
|
-
* loaded metadata — the inverse of {@link ResolveBackingSObject}. Used at discovery time so a
|
|
133
|
-
* discovered sObject resolves to the IO the metadata actually declares for it, instead of a
|
|
134
|
-
* mechanically-derived name that may not round-trip (singular/plural, wrapper-vs-sObject renames).
|
|
135
|
-
* Returns an empty map when the engine cache isn't populated (e.g. unit tests) — callers then
|
|
136
|
-
* fall back to {@link SObjectToFriendlyName}.
|
|
137
|
-
*/
|
|
138
|
-
BuildBackingSObjectReverseMap(companyIntegration) {
|
|
139
|
-
const map = new Map();
|
|
140
|
-
try {
|
|
141
|
-
const ios = IntegrationEngineBase.Instance.IntegrationObjects.filter(io => io.IntegrationID === companyIntegration.IntegrationID);
|
|
142
|
-
for (const io of ios) {
|
|
143
|
-
if (!io.Configuration)
|
|
144
|
-
continue;
|
|
145
|
-
try {
|
|
146
|
-
const objCfg = JSON.parse(io.Configuration);
|
|
147
|
-
if (objCfg.BackingSObject)
|
|
148
|
-
map.set(objCfg.BackingSObject.toLowerCase(), io.Name);
|
|
149
|
-
}
|
|
150
|
-
catch { /* unparseable Configuration — skip this IO */ }
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
catch { /* engine cache unavailable — caller falls back to mechanical derivation */ }
|
|
154
|
-
return map;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Discovers fields for a Fonteva object. Translates the friendly IO name back
|
|
158
|
-
* to its backing sObject API name, then reuses the inherited Salesforce
|
|
159
|
-
* `/describe` field discovery verbatim.
|
|
160
|
-
*/
|
|
161
|
-
async DiscoverFields(companyIntegration, objectName, contextUser) {
|
|
162
|
-
const sObject = this.ResolveBackingSObject(companyIntegration, objectName);
|
|
163
|
-
return super.DiscoverFields(companyIntegration, sObject, contextUser);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Full schema introspection scoped to the managed-package namespaces. Defers
|
|
167
|
-
* entirely to the inherited Salesforce introspection (which calls
|
|
168
|
-
* DiscoverObjects — overridden here to scope — then `/describe`s each), but
|
|
169
|
-
* re-resolves any caller-supplied ObjectNames (friendly IO names) to their
|
|
170
|
-
* backing sObjects so the inherited describe loop targets real sObjects.
|
|
171
|
-
*/
|
|
172
|
-
async IntrospectSchema(companyIntegration, contextUser, options) {
|
|
173
|
-
if (options?.ObjectNames && options.ObjectNames.length > 0) {
|
|
174
|
-
const resolved = options.ObjectNames.map(n => this.ResolveBackingSObject(companyIntegration, n));
|
|
175
|
-
return super.IntrospectSchema(companyIntegration, contextUser, { ...options, ObjectNames: resolved });
|
|
176
|
-
}
|
|
177
|
-
return super.IntrospectSchema(companyIntegration, contextUser, options);
|
|
178
|
-
}
|
|
179
|
-
// ─── Fetch (SOQL platform layer reused; FDService opt-in) ────────
|
|
180
|
-
/**
|
|
181
|
-
* Fetches changed records. Default path reuses the inherited Salesforce SOQL
|
|
182
|
-
* incremental fetch (SystemModstamp watermark + nextRecordsUrl cursor)
|
|
183
|
-
* verbatim, with the IO name translated to its backing sObject. When the
|
|
184
|
-
* connection opts into FDService reads (`UseFDServiceForRead`), routes through
|
|
185
|
-
* the FDService Apex REST domain service instead.
|
|
186
|
-
*/
|
|
187
|
-
async FetchChanges(ctx) {
|
|
188
|
-
const cfg = this.GetFontevaConfig(ctx.CompanyIntegration);
|
|
189
|
-
const ioName = ctx.ObjectName;
|
|
190
|
-
const objCfg = this.GetObjectConfig(ctx.CompanyIntegration, ioName);
|
|
191
|
-
if (cfg.UseFDServiceForRead && objCfg?.AccessPath?.fdServicePath) {
|
|
192
|
-
const batch = await this.FetchViaFDService(ctx, objCfg, cfg);
|
|
193
|
-
return this.RewriteObjectType(batch, ioName);
|
|
194
|
-
}
|
|
195
|
-
const sObject = objCfg?.BackingSObject ?? this.ResolveBackingSObject(ctx.CompanyIntegration, ioName);
|
|
196
|
-
const batch = await super.FetchChanges({ ...ctx, ObjectName: sObject });
|
|
197
|
-
return this.RewriteObjectType(batch, ioName);
|
|
198
|
-
}
|
|
199
|
-
// ─── CRUD (generic sObject path reused; IO name → sObject) ───────
|
|
200
|
-
async CreateRecord(ctx) {
|
|
201
|
-
const sObject = this.ResolveBackingSObject(ctx.CompanyIntegration, ctx.ObjectName);
|
|
202
|
-
return super.CreateRecord({ ...ctx, ObjectName: sObject });
|
|
203
|
-
}
|
|
204
|
-
async UpdateRecord(ctx) {
|
|
205
|
-
const sObject = this.ResolveBackingSObject(ctx.CompanyIntegration, ctx.ObjectName);
|
|
206
|
-
return super.UpdateRecord({ ...ctx, ObjectName: sObject });
|
|
207
|
-
}
|
|
208
|
-
async DeleteRecord(ctx) {
|
|
209
|
-
const sObject = this.ResolveBackingSObject(ctx.CompanyIntegration, ctx.ObjectName);
|
|
210
|
-
return super.DeleteRecord({ ...ctx, ObjectName: sObject });
|
|
211
|
-
}
|
|
212
|
-
async GetRecord(ctx) {
|
|
213
|
-
const sObject = this.ResolveBackingSObject(ctx.CompanyIntegration, ctx.ObjectName);
|
|
214
|
-
const record = await super.GetRecord({ ...ctx, ObjectName: sObject });
|
|
215
|
-
if (record)
|
|
216
|
-
record.ObjectType = ctx.ObjectName;
|
|
217
|
-
return record;
|
|
218
|
-
}
|
|
219
|
-
async SearchRecords(ctx) {
|
|
220
|
-
const sObject = this.ResolveBackingSObject(ctx.CompanyIntegration, ctx.ObjectName);
|
|
221
|
-
const result = await super.SearchRecords({ ...ctx, ObjectName: sObject });
|
|
222
|
-
for (const r of result.Records)
|
|
223
|
-
r.ObjectType = ctx.ObjectName;
|
|
224
|
-
return result;
|
|
225
|
-
}
|
|
226
|
-
// ─── FDService Apex REST domain services ─────────────────────────
|
|
227
|
-
/**
|
|
228
|
-
* Reads records through a Fonteva FDService Apex REST domain service using
|
|
229
|
-
* the documented SearchRequest parameters (filter / fields / sort / limit).
|
|
230
|
-
* The connector follows the SystemModstamp watermark by encoding a SOQL WHERE
|
|
231
|
-
* fragment into the `filter` (a.k.a. whereClause) param.
|
|
232
|
-
*
|
|
233
|
-
* Idiosyncratic to Fonteva: FDService returns the wrapper records under a
|
|
234
|
-
* `records` key (camelCase wrapper properties), with the universal `id`
|
|
235
|
-
* property carrying the Salesforce 18-char Id. There is no documented cursor
|
|
236
|
-
* token, so pagination is bounded by `limit` and advanced by the watermark on
|
|
237
|
-
* subsequent syncs (the connector reports the max SystemModstamp it saw).
|
|
238
|
-
*/
|
|
239
|
-
async FetchViaFDService(ctx, objCfg, cfg) {
|
|
240
|
-
const auth = await this.AuthenticateForFonteva(ctx.CompanyIntegration, ctx.ContextUser);
|
|
241
|
-
const servicePath = objCfg.AccessPath?.fdServicePath ?? this.BuildFDServicePath(cfg, objCfg);
|
|
242
|
-
const params = this.BuildFDServiceSearchParams(ctx);
|
|
243
|
-
const query = this.EncodeFDServiceParams(params);
|
|
244
|
-
const url = `${this.FontevaApiBase(auth)}${servicePath}${query ? `?${query}` : ''}`;
|
|
245
|
-
const headers = this.FontevaHeaders(auth);
|
|
246
|
-
const response = await this.MakeFontevaRequest(auth, url, 'GET', headers);
|
|
247
|
-
if (response.Status < 200 || response.Status >= 300) {
|
|
248
|
-
throw new Error(`Fonteva FDService GET ${url} returned HTTP ${response.Status}: ${this.PreviewFonteva(response.Body)}`);
|
|
249
|
-
}
|
|
250
|
-
const records = this.ParseFDServiceRecords(response.Body, ctx.ObjectName);
|
|
251
|
-
const newWatermark = this.MaxSystemModstamp(records);
|
|
252
|
-
return {
|
|
253
|
-
Records: records,
|
|
254
|
-
HasMore: false,
|
|
255
|
-
NewWatermarkValue: newWatermark ?? undefined,
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
/** Builds SearchRequest params from the fetch context (watermark → filter). */
|
|
259
|
-
BuildFDServiceSearchParams(ctx) {
|
|
260
|
-
const params = {
|
|
261
|
-
limit: ctx.BatchSize > 0 ? ctx.BatchSize : undefined,
|
|
262
|
-
sort: 'SystemModstamp',
|
|
263
|
-
sorDir: 'ASC',
|
|
264
|
-
};
|
|
265
|
-
if (ctx.WatermarkValue) {
|
|
266
|
-
params.filter = `SystemModstamp >= ${this.FormatFDServiceDateTime(ctx.WatermarkValue)}`;
|
|
267
|
-
}
|
|
268
|
-
if (ctx.RequestedSourceFields && ctx.RequestedSourceFields.length > 0) {
|
|
269
|
-
params.fields = ctx.RequestedSourceFields.join(',');
|
|
270
|
-
}
|
|
271
|
-
return params;
|
|
272
|
-
}
|
|
273
|
-
EncodeFDServiceParams(params) {
|
|
274
|
-
const usp = new URLSearchParams();
|
|
275
|
-
if (params.id)
|
|
276
|
-
usp.set('id', params.id);
|
|
277
|
-
if (params.filter)
|
|
278
|
-
usp.set('filter', params.filter);
|
|
279
|
-
if (params.fields)
|
|
280
|
-
usp.set('fields', params.fields);
|
|
281
|
-
if (params.sort)
|
|
282
|
-
usp.set('sort', params.sort);
|
|
283
|
-
if (params.sorDir)
|
|
284
|
-
usp.set('sorDir', params.sorDir);
|
|
285
|
-
if (params.limit != null)
|
|
286
|
-
usp.set('limit', String(params.limit));
|
|
287
|
-
return usp.toString();
|
|
288
|
-
}
|
|
289
|
-
FormatFDServiceDateTime(value) {
|
|
290
|
-
return value.includes('T') ? value : `${value}T00:00:00.000Z`;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Parses an FDService response into ExternalRecords. FDService wraps records
|
|
294
|
-
* under a `records` array (each a flat camelCase wrapper object whose `id`
|
|
295
|
-
* carries the Salesforce Id). Preserves the FULL record into Fields for
|
|
296
|
-
* custom-column capture — no narrow projection.
|
|
297
|
-
*/
|
|
298
|
-
ParseFDServiceRecords(body, objectType) {
|
|
299
|
-
const envelope = body;
|
|
300
|
-
const list = Array.isArray(envelope)
|
|
301
|
-
? envelope
|
|
302
|
-
: Array.isArray(envelope?.records) ? envelope.records : [];
|
|
303
|
-
return list.map(item => {
|
|
304
|
-
const raw = item;
|
|
305
|
-
const id = String(raw['id'] ?? raw['Id'] ?? '');
|
|
306
|
-
const modstamp = (raw['SystemModstamp'] ?? raw['systemModstamp']);
|
|
307
|
-
return {
|
|
308
|
-
ExternalID: id,
|
|
309
|
-
ObjectType: objectType,
|
|
310
|
-
Fields: { ...raw }, // full record pass-through (custom-column capture contract)
|
|
311
|
-
ModifiedAt: modstamp ? new Date(modstamp) : undefined,
|
|
312
|
-
};
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
MaxSystemModstamp(records) {
|
|
316
|
-
let max = null;
|
|
317
|
-
for (const r of records) {
|
|
318
|
-
const stamp = (r.Fields['SystemModstamp'] ?? r.Fields['systemModstamp']);
|
|
319
|
-
if (stamp && (!max || stamp > max))
|
|
320
|
-
max = stamp;
|
|
321
|
-
}
|
|
322
|
-
if (!max)
|
|
323
|
-
return null;
|
|
324
|
-
const parsed = new Date(max);
|
|
325
|
-
if (Number.isNaN(parsed.getTime()))
|
|
326
|
-
return max;
|
|
327
|
-
// Advance 1ms so the next `>=` filter excludes the boundary cluster (mirrors the SOQL path).
|
|
328
|
-
return new Date(parsed.getTime() + 1).toISOString();
|
|
329
|
-
}
|
|
330
|
-
BuildFDServicePath(cfg, objCfg) {
|
|
331
|
-
const wrapper = objCfg.FDServiceWrapper ?? 'Order';
|
|
332
|
-
return `${cfg.FDServiceBasePath}/${wrapper}Service`;
|
|
333
|
-
}
|
|
334
|
-
// ─── Backing-sObject resolution ──────────────────────────────────
|
|
335
|
-
/**
|
|
336
|
-
* Resolves the friendly IO `Name` to its backing Salesforce sObject API name.
|
|
337
|
-
* Reads the IO's Configuration.BackingSObject from the engine cache; falls
|
|
338
|
-
* back to a namespace-prefixed PascalSnake derivation when metadata isn't
|
|
339
|
-
* loaded (e.g. unit tests) or the IO already IS a fully-qualified sObject.
|
|
340
|
-
*/
|
|
341
|
-
ResolveBackingSObject(companyIntegration, ioName) {
|
|
342
|
-
const objCfg = this.GetObjectConfig(companyIntegration, ioName);
|
|
343
|
-
if (objCfg?.BackingSObject)
|
|
344
|
-
return objCfg.BackingSObject;
|
|
345
|
-
// Already a fully-qualified managed-package sObject — pass through unchanged.
|
|
346
|
-
if (/__c$/i.test(ioName))
|
|
347
|
-
return ioName;
|
|
348
|
-
return ioName; // best-effort: unmapped name used verbatim (describe will surface a clear error)
|
|
349
|
-
}
|
|
350
|
-
/** Reads + parses the per-IO Configuration from the engine cache. Returns null if unavailable. */
|
|
351
|
-
GetObjectConfig(companyIntegration, ioName) {
|
|
352
|
-
try {
|
|
353
|
-
const obj = IntegrationEngineBase.Instance.GetIntegrationObject(companyIntegration.IntegrationID, ioName);
|
|
354
|
-
if (!obj?.Configuration)
|
|
355
|
-
return null;
|
|
356
|
-
return JSON.parse(obj.Configuration);
|
|
357
|
-
}
|
|
358
|
-
catch {
|
|
359
|
-
return null;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
// ─── Namespace + name helpers ────────────────────────────────────
|
|
363
|
-
IsInManagedPackage(sObjectName, namespaces) {
|
|
364
|
-
const lower = sObjectName.toLowerCase();
|
|
365
|
-
return namespaces.some(ns => lower.startsWith(`${ns}__`));
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Presents a managed-package sObject API name as a friendly IO name by
|
|
369
|
-
* stripping the namespace prefix and the `__c` suffix and PascalCasing the
|
|
370
|
-
* snake segments (e.g. OrderApi__Sales_Order_Line__c → SalesOrderLine).
|
|
371
|
-
*/
|
|
372
|
-
SObjectToFriendlyName(sObjectName) {
|
|
373
|
-
const withoutNamespace = sObjectName.replace(/^[A-Za-z]+__/i, '');
|
|
374
|
-
const withoutSuffix = withoutNamespace.replace(/__c$/i, '');
|
|
375
|
-
return withoutSuffix
|
|
376
|
-
.split('_')
|
|
377
|
-
.filter(seg => seg.length > 0)
|
|
378
|
-
.map(seg => seg.charAt(0).toUpperCase() + seg.slice(1))
|
|
379
|
-
.join('');
|
|
380
|
-
}
|
|
381
|
-
/** Rewrites a fetch batch's record ObjectType from the backing sObject back to the IO name. */
|
|
382
|
-
RewriteObjectType(batch, ioName) {
|
|
383
|
-
for (const r of batch.Records)
|
|
384
|
-
r.ObjectType = ioName;
|
|
385
|
-
return batch;
|
|
386
|
-
}
|
|
387
|
-
// ─── Reuse-friendly thin wrappers over inherited protected helpers ──
|
|
388
|
-
// SalesforceConnector exposes Authenticate / BuildHeaders / MakeHTTPRequest /
|
|
389
|
-
// GetBaseURL as protected; these named wrappers keep the FDService code paths
|
|
390
|
-
// readable and route ALL FDService HTTP through the same auth + mock-redirect
|
|
391
|
-
// surface the inherited SOQL path uses (so FDService is mock-testable too).
|
|
392
|
-
async AuthenticateForFonteva(companyIntegration, contextUser) {
|
|
393
|
-
return this.Authenticate(companyIntegration, contextUser);
|
|
394
|
-
}
|
|
395
|
-
FontevaHeaders(auth) {
|
|
396
|
-
return this.BuildHeaders(auth);
|
|
397
|
-
}
|
|
398
|
-
async MakeFontevaRequest(auth, url, method, headers, body) {
|
|
399
|
-
return this.MakeHTTPRequest(auth, url, method, headers, body);
|
|
400
|
-
}
|
|
401
|
-
FontevaApiBase(auth) {
|
|
402
|
-
return this.GetBaseURL(auth.CompanyIntegration, auth);
|
|
403
|
-
}
|
|
404
|
-
PreviewFonteva(body) {
|
|
405
|
-
if (typeof body === 'string')
|
|
406
|
-
return body.slice(0, 500);
|
|
407
|
-
try {
|
|
408
|
-
return JSON.stringify(body).slice(0, 500);
|
|
409
|
-
}
|
|
410
|
-
catch {
|
|
411
|
-
return String(body);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
FontevaConnector = __decorate([
|
|
416
|
-
RegisterClass(BaseIntegrationConnector, 'FontevaConnector')
|
|
417
|
-
], FontevaConnector);
|
|
418
|
-
export { FontevaConnector };
|
|
419
|
-
/** Tree-shaking prevention: referenced from index.ts so the @RegisterClass survives bundling. */
|
|
420
|
-
export function LoadFontevaConnector() { }
|
|
421
|
-
//# sourceMappingURL=FontevaConnector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FontevaConnector.js","sourceRoot":"","sources":["../src/FontevaConnector.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EACH,wBAAwB,GAe3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAuE/D,yEAAyE;AAEzE,MAAM,kCAAkC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC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IAC1D,CAAC;IAEO,cAAc,CAAC,IAAa;QAChC,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACxD,IAAI,CAAC;YAAC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;QAAC,CAAC;IACrF,CAAC;CACJ,CAAA;AAvZY,gBAAgB;IAD5B,aAAa,CAAC,wBAAwB,EAAE,kBAAkB,CAAC;GAC/C,gBAAgB,CAuZ5B;;AAED,iGAAiG;AACjG,MAAM,UAAU,oBAAoB,KAAuB,CAAC"}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { type UserInfo } from '@memberjunction/core';
|
|
2
|
-
import type { MJCompanyIntegrationEntity, MJIntegrationObjectEntity } from '@memberjunction/core-entities';
|
|
3
|
-
import { BaseRESTIntegrationConnector, type RESTAuthContext, type RESTResponse, type PaginationState, type PaginationType, type ConnectionTestResult, type ExternalObjectSchema, type ExternalFieldSchema, type FetchContext, type FetchBatchResult, type IntegrationObjectInfo, type ActionGeneratorConfig, type DeleteRecordContext, type CRUDResult } from '@memberjunction/integration-engine';
|
|
4
|
-
/**
|
|
5
|
-
* OAuth2 connection configuration for GrowthZone, parsed from the attached MJ
|
|
6
|
-
* Credential (preferred) or the CompanyIntegration.Configuration JSON. Field names
|
|
7
|
-
* are read case-insensitively. NONE of these values are read at build time — they are
|
|
8
|
-
* resolved from the bound credential at runtime.
|
|
9
|
-
*/
|
|
10
|
-
export interface GrowthZoneConnectionConfig {
|
|
11
|
-
/** OAuth2 client identifier. */
|
|
12
|
-
ClientId: string;
|
|
13
|
-
/** OAuth2 client secret. */
|
|
14
|
-
ClientSecret: string;
|
|
15
|
-
/** Long-lived refresh token — drives the PRIMARY `refresh_token` grant. */
|
|
16
|
-
RefreshToken?: string;
|
|
17
|
-
/** Username — drives the FALLBACK `password` grant when no refresh token exists. */
|
|
18
|
-
Username?: string;
|
|
19
|
-
/** Password — drives the FALLBACK `password` grant. */
|
|
20
|
-
Password?: string;
|
|
21
|
-
/** Space/comma-delimited OAuth2 scopes. */
|
|
22
|
-
Scopes?: string;
|
|
23
|
-
/** Operator's GrowthZone API base URL (e.g. https://{subdomain}.growthzoneapp.com/API). */
|
|
24
|
-
BaseURL: string;
|
|
25
|
-
/** Optional token-endpoint override; defaults to `{base}/oauth/token`. */
|
|
26
|
-
TokenURL?: string;
|
|
27
|
-
/** Optional tenant identifier (informational / future use). */
|
|
28
|
-
Tenant?: string;
|
|
29
|
-
/** Maximum retries for rate-limited / transient failures. Default 3. */
|
|
30
|
-
MaxRetries?: number;
|
|
31
|
-
/** HTTP request timeout in ms. Default 30000. */
|
|
32
|
-
RequestTimeoutMs?: number;
|
|
33
|
-
/** Minimum ms between requests (GrowthZone recommends 2s). Default 2000. */
|
|
34
|
-
MinRequestIntervalMs?: number;
|
|
35
|
-
}
|
|
36
|
-
export declare class GrowthZoneConnector extends BaseRESTIntegrationConnector {
|
|
37
|
-
/** Cached auth context for the current sync run. */
|
|
38
|
-
private authCache;
|
|
39
|
-
/** Shared OAuth2 token manager — owns the token round-trip + cache. */
|
|
40
|
-
private readonly tokenManager;
|
|
41
|
-
/** Timestamp of the last API request, for client-side throttling. */
|
|
42
|
-
private lastRequestTime;
|
|
43
|
-
/** Current watermark value, emitted as the IO's IncrementalWatermarkField on the request. */
|
|
44
|
-
private currentWatermark;
|
|
45
|
-
get IntegrationName(): string;
|
|
46
|
-
get SupportsCreate(): boolean;
|
|
47
|
-
get SupportsUpdate(): boolean;
|
|
48
|
-
get SupportsDelete(): boolean;
|
|
49
|
-
/** True when any cached IntegrationObject satisfies the predicate. []→false when the engine
|
|
50
|
-
* cache is unavailable (e.g. capability probed before configuration) — fail-safe read-only. */
|
|
51
|
-
private anyObjectDeclares;
|
|
52
|
-
DeleteRecord(ctx: DeleteRecordContext): Promise<CRUDResult>;
|
|
53
|
-
/**
|
|
54
|
-
* Resolves a record's current GrowthZone audit token (optimistic-concurrency) for an audit-token
|
|
55
|
-
* delete. GrowthZone exposes it as `AuditId` / `{Object}AuditId` on the record; we GetRecord and
|
|
56
|
-
* return the first match. Returns null when the record or token cannot be found.
|
|
57
|
-
*/
|
|
58
|
-
private ResolveAuditToken;
|
|
59
|
-
/**
|
|
60
|
-
* Surfaces the FULL object universe straight from the IntegrationEngineBase
|
|
61
|
-
* cache (the Declared metadata in `.growthzone.integration.json`). There is NO
|
|
62
|
-
* hardcoded catalog in this connector — the prohibited module-level object/field
|
|
63
|
-
* literal is intentionally absent. When the cache is unavailable (e.g. action
|
|
64
|
-
* generation invoked before the engine is configured) this returns []; the live
|
|
65
|
-
* discovery path (DiscoverObjects/DiscoverFields) is the authoritative surface.
|
|
66
|
-
*/
|
|
67
|
-
GetIntegrationObjects(): IntegrationObjectInfo[];
|
|
68
|
-
GetActionGeneratorConfig(): ActionGeneratorConfig | null;
|
|
69
|
-
/** Maps a cached IntegrationObject + its fields to the action-generator info shape. */
|
|
70
|
-
private ObjectEntityToInfo;
|
|
71
|
-
/**
|
|
72
|
-
* OAuth2 bearer authentication. Mints/refreshes the access token via the shared
|
|
73
|
-
* {@link OAuth2TokenManager}: PRIMARY `refresh_token` grant when a refresh token is
|
|
74
|
-
* present, otherwise the documented FALLBACK `password` grant.
|
|
75
|
-
*/
|
|
76
|
-
protected Authenticate(companyIntegration: MJCompanyIntegrationEntity, contextUser: UserInfo): Promise<RESTAuthContext>;
|
|
77
|
-
/** Selects the grant and runs the token round-trip through OAuth2TokenManager. */
|
|
78
|
-
private MintToken;
|
|
79
|
-
/** Sends the OAuth2 bearer token on every request. */
|
|
80
|
-
protected BuildHeaders(auth: RESTAuthContext): Record<string, string>;
|
|
81
|
-
protected GetBaseURL(_companyIntegration: MJCompanyIntegrationEntity, auth: RESTAuthContext): string;
|
|
82
|
-
/**
|
|
83
|
-
* Normalizes GrowthZone responses. Handles three real shapes:
|
|
84
|
-
* 1. `{ Results: [...], TotalRecordAvailable: N }` — paginated lists
|
|
85
|
-
* 2. raw array — some endpoints return an array at the root
|
|
86
|
-
* 3. single object — genuine per-parent DETAIL endpoints (Person, Organization,
|
|
87
|
-
* ContactCustomField, ContactNotes, ContactEngagement, ScheduledBillingUpdate,
|
|
88
|
-
* MembershipChange) return ONE real record per parent. These ARE kept.
|
|
89
|
-
* and coerces `0001-01-01` sentinel dates / empty strings to null.
|
|
90
|
-
*
|
|
91
|
-
* THE EMPTY-EVENT-CHILD SENTINEL (PROBLEMS_LOG #22/#23/#27 — idempotency, surgically scoped):
|
|
92
|
-
* The per-event child list endpoints (`/api/events/sponsors?eventId=X`, …/sessions, …/attendees,
|
|
93
|
-
* etc.) do NOT return `{ Results: [] }` when an event has no children — they return the bare
|
|
94
|
-
* EVENT-DETAIL wrapper instead. That wrapper carries volatile per-fetch audit fields
|
|
95
|
-
* (EventAuditId / EventDetailAuditId), so minting a record from it produced ONE empty placeholder
|
|
96
|
-
* per event whose §4 content-hash identity drifted every sync → child tables doubled (254 = 2×127,
|
|
97
|
-
* all rows empty). Fix: detect the event wrapper (it uniquely carries EventAuditId+EventDetailAuditId
|
|
98
|
-
* — a genuine child/detail record never does) and emit []. This is the ONLY single-object case we
|
|
99
|
-
* drop; every legitimate single-record detail endpoint is preserved (the #27 regression guard).
|
|
100
|
-
* Populated children still arrive as a `Results` envelope and map normally.
|
|
101
|
-
*
|
|
102
|
-
* The FULL source record passes through (no field filtering) so the framework's custom-column
|
|
103
|
-
* capture sees everything the source returned.
|
|
104
|
-
*/
|
|
105
|
-
protected NormalizeResponse(rawBody: unknown, responseDataKey: string | null): Record<string, unknown>[];
|
|
106
|
-
/**
|
|
107
|
-
* True when a single-object response is the GrowthZone EVENT-DETAIL wrapper — the body the
|
|
108
|
-
* per-event child endpoints return when an event has zero children (see NormalizeResponse).
|
|
109
|
-
* The wrapper is unmistakable: it carries BOTH event-audit stamps. No genuine child/detail
|
|
110
|
-
* record (Person, Organization, custom fields, notes, engagement) carries these keys, so this
|
|
111
|
-
* stays surgically scoped to the empty-event-child case and never drops a real record.
|
|
112
|
-
*/
|
|
113
|
-
private isEmptyEventChildWrapper;
|
|
114
|
-
/**
|
|
115
|
-
* Derives OData pagination state. GrowthZone returns no `HasMore` flag, so end-of-stream
|
|
116
|
-
* is inferred from a short page and/or `TotalRecordAvailable` vs offset+count.
|
|
117
|
-
*/
|
|
118
|
-
protected ExtractPaginationInfo(rawBody: unknown, _paginationType: PaginationType, _currentPage: number, currentOffset: number, pageSize: number): PaginationState;
|
|
119
|
-
/**
|
|
120
|
-
* Emits GrowthZone OData params (`skip`/`top`) plus, for an incremental IO, the vendor
|
|
121
|
-
* watermark param. The watermark behaviour is fully METADATA-DRIVEN: the param NAME comes
|
|
122
|
-
* from the IO's `IncrementalWatermarkField` (e.g. `modifiedSince` on the Contact object) and
|
|
123
|
-
* is emitted only when `SupportsIncrementalSync=true` AND a watermark value is in context —
|
|
124
|
-
* never keyed off a hardcoded path suffix or object name.
|
|
125
|
-
*/
|
|
126
|
-
protected BuildPaginatedURL(basePath: string, obj: MJIntegrationObjectEntity, _page: number, offset: number, _cursor?: string, effectivePageSize?: number): string;
|
|
127
|
-
/** Executes an HTTP request with client-side throttling + retry for 429/503. */
|
|
128
|
-
protected MakeHTTPRequest(auth: RESTAuthContext, url: string, method: string, headers: Record<string, string>, body?: unknown): Promise<RESTResponse>;
|
|
129
|
-
/**
|
|
130
|
-
* Tests connectivity by minting an OAuth2 token and listing one Contact record. A 2xx
|
|
131
|
-
* confirms the OAuth2 credentials + base URL are valid against the live API.
|
|
132
|
-
*/
|
|
133
|
-
TestConnection(companyIntegration: MJCompanyIntegrationEntity, contextUser: UserInfo): Promise<ConnectionTestResult>;
|
|
134
|
-
/**
|
|
135
|
-
* Discovers the full object universe from the IntegrationEngineBase cache (the Declared
|
|
136
|
-
* metadata). GrowthZone publishes its catalog credential-free (curated + dev docs), so
|
|
137
|
-
* the baseline is Declared metadata — never hardcoded here, never sampled at build.
|
|
138
|
-
*/
|
|
139
|
-
DiscoverObjects(companyIntegration: MJCompanyIntegrationEntity, contextUser: UserInfo): Promise<ExternalObjectSchema[]>;
|
|
140
|
-
/** Discovers fields for an object from the cached Declared metadata. */
|
|
141
|
-
DiscoverFields(companyIntegration: MJCompanyIntegrationEntity, objectName: string, contextUser: UserInfo): Promise<ExternalFieldSchema[]>;
|
|
142
|
-
/**
|
|
143
|
-
* Sets the watermark context the OData URL builder needs, delegates
|
|
144
|
-
* the actual walk to the base (which descends nested Door→Segment template-var paths via
|
|
145
|
-
* FK metadata so nested IOs never silently return 0 rows), then advances the watermark
|
|
146
|
-
* from the returned records on the final batch only (partial-failure-safe).
|
|
147
|
-
*/
|
|
148
|
-
FetchChanges(ctx: FetchContext): Promise<FetchBatchResult>;
|
|
149
|
-
/**
|
|
150
|
-
* Parses the OAuth2 connection config, preferring the attached MJ Credential over the
|
|
151
|
-
* raw Configuration JSON. Credential bytes are resolved at runtime — never at build.
|
|
152
|
-
*/
|
|
153
|
-
private ParseConfig;
|
|
154
|
-
/** Loads the OAuth2 config from the MJ: Credentials entity Values JSON. */
|
|
155
|
-
private ParseConfigFromCredential;
|
|
156
|
-
/** Validates the parsed config + applies defaults. Field names are case-insensitive. */
|
|
157
|
-
private ValidateConfig;
|
|
158
|
-
/** Resolves the API base URL from the credential's BaseURL (never a hardcoded subdomain). */
|
|
159
|
-
private ResolveBaseUrl;
|
|
160
|
-
/** Resolves the OAuth2 token endpoint: credential TokenURL override, else `{base}/oauth/token`. */
|
|
161
|
-
private ResolveTokenURL;
|
|
162
|
-
/** Normalizes a raw record's top-level values (null-date + empty-string → null). */
|
|
163
|
-
private NormalizeRecord;
|
|
164
|
-
/** Converts GrowthZone sentinel values to null. */
|
|
165
|
-
private NormalizeValue;
|
|
166
|
-
/** Extracts the latest ModifiedDate across a batch for watermark advancement. */
|
|
167
|
-
private ExtractLatestModifiedDate;
|
|
168
|
-
/** Throttle to respect GrowthZone's recommended minimum request interval. */
|
|
169
|
-
private ThrottleIfNeeded;
|
|
170
|
-
/** Parses a Retry-After header (seconds or http-date) into ms, if present. */
|
|
171
|
-
private RetryAfterMs;
|
|
172
|
-
/** Exponential backoff delay for retry attempts (capped at 30s). */
|
|
173
|
-
private BackoffDelay;
|
|
174
|
-
/** Checks whether an error is transient (network/timeout). */
|
|
175
|
-
private IsTransientNetworkError;
|
|
176
|
-
/** Builds the normalized RESTResponse from a fetch Response. */
|
|
177
|
-
private BuildRESTResponse;
|
|
178
|
-
/** Promise-wrapped setTimeout. */
|
|
179
|
-
private Sleep;
|
|
180
|
-
}
|
|
181
|
-
/** Tree-shaking prevention — import and call from the package entry point. */
|
|
182
|
-
export declare function LoadGrowthZoneConnector(): void;
|
|
183
|
-
//# sourceMappingURL=GrowthZoneConnector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GrowthZoneConnector.d.ts","sourceRoot":"","sources":["../src/GrowthZoneConnector.ts"],"names":[],"mappings":"AAiDA,OAAO,EAAoC,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,0BAA0B,EAAsB,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/H,OAAO,EAEH,4BAA4B,EAI5B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAE1B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAClB,MAAM,oCAAoC,CAAC;AAK5C;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACvC,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;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