@memberjunction/integration-connectors 5.13.0 → 5.14.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/dist/HubSpotConnector.d.ts +82 -4
- package/dist/HubSpotConnector.d.ts.map +1 -1
- package/dist/HubSpotConnector.js +649 -104
- package/dist/HubSpotConnector.js.map +1 -1
- package/dist/RasaConnector.d.ts +4 -19
- package/dist/RasaConnector.d.ts.map +1 -1
- package/dist/RasaConnector.js +74 -0
- package/dist/RasaConnector.js.map +1 -1
- package/dist/YourMembershipConnector.d.ts +4 -25
- package/dist/YourMembershipConnector.d.ts.map +1 -1
- package/dist/YourMembershipConnector.js +147 -3
- package/dist/YourMembershipConnector.js.map +1 -1
- package/dist/generate-integration-actions.d.ts +19 -0
- package/dist/generate-integration-actions.d.ts.map +1 -0
- package/dist/generate-integration-actions.js +131 -0
- package/dist/generate-integration-actions.js.map +1 -0
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UserInfo } from '@memberjunction/core';
|
|
2
2
|
import type { MJCompanyIntegrationEntity, MJIntegrationObjectEntity } from '@memberjunction/core-entities';
|
|
3
|
-
import { BaseRESTIntegrationConnector, type RESTAuthContext, type RESTResponse, type PaginationState, type PaginationType, type ConnectionTestResult, type DefaultFieldMapping, type DefaultIntegrationConfig } from '@memberjunction/integration-engine';
|
|
3
|
+
import { BaseRESTIntegrationConnector, type RESTAuthContext, type RESTResponse, type PaginationState, type PaginationType, type ConnectionTestResult, type DefaultFieldMapping, type DefaultIntegrationConfig, type FetchContext, type FetchBatchResult, type ExternalRecord, type CRUDResult, type CreateRecordContext, type UpdateRecordContext, type DeleteRecordContext, type GetRecordContext, type SearchContext, type SearchResult, type ListContext, type ListResult, type IntegrationObjectInfo, type ActionGeneratorConfig } from '@memberjunction/integration-engine';
|
|
4
4
|
/** Connection configuration parsed from CompanyIntegration.Configuration JSON */
|
|
5
5
|
export interface HubSpotConnectionConfig {
|
|
6
6
|
/** HubSpot access token (private app key or OAuth token) */
|
|
@@ -46,7 +46,8 @@ interface HubSpotPropertyDef {
|
|
|
46
46
|
* "MinRequestIntervalMs": 100 // optional, default: 100
|
|
47
47
|
* }
|
|
48
48
|
*
|
|
49
|
-
*
|
|
49
|
+
* Supports full CRUD: Get, Create, Update, Delete, Search, and List operations
|
|
50
|
+
* on all HubSpot CRM object types.
|
|
50
51
|
*/
|
|
51
52
|
export declare class HubSpotConnector extends BaseRESTIntegrationConnector {
|
|
52
53
|
/** Timestamp of the last API request, used for throttling */
|
|
@@ -56,9 +57,47 @@ export declare class HubSpotConnector extends BaseRESTIntegrationConnector {
|
|
|
56
57
|
private get effectiveMaxRetries();
|
|
57
58
|
private get effectiveRequestTimeoutMs();
|
|
58
59
|
private get effectiveMinRequestIntervalMs();
|
|
60
|
+
get SupportsCreate(): boolean;
|
|
61
|
+
get SupportsUpdate(): boolean;
|
|
62
|
+
get SupportsDelete(): boolean;
|
|
63
|
+
get SupportsSearch(): boolean;
|
|
64
|
+
get SupportsListing(): boolean;
|
|
65
|
+
get IntegrationName(): string;
|
|
66
|
+
GetIntegrationObjects(): IntegrationObjectInfo[];
|
|
67
|
+
GetActionGeneratorConfig(): ActionGeneratorConfig | null;
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves a single record by ExternalID (HubSpot object ID).
|
|
70
|
+
*/
|
|
71
|
+
GetRecord(ctx: GetRecordContext): Promise<ExternalRecord | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new record in HubSpot.
|
|
74
|
+
*/
|
|
75
|
+
CreateRecord(ctx: CreateRecordContext): Promise<CRUDResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Updates an existing record in HubSpot by ExternalID.
|
|
78
|
+
*/
|
|
79
|
+
UpdateRecord(ctx: UpdateRecordContext): Promise<CRUDResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Deletes (archives) a record in HubSpot by ExternalID.
|
|
82
|
+
*/
|
|
83
|
+
DeleteRecord(ctx: DeleteRecordContext): Promise<CRUDResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Searches HubSpot objects using the CRM search API.
|
|
86
|
+
*/
|
|
87
|
+
SearchRecords(ctx: SearchContext): Promise<SearchResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Lists records from a HubSpot object with cursor-based pagination.
|
|
90
|
+
*/
|
|
91
|
+
ListRecords(ctx: ListContext): Promise<ListResult>;
|
|
92
|
+
/** Converts a raw HubSpot API object to an ExternalRecord. */
|
|
93
|
+
private RawToExternalRecord;
|
|
94
|
+
/** Validates a CRUD response and throws on non-2xx status. */
|
|
95
|
+
private ValidateCRUDResponse;
|
|
96
|
+
/** Builds a CRUDResult for error responses. */
|
|
97
|
+
private BuildCRUDErrorResult;
|
|
59
98
|
protected Authenticate(companyIntegration: MJCompanyIntegrationEntity, contextUser: UserInfo): Promise<RESTAuthContext>;
|
|
60
99
|
protected BuildHeaders(auth: RESTAuthContext): Record<string, string>;
|
|
61
|
-
protected MakeHTTPRequest(_auth: RESTAuthContext, url: string, method: string, headers: Record<string, string>,
|
|
100
|
+
protected MakeHTTPRequest(_auth: RESTAuthContext, url: string, method: string, headers: Record<string, string>, body?: unknown): Promise<RESTResponse>;
|
|
62
101
|
protected NormalizeResponse(rawBody: unknown, responseDataKey: string | null): Record<string, unknown>[];
|
|
63
102
|
protected ExtractPaginationInfo(rawBody: unknown, _paginationType: PaginationType, _currentPage: number, _currentOffset: number, _pageSize: number): PaginationState;
|
|
64
103
|
protected GetBaseURL(_companyIntegration: MJCompanyIntegrationEntity, _auth: RESTAuthContext): string;
|
|
@@ -109,17 +148,56 @@ export declare class HubSpotConnector extends BaseRESTIntegrationConnector {
|
|
|
109
148
|
* plus system fields (hs_object_id, createdAt, updatedAt, archived).
|
|
110
149
|
*/
|
|
111
150
|
private FlattenHubSpotRecord;
|
|
151
|
+
/**
|
|
152
|
+
* Overrides FetchChanges to intercept association objects (Category === 'Association')
|
|
153
|
+
* and route them through the v4 per-object associations endpoint instead of the
|
|
154
|
+
* non-existent flat list endpoint stored in APIPath.
|
|
155
|
+
*/
|
|
156
|
+
FetchChanges(ctx: FetchContext): Promise<FetchBatchResult>;
|
|
157
|
+
/**
|
|
158
|
+
* Fetches association records in batches by iterating over synced parent (from-side)
|
|
159
|
+
* objects and calling HubSpot's v4 per-object associations endpoint.
|
|
160
|
+
*
|
|
161
|
+
* Uses ctx.CurrentOffset to track parent position across batch calls, so the engine
|
|
162
|
+
* can page through all parents without truncating records.
|
|
163
|
+
*/
|
|
164
|
+
private FetchAssociationChanges;
|
|
165
|
+
/**
|
|
166
|
+
* Paginates through all pages of a HubSpot v4 per-object association endpoint,
|
|
167
|
+
* returning the raw result items (each with toObjectId + associationTypes).
|
|
168
|
+
*/
|
|
169
|
+
private FetchAllAssociationPages;
|
|
170
|
+
/**
|
|
171
|
+
* Converts a HubSpot v4 association result item into a flat record suitable for storage.
|
|
172
|
+
* v4 format: { toObjectId: number, associationTypes: [{ label, typeId, category }] }
|
|
173
|
+
*/
|
|
174
|
+
private FlattenAssociationRecord;
|
|
175
|
+
/**
|
|
176
|
+
* Parses a v4 associations APIPath to extract from/to object type names.
|
|
177
|
+
* E.g., "/crm/v4/associations/contacts/companies" → { fromType: "contacts", toType: "companies" }
|
|
178
|
+
*/
|
|
179
|
+
private ParseAssociationPath;
|
|
180
|
+
/**
|
|
181
|
+
* Loads hs_object_id values for all synced records of a given HubSpot object type
|
|
182
|
+
* by finding its entity map and querying the local MJ entity.
|
|
183
|
+
*/
|
|
184
|
+
private LoadAssociationParentIDs;
|
|
112
185
|
/**
|
|
113
186
|
* Extracts the HubSpot object name from an API path.
|
|
114
187
|
* E.g., "/crm/v3/objects/contacts" -> "contacts"
|
|
115
188
|
*/
|
|
116
189
|
private ExtractObjectNameFromPath;
|
|
190
|
+
/**
|
|
191
|
+
* Returns the known field names for a HubSpot object type, derived from
|
|
192
|
+
* the HUBSPOT_OBJECTS metadata (single source of truth).
|
|
193
|
+
*/
|
|
194
|
+
private GetObjectFieldNames;
|
|
117
195
|
/**
|
|
118
196
|
* Builds the `properties` query parameter for a HubSpot object type.
|
|
119
197
|
* Returns empty string if no properties are configured for the object.
|
|
120
198
|
*/
|
|
121
199
|
private BuildPropertiesParam;
|
|
122
|
-
/** Executes an HTTP request with a timeout. */
|
|
200
|
+
/** Executes an HTTP request with a timeout and optional JSON body. */
|
|
123
201
|
private FetchWithTimeout;
|
|
124
202
|
/** Calculates retry delay from Retry-After header or exponential backoff. */
|
|
125
203
|
private CalculateRetryDelay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HubSpotConnector.d.ts","sourceRoot":"","sources":["../src/HubSpotConnector.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"HubSpotConnector.d.ts","sourceRoot":"","sources":["../src/HubSpotConnector.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,0BAA0B,EAAsB,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/H,OAAO,EAEH,4BAA4B,EAC5B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC7B,MAAM,oCAAoC,CAAC;AAU5C,iFAAiF;AACjF,MAAM,WAAW,uBAAuB;IACpC,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,wCAA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