@memberjunction/integration-engine 0.0.1 → 5.9.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/README.md +142 -28
- package/dist/BaseIntegrationConnector.d.ts +177 -0
- package/dist/BaseIntegrationConnector.d.ts.map +1 -0
- package/dist/BaseIntegrationConnector.js +110 -0
- package/dist/BaseIntegrationConnector.js.map +1 -0
- package/dist/BaseRESTIntegrationConnector.d.ts +222 -0
- package/dist/BaseRESTIntegrationConnector.d.ts.map +1 -0
- package/dist/BaseRESTIntegrationConnector.js +482 -0
- package/dist/BaseRESTIntegrationConnector.js.map +1 -0
- package/dist/ConnectorFactory.d.ts +28 -0
- package/dist/ConnectorFactory.d.ts.map +1 -0
- package/dist/ConnectorFactory.js +42 -0
- package/dist/ConnectorFactory.js.map +1 -0
- package/dist/FieldMappingEngine.d.ts +94 -0
- package/dist/FieldMappingEngine.d.ts.map +1 -0
- package/dist/FieldMappingEngine.js +250 -0
- package/dist/FieldMappingEngine.js.map +1 -0
- package/dist/IntegrationEngine.d.ts +173 -0
- package/dist/IntegrationEngine.d.ts.map +1 -0
- package/dist/IntegrationEngine.js +677 -0
- package/dist/IntegrationEngine.js.map +1 -0
- package/dist/MatchEngine.d.ts +51 -0
- package/dist/MatchEngine.d.ts.map +1 -0
- package/dist/MatchEngine.js +129 -0
- package/dist/MatchEngine.js.map +1 -0
- package/dist/RetryRunner.d.ts +27 -0
- package/dist/RetryRunner.d.ts.map +1 -0
- package/dist/RetryRunner.js +59 -0
- package/dist/RetryRunner.js.map +1 -0
- package/dist/WatermarkService.d.ts +44 -0
- package/dist/WatermarkService.d.ts.map +1 -0
- package/dist/WatermarkService.js +97 -0
- package/dist/WatermarkService.js.map +1 -0
- package/dist/entity-types.d.ts +90 -0
- package/dist/entity-types.d.ts.map +1 -0
- package/dist/entity-types.js +13 -0
- package/dist/entity-types.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/transforms.d.ts +75 -0
- package/dist/transforms.d.ts.map +1 -0
- package/dist/transforms.js +2 -0
- package/dist/transforms.js.map +1 -0
- package/dist/types.d.ts +196 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +44 -0
- package/dist/types.js.map +1 -0
- package/package.json +30 -7
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Error classification helpers
|
|
2
|
+
export { IsRetryableError, ClassifyError } from './types.js';
|
|
3
|
+
// Connector
|
|
4
|
+
export { BaseIntegrationConnector, WithTimeout, DEFAULT_OPERATION_TIMEOUTS, } from './BaseIntegrationConnector.js';
|
|
5
|
+
// REST Connector Base
|
|
6
|
+
export { BaseRESTIntegrationConnector } from './BaseRESTIntegrationConnector.js';
|
|
7
|
+
// Factory
|
|
8
|
+
export { ConnectorFactory } from './ConnectorFactory.js';
|
|
9
|
+
// Engines
|
|
10
|
+
export { FieldMappingEngine } from './FieldMappingEngine.js';
|
|
11
|
+
export { MatchEngine } from './MatchEngine.js';
|
|
12
|
+
// Services
|
|
13
|
+
export { WatermarkService } from './WatermarkService.js';
|
|
14
|
+
// Retry
|
|
15
|
+
export { WithRetry, DEFAULT_RETRY_CONFIG } from './RetryRunner.js';
|
|
16
|
+
// Integration Engine (server-side, wraps IntegrationEngineBase via composition)
|
|
17
|
+
// NOTE: For IntegrationEngineBase (client-safe metadata), import from @memberjunction/integration-engine-base
|
|
18
|
+
export { IntegrationEngine } from './IntegrationEngine.js';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoCA,+BAA+B;AAC/B,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAmB7D,YAAY;AACZ,OAAO,EACH,wBAAwB,EACxB,WAAW,EACX,0BAA0B,GAC7B,MAAM,+BAA+B,CAAC;AAYvC,sBAAsB;AACtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAQjF,UAAU;AACV,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,UAAU;AACV,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,WAAW;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,QAAQ;AACR,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGnE,gFAAgF;AAChF,8GAA8G;AAC9G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** Supported transform types for field value transformation */
|
|
2
|
+
export type TransformType = 'direct' | 'regex' | 'split' | 'combine' | 'lookup' | 'format' | 'coerce' | 'substring' | 'custom';
|
|
3
|
+
/** What to do when a transform step encounters an error */
|
|
4
|
+
export type TransformOnError = 'Skip' | 'Null' | 'Fail';
|
|
5
|
+
/** A single step in a field value transformation pipeline */
|
|
6
|
+
export interface TransformStep {
|
|
7
|
+
/** The type of transform to apply */
|
|
8
|
+
Type: TransformType;
|
|
9
|
+
/** Configuration for the transform step */
|
|
10
|
+
Config: TransformConfig;
|
|
11
|
+
/** Error handling strategy for this step. Defaults to 'Fail' */
|
|
12
|
+
OnError?: TransformOnError;
|
|
13
|
+
}
|
|
14
|
+
/** Union of all transform configuration types */
|
|
15
|
+
export type TransformConfig = DirectConfig | RegexConfig | SplitConfig | CombineConfig | LookupConfig | FormatConfig | CoerceConfig | SubstringConfig | CustomConfig;
|
|
16
|
+
/** Configuration for direct pass-through (no transformation) */
|
|
17
|
+
export interface DirectConfig {
|
|
18
|
+
/** Optional default value if source is null/undefined */
|
|
19
|
+
DefaultValue?: unknown;
|
|
20
|
+
}
|
|
21
|
+
/** Configuration for regex-based string transformation */
|
|
22
|
+
export interface RegexConfig {
|
|
23
|
+
/** Regular expression pattern to match */
|
|
24
|
+
Pattern: string;
|
|
25
|
+
/** Replacement string (supports $1, $2, etc. for capture groups) */
|
|
26
|
+
Replacement: string;
|
|
27
|
+
/** Regex flags (e.g., 'gi' for global, case-insensitive) */
|
|
28
|
+
Flags?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Configuration for splitting a string value and extracting a portion */
|
|
31
|
+
export interface SplitConfig {
|
|
32
|
+
/** Delimiter to split on */
|
|
33
|
+
Delimiter: string;
|
|
34
|
+
/** Zero-based index of the part to extract */
|
|
35
|
+
Index: number;
|
|
36
|
+
}
|
|
37
|
+
/** Configuration for combining multiple source field values */
|
|
38
|
+
export interface CombineConfig {
|
|
39
|
+
/** Names of source fields to combine */
|
|
40
|
+
SourceFields: string[];
|
|
41
|
+
/** Separator to place between combined values */
|
|
42
|
+
Separator: string;
|
|
43
|
+
}
|
|
44
|
+
/** Configuration for value lookup/mapping */
|
|
45
|
+
export interface LookupConfig {
|
|
46
|
+
/** Map of source values to destination values. Keys are matched case-insensitively */
|
|
47
|
+
Map: Record<string, unknown>;
|
|
48
|
+
/** Value to use when the source value is not found in the map */
|
|
49
|
+
Default?: unknown;
|
|
50
|
+
}
|
|
51
|
+
/** Configuration for date/number formatting */
|
|
52
|
+
export interface FormatConfig {
|
|
53
|
+
/** The target format string. For dates: ISO8601 locale format specifiers */
|
|
54
|
+
FormatString: string;
|
|
55
|
+
/** The type of formatting to apply */
|
|
56
|
+
FormatType: 'date' | 'number' | 'string';
|
|
57
|
+
}
|
|
58
|
+
/** Configuration for type coercion */
|
|
59
|
+
export interface CoerceConfig {
|
|
60
|
+
/** Target type to coerce the value into */
|
|
61
|
+
TargetType: 'string' | 'number' | 'boolean' | 'date';
|
|
62
|
+
}
|
|
63
|
+
/** Configuration for extracting a substring */
|
|
64
|
+
export interface SubstringConfig {
|
|
65
|
+
/** Start index (zero-based) */
|
|
66
|
+
Start: number;
|
|
67
|
+
/** Number of characters to extract. If omitted, extracts to end */
|
|
68
|
+
Length?: number;
|
|
69
|
+
}
|
|
70
|
+
/** Configuration for custom JavaScript expression evaluation */
|
|
71
|
+
export interface CustomConfig {
|
|
72
|
+
/** JavaScript expression to evaluate. The source value is available as 'value' and all fields as 'fields' */
|
|
73
|
+
Expression: string;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,MAAM,aAAa,GACnB,QAAQ,GACR,OAAO,GACP,OAAO,GACP,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,QAAQ,CAAC;AAEf,2DAA2D;AAC3D,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAExD,6DAA6D;AAC7D,MAAM,WAAW,aAAa;IAC1B,qCAAqC;IACrC,IAAI,EAAE,aAAa,CAAC;IACpB,2CAA2C;IAC3C,MAAM,EAAE,eAAe,CAAC;IACxB,gEAAgE;IAChE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED,iDAAiD;AACjD,MAAM,MAAM,eAAe,GACrB,YAAY,GACZ,WAAW,GACX,WAAW,GACX,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,eAAe,GACf,YAAY,CAAC;AAEnB,gEAAgE;AAChE,MAAM,WAAW,YAAY;IACzB,yDAAyD;IACzD,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IACxB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IACxB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC1B,wCAAwC;IACxC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,6CAA6C;AAC7C,MAAM,WAAW,YAAY;IACzB,sFAAsF;IACtF,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IACzB,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;CAC5C;AAED,sCAAsC;AACtC,MAAM,WAAW,YAAY;IACzB,2CAA2C;IAC3C,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;CACxD;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC5B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,gEAAgE;AAChE,MAAM,WAAW,YAAY;IACzB,6GAA6G;IAC7G,UAAU,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.js","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { TransformStep } from './transforms.js';
|
|
2
|
+
/** Direction of data synchronization between MJ and external system */
|
|
3
|
+
export type SyncDirection = 'Pull' | 'Push' | 'Bidirectional';
|
|
4
|
+
/** What triggers a sync run */
|
|
5
|
+
export type SyncTriggerType = 'Scheduled' | 'Manual' | 'Webhook';
|
|
6
|
+
/** Type of watermark used for incremental sync */
|
|
7
|
+
export type WatermarkType = 'Timestamp' | 'Cursor' | 'ChangeToken' | 'Version';
|
|
8
|
+
/** How to resolve conflicts when both sides have changes */
|
|
9
|
+
export type ConflictResolution = 'SourceWins' | 'DestWins' | 'MostRecent' | 'Manual';
|
|
10
|
+
/** What to do when the external system marks a record as deleted */
|
|
11
|
+
export type DeleteBehavior = 'SoftDelete' | 'DoNothing' | 'HardDelete';
|
|
12
|
+
/** Classification of the change to apply to an MJ record */
|
|
13
|
+
export type RecordChangeType = 'Create' | 'Update' | 'Delete' | 'Skip';
|
|
14
|
+
/** Status of a running integration sync */
|
|
15
|
+
export type IntegrationRunStatus = 'Pending' | 'In Progress' | 'Success' | 'Failed';
|
|
16
|
+
/** Classification of sync errors for retry/alert decisions */
|
|
17
|
+
export type SyncErrorCode = 'VALIDATION_ERROR' | 'FK_CONSTRAINT_VIOLATION' | 'DUPLICATE_KEY' | 'NETWORK_TIMEOUT' | 'RATE_LIMIT_EXCEEDED' | 'CONNECTOR_ERROR' | 'TRANSFORM_ERROR' | 'MATCH_RESOLUTION_ERROR' | 'DATABASE_ERROR' | 'WATERMARK_INVALID' | 'CONFIGURATION_ERROR' | 'UNKNOWN_ERROR';
|
|
18
|
+
/** Severity level of a sync error */
|
|
19
|
+
export type ErrorSeverity = 'Critical' | 'Warning' | 'Info';
|
|
20
|
+
/** Whether an error with the given code is retryable */
|
|
21
|
+
export declare function IsRetryableError(code: SyncErrorCode): boolean;
|
|
22
|
+
/** Classify an error from its message/type into a structured code and severity */
|
|
23
|
+
export declare function ClassifyError(error: unknown): {
|
|
24
|
+
Code: SyncErrorCode;
|
|
25
|
+
Severity: ErrorSeverity;
|
|
26
|
+
};
|
|
27
|
+
/** A record fetched from an external system */
|
|
28
|
+
export interface ExternalRecord {
|
|
29
|
+
/** Unique identifier in the external system */
|
|
30
|
+
ExternalID: string;
|
|
31
|
+
/** Object type name in the external system (e.g., "Contact", "Company") */
|
|
32
|
+
ObjectType: string;
|
|
33
|
+
/** Field name→value pairs from the external system */
|
|
34
|
+
Fields: Record<string, unknown>;
|
|
35
|
+
/** When this record was last modified externally */
|
|
36
|
+
ModifiedAt?: Date;
|
|
37
|
+
/** Whether this record has been deleted in the external system */
|
|
38
|
+
IsDeleted?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** A record that has been mapped from external fields to MJ entity fields */
|
|
41
|
+
export interface MappedRecord {
|
|
42
|
+
/** The original external record */
|
|
43
|
+
ExternalRecord: ExternalRecord;
|
|
44
|
+
/** Target MJ entity name */
|
|
45
|
+
MJEntityName: string;
|
|
46
|
+
/** Fields mapped to MJ entity field names */
|
|
47
|
+
MappedFields: Record<string, unknown>;
|
|
48
|
+
/** What kind of change to apply */
|
|
49
|
+
ChangeType: RecordChangeType;
|
|
50
|
+
/** ID of an existing MJ record if matched */
|
|
51
|
+
MatchedMJRecordID?: string;
|
|
52
|
+
}
|
|
53
|
+
/** Aggregate result of a sync operation */
|
|
54
|
+
export interface SyncResult {
|
|
55
|
+
/** Whether the overall sync completed without fatal errors */
|
|
56
|
+
Success: boolean;
|
|
57
|
+
/** Total records processed */
|
|
58
|
+
RecordsProcessed: number;
|
|
59
|
+
/** New records created in MJ */
|
|
60
|
+
RecordsCreated: number;
|
|
61
|
+
/** Existing records updated in MJ */
|
|
62
|
+
RecordsUpdated: number;
|
|
63
|
+
/** Records deleted/soft-deleted in MJ */
|
|
64
|
+
RecordsDeleted: number;
|
|
65
|
+
/** Records that encountered errors */
|
|
66
|
+
RecordsErrored: number;
|
|
67
|
+
/** Records that were skipped */
|
|
68
|
+
RecordsSkipped: number;
|
|
69
|
+
/** Details of individual record errors */
|
|
70
|
+
Errors: SyncRecordError[];
|
|
71
|
+
/** Watermark value after this sync for incremental next-run */
|
|
72
|
+
WatermarkAfter?: string;
|
|
73
|
+
}
|
|
74
|
+
/** Error details for a single record during sync */
|
|
75
|
+
export interface SyncRecordError {
|
|
76
|
+
/** External system record identifier */
|
|
77
|
+
ExternalID: string;
|
|
78
|
+
/** The intended change type that failed */
|
|
79
|
+
ChangeType: RecordChangeType;
|
|
80
|
+
/** Human-readable error description */
|
|
81
|
+
ErrorMessage: string;
|
|
82
|
+
/** Structured error code for programmatic handling */
|
|
83
|
+
ErrorCode: SyncErrorCode;
|
|
84
|
+
/** Severity of this error */
|
|
85
|
+
Severity: ErrorSeverity;
|
|
86
|
+
/** The external record that caused the error, if available */
|
|
87
|
+
ExternalRecord?: ExternalRecord;
|
|
88
|
+
}
|
|
89
|
+
/** Progress tracking for a running sync operation */
|
|
90
|
+
export interface SyncProgress {
|
|
91
|
+
/** Index of the current entity map being processed (0-based) */
|
|
92
|
+
EntityMapIndex: number;
|
|
93
|
+
/** Total number of entity maps to process */
|
|
94
|
+
TotalEntityMaps: number;
|
|
95
|
+
/** Number of records processed in the current entity map */
|
|
96
|
+
RecordsProcessedInCurrentMap: number;
|
|
97
|
+
/** Total records fetched for the current entity map */
|
|
98
|
+
TotalRecordsInCurrentMap: number;
|
|
99
|
+
/** Overall percent complete (0-100) */
|
|
100
|
+
PercentComplete: number;
|
|
101
|
+
}
|
|
102
|
+
/** Callback for progress tracking during sync */
|
|
103
|
+
export type OnProgressCallback = (progress: SyncProgress) => void;
|
|
104
|
+
/** Notification event type — what triggered the notification */
|
|
105
|
+
export type SyncNotificationEvent = 'SyncCompleted' | 'SyncFailed' | 'SyncCompletedWithErrors';
|
|
106
|
+
/** Severity level for a sync notification */
|
|
107
|
+
export type SyncNotificationSeverity = 'Info' | 'Warning' | 'Error';
|
|
108
|
+
/** Notification emitted after a sync run completes or fails */
|
|
109
|
+
export interface SyncNotification {
|
|
110
|
+
/** What happened to trigger this notification */
|
|
111
|
+
Event: SyncNotificationEvent;
|
|
112
|
+
/** Overall severity */
|
|
113
|
+
Severity: SyncNotificationSeverity;
|
|
114
|
+
/** ID of the CompanyIntegration that was synced */
|
|
115
|
+
CompanyIntegrationID: string;
|
|
116
|
+
/** ID of the run record created for this sync */
|
|
117
|
+
RunID: string;
|
|
118
|
+
/** Human-readable summary suitable for email subject lines */
|
|
119
|
+
Subject: string;
|
|
120
|
+
/** Full text body — formatted for human consumption */
|
|
121
|
+
Body: string;
|
|
122
|
+
/** The aggregate sync result for programmatic access */
|
|
123
|
+
Result: SyncResult;
|
|
124
|
+
/** When the notification was emitted */
|
|
125
|
+
OccurredAt: Date;
|
|
126
|
+
}
|
|
127
|
+
/** Callback invoked after a sync run completes (success or failure) */
|
|
128
|
+
export type OnNotificationCallback = (notification: SyncNotification) => void;
|
|
129
|
+
/** Top-level container returned by a connector's IntrospectSchema(). */
|
|
130
|
+
export interface SourceSchemaInfo {
|
|
131
|
+
/** All objects (tables, API entities) discovered in the source system. */
|
|
132
|
+
Objects: SourceObjectInfo[];
|
|
133
|
+
}
|
|
134
|
+
/** One source object (table, API entity) discovered during introspection. */
|
|
135
|
+
export interface SourceObjectInfo {
|
|
136
|
+
/** Name in the source system (e.g., "deals", "MemberList"). */
|
|
137
|
+
ExternalName: string;
|
|
138
|
+
/** Human-readable label (e.g., "Deals", "Members"). */
|
|
139
|
+
ExternalLabel: string;
|
|
140
|
+
/** Human-readable description of the object's purpose (used for sp_addextendedproperty on the table). */
|
|
141
|
+
Description?: string;
|
|
142
|
+
/** Fields/columns in the source object. */
|
|
143
|
+
Fields: SourceFieldInfo[];
|
|
144
|
+
/** Primary key field name(s). */
|
|
145
|
+
PrimaryKeyFields: string[];
|
|
146
|
+
/** Foreign key relationships to other source objects. */
|
|
147
|
+
Relationships: SourceRelationshipInfo[];
|
|
148
|
+
}
|
|
149
|
+
/** One field/column in a source object discovered during introspection. */
|
|
150
|
+
export interface SourceFieldInfo {
|
|
151
|
+
/** Field name in the source system. */
|
|
152
|
+
Name: string;
|
|
153
|
+
/** Human-readable label. */
|
|
154
|
+
Label: string;
|
|
155
|
+
/** Human-readable description of the field's purpose (used for sp_addextendedproperty on the column). */
|
|
156
|
+
Description?: string;
|
|
157
|
+
/** Generic source type (e.g., "string", "integer", "datetime", "boolean"). */
|
|
158
|
+
SourceType: string;
|
|
159
|
+
/** Whether the field is required/non-nullable. */
|
|
160
|
+
IsRequired: boolean;
|
|
161
|
+
/** Maximum length for string types (null if not applicable). */
|
|
162
|
+
MaxLength: number | null;
|
|
163
|
+
/** Precision for numeric types (null if not applicable). */
|
|
164
|
+
Precision: number | null;
|
|
165
|
+
/** Scale for numeric types (null if not applicable). */
|
|
166
|
+
Scale: number | null;
|
|
167
|
+
/** Default value expression (null if none). */
|
|
168
|
+
DefaultValue: string | null;
|
|
169
|
+
/** Whether this field is part of the primary key. */
|
|
170
|
+
IsPrimaryKey: boolean;
|
|
171
|
+
/** Whether this field is a foreign key. */
|
|
172
|
+
IsForeignKey: boolean;
|
|
173
|
+
/** If FK, which source object it references (null if not a FK). */
|
|
174
|
+
ForeignKeyTarget: string | null;
|
|
175
|
+
}
|
|
176
|
+
/** One foreign key relationship in a source object. */
|
|
177
|
+
export interface SourceRelationshipInfo {
|
|
178
|
+
/** Field in this object that references another object. */
|
|
179
|
+
FieldName: string;
|
|
180
|
+
/** Target source object name. */
|
|
181
|
+
TargetObject: string;
|
|
182
|
+
/** Target field name (usually the PK). */
|
|
183
|
+
TargetField: string;
|
|
184
|
+
}
|
|
185
|
+
/** A default field mapping returned by a connector's discovery */
|
|
186
|
+
export interface DefaultFieldMapping {
|
|
187
|
+
/** Field name in the external system */
|
|
188
|
+
SourceFieldName: string;
|
|
189
|
+
/** Corresponding MJ entity field name */
|
|
190
|
+
DestinationFieldName: string;
|
|
191
|
+
/** Optional transform pipeline to apply */
|
|
192
|
+
TransformPipeline?: TransformStep[];
|
|
193
|
+
/** Whether this field is used for record matching */
|
|
194
|
+
IsKeyField?: boolean;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@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AC3D,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,kEAAkE;AAClE,MAAM,WAAW,mBAAmB;IAChC,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,2CAA2C;IAC3C,iBAAiB,CAAC,EAAE,aAAa,EAAE,CAAC;IACpC,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Whether an error with the given code is retryable */
|
|
2
|
+
export function IsRetryableError(code) {
|
|
3
|
+
return code === 'NETWORK_TIMEOUT' || code === 'RATE_LIMIT_EXCEEDED' || code === 'DATABASE_ERROR';
|
|
4
|
+
}
|
|
5
|
+
/** Classify an error from its message/type into a structured code and severity */
|
|
6
|
+
export function ClassifyError(error) {
|
|
7
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
8
|
+
const lower = message.toLowerCase();
|
|
9
|
+
if (lower.includes('timeout') || lower.includes('timed out') || lower.includes('econnreset')) {
|
|
10
|
+
return { Code: 'NETWORK_TIMEOUT', Severity: 'Warning' };
|
|
11
|
+
}
|
|
12
|
+
if (lower.includes('rate limit') || lower.includes('throttl') || lower.includes('429')) {
|
|
13
|
+
return { Code: 'RATE_LIMIT_EXCEEDED', Severity: 'Warning' };
|
|
14
|
+
}
|
|
15
|
+
if (lower.includes('foreign key') || lower.includes('fk_') || lower.includes('reference constraint')) {
|
|
16
|
+
return { Code: 'FK_CONSTRAINT_VIOLATION', Severity: 'Critical' };
|
|
17
|
+
}
|
|
18
|
+
if (lower.includes('duplicate') || lower.includes('unique constraint') || lower.includes('primary key')) {
|
|
19
|
+
return { Code: 'DUPLICATE_KEY', Severity: 'Warning' };
|
|
20
|
+
}
|
|
21
|
+
if (lower.includes('validation') || lower.includes('validate')) {
|
|
22
|
+
return { Code: 'VALIDATION_ERROR', Severity: 'Warning' };
|
|
23
|
+
}
|
|
24
|
+
if (lower.includes('transform') || lower.includes('mapping')) {
|
|
25
|
+
return { Code: 'TRANSFORM_ERROR', Severity: 'Warning' };
|
|
26
|
+
}
|
|
27
|
+
if (lower.includes('match') || lower.includes('resolve')) {
|
|
28
|
+
return { Code: 'MATCH_RESOLUTION_ERROR', Severity: 'Warning' };
|
|
29
|
+
}
|
|
30
|
+
if (lower.includes('watermark') || lower.includes('invalid watermark')) {
|
|
31
|
+
return { Code: 'WATERMARK_INVALID', Severity: 'Warning' };
|
|
32
|
+
}
|
|
33
|
+
if (lower.includes('configuration') || lower.includes('config')) {
|
|
34
|
+
return { Code: 'CONFIGURATION_ERROR', Severity: 'Critical' };
|
|
35
|
+
}
|
|
36
|
+
if (lower.includes('connect') || lower.includes('econnrefused') || lower.includes('sql')) {
|
|
37
|
+
return { Code: 'DATABASE_ERROR', Severity: 'Critical' };
|
|
38
|
+
}
|
|
39
|
+
if (lower.includes('connector')) {
|
|
40
|
+
return { Code: 'CONNECTOR_ERROR', Severity: 'Critical' };
|
|
41
|
+
}
|
|
42
|
+
return { Code: 'UNKNOWN_ERROR', Severity: 'Critical' };
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyCA,wDAAwD;AACxD,MAAM,UAAU,gBAAgB,CAAC,IAAmB;IAChD,OAAO,IAAI,KAAK,iBAAiB,IAAI,IAAI,KAAK,qBAAqB,IAAI,IAAI,KAAK,gBAAgB,CAAC;AACrG,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,aAAa,CAAC,KAAc;IACxC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CA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3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/integration-engine",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "5.9.0",
|
|
5
|
+
"description": "MemberJunction Integration Engine - orchestration, field mapping, and connector framework",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"/dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc && tsc-alias -f",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@memberjunction/core": "5.9.0",
|
|
18
|
+
"@memberjunction/core-entities": "5.9.0",
|
|
19
|
+
"@memberjunction/global": "5.9.0",
|
|
20
|
+
"@memberjunction/integration-engine-base": "5.9.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.9.3",
|
|
24
|
+
"tsc-alias": "^1.8.16",
|
|
25
|
+
"vitest": "^4.0.18"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/MemberJunction/MJ"
|
|
30
|
+
},
|
|
31
|
+
"author": "MemberJunction.com",
|
|
32
|
+
"license": "ISC"
|
|
10
33
|
}
|