@memberjunction/global 5.42.0 → 5.43.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 +89 -0
- package/dist/KeyedSerialTaskQueue.d.ts +60 -0
- package/dist/KeyedSerialTaskQueue.d.ts.map +1 -0
- package/dist/KeyedSerialTaskQueue.js +76 -0
- package/dist/KeyedSerialTaskQueue.js.map +1 -0
- package/dist/__tests__/FieldRulesEvaluator.test.d.ts +2 -0
- package/dist/__tests__/FieldRulesEvaluator.test.d.ts.map +1 -0
- package/dist/__tests__/FieldRulesEvaluator.test.js +167 -0
- package/dist/__tests__/FieldRulesEvaluator.test.js.map +1 -0
- package/dist/__tests__/KeyedSerialTaskQueue.test.d.ts +2 -0
- package/dist/__tests__/KeyedSerialTaskQueue.test.d.ts.map +1 -0
- package/dist/__tests__/KeyedSerialTaskQueue.test.js +91 -0
- package/dist/__tests__/KeyedSerialTaskQueue.test.js.map +1 -0
- package/dist/fieldRules/FieldRulesEvaluator.d.ts +34 -0
- package/dist/fieldRules/FieldRulesEvaluator.d.ts.map +1 -0
- package/dist/fieldRules/FieldRulesEvaluator.js +130 -0
- package/dist/fieldRules/FieldRulesEvaluator.js.map +1 -0
- package/dist/fieldRules/FieldTransformEngine.d.ts +44 -0
- package/dist/fieldRules/FieldTransformEngine.d.ts.map +1 -0
- package/dist/fieldRules/FieldTransformEngine.js +189 -0
- package/dist/fieldRules/FieldTransformEngine.js.map +1 -0
- package/dist/fieldRules/index.d.ts +6 -0
- package/dist/fieldRules/index.d.ts.map +1 -0
- package/dist/fieldRules/index.js +6 -0
- package/dist/fieldRules/index.js.map +1 -0
- package/dist/fieldRules/rules.d.ts +135 -0
- package/dist/fieldRules/rules.d.ts.map +1 -0
- package/dist/fieldRules/rules.js +2 -0
- package/dist/fieldRules/rules.js.map +1 -0
- package/dist/fieldRules/transformRegistry.d.ts +22 -0
- package/dist/fieldRules/transformRegistry.d.ts.map +1 -0
- package/dist/fieldRules/transformRegistry.js +33 -0
- package/dist/fieldRules/transformRegistry.js.map +1 -0
- package/dist/fieldRules/transforms.d.ts +102 -0
- package/dist/fieldRules/transforms.d.ts.map +1 -0
- package/dist/fieldRules/transforms.js +8 -0
- package/dist/fieldRules/transforms.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field-value transform pipeline types.
|
|
3
|
+
*
|
|
4
|
+
* This package is the canonical home for these types. The MemberJunction integration field-mapping
|
|
5
|
+
* engine and the rules-based bulk-update processor both consume them — author once, reuse everywhere.
|
|
6
|
+
*/
|
|
7
|
+
/** Supported transform types for field value transformation */
|
|
8
|
+
export type TransformType = 'direct' | 'regex' | 'split' | 'combine' | 'lookup' | 'format' | 'coerce' | 'substring' | 'custom' | 'jsonpath' | 'xpath';
|
|
9
|
+
/** What to do when a transform step encounters an error */
|
|
10
|
+
export type TransformOnError = 'Skip' | 'Null' | 'Fail';
|
|
11
|
+
/** A single step in a field value transformation pipeline */
|
|
12
|
+
export interface TransformStep {
|
|
13
|
+
/** The type of transform to apply */
|
|
14
|
+
Type: TransformType;
|
|
15
|
+
/** Configuration for the transform step */
|
|
16
|
+
Config: TransformConfig;
|
|
17
|
+
/** Error handling strategy for this step. Defaults to 'Null' (grace — null the field, keep going). */
|
|
18
|
+
OnError?: TransformOnError;
|
|
19
|
+
}
|
|
20
|
+
/** Configuration for extracting value(s) from JSON via a JSONPath expression. */
|
|
21
|
+
export interface JsonPathConfig {
|
|
22
|
+
/** JSONPath expression, e.g. `$.store.book[0].title` or `$..author`. */
|
|
23
|
+
Path: string;
|
|
24
|
+
/** Return only the first match (default). When false, returns the full array of matches. */
|
|
25
|
+
First?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Configuration for extracting value(s) from XML via an XPath expression. */
|
|
28
|
+
export interface XPathConfig {
|
|
29
|
+
/** XPath expression, e.g. `/catalog/book[1]/title/text()` or `//author`. */
|
|
30
|
+
Path: string;
|
|
31
|
+
/** Return only the first match (default). When false, returns the full array of matches. */
|
|
32
|
+
First?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Union of all transform configuration types */
|
|
35
|
+
export type TransformConfig = DirectConfig | RegexConfig | SplitConfig | CombineConfig | LookupConfig | FormatConfig | JsonPathConfig | XPathConfig | CoerceConfig | SubstringConfig | CustomConfig;
|
|
36
|
+
/** Configuration for direct pass-through (no transformation) */
|
|
37
|
+
export interface DirectConfig {
|
|
38
|
+
/** Optional default value if source is null/undefined */
|
|
39
|
+
DefaultValue?: unknown;
|
|
40
|
+
}
|
|
41
|
+
/** Configuration for regex-based string transformation */
|
|
42
|
+
export interface RegexConfig {
|
|
43
|
+
/** Regular expression pattern to match */
|
|
44
|
+
Pattern: string;
|
|
45
|
+
/** Replacement string (supports $1, $2, etc. for capture groups) */
|
|
46
|
+
Replacement: string;
|
|
47
|
+
/** Regex flags (e.g., 'gi' for global, case-insensitive) */
|
|
48
|
+
Flags?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Configuration for splitting a string value and extracting a portion */
|
|
51
|
+
export interface SplitConfig {
|
|
52
|
+
/** Delimiter to split on */
|
|
53
|
+
Delimiter: string;
|
|
54
|
+
/** Zero-based index of the part to extract */
|
|
55
|
+
Index: number;
|
|
56
|
+
}
|
|
57
|
+
/** Configuration for combining multiple source field values */
|
|
58
|
+
export interface CombineConfig {
|
|
59
|
+
/** Names of source fields to combine */
|
|
60
|
+
SourceFields: string[];
|
|
61
|
+
/** Separator to place between combined values */
|
|
62
|
+
Separator: string;
|
|
63
|
+
}
|
|
64
|
+
/** Configuration for value lookup/mapping (in-memory translation table — not an entity lookup) */
|
|
65
|
+
export interface LookupConfig {
|
|
66
|
+
/** Map of source values to destination values. Keys are matched case-insensitively */
|
|
67
|
+
Map: Record<string, unknown>;
|
|
68
|
+
/** Value to use when the source value is not found in the map */
|
|
69
|
+
Default?: unknown;
|
|
70
|
+
}
|
|
71
|
+
/** Configuration for date/number formatting */
|
|
72
|
+
export interface FormatConfig {
|
|
73
|
+
/** The target format string. For dates: ISO8601 locale format specifiers */
|
|
74
|
+
FormatString: string;
|
|
75
|
+
/** The type of formatting to apply */
|
|
76
|
+
FormatType: 'date' | 'number' | 'string';
|
|
77
|
+
}
|
|
78
|
+
/** Configuration for type coercion */
|
|
79
|
+
export interface CoerceConfig {
|
|
80
|
+
/** Target type to coerce the value into */
|
|
81
|
+
TargetType: 'string' | 'number' | 'boolean' | 'date';
|
|
82
|
+
}
|
|
83
|
+
/** Configuration for extracting a substring */
|
|
84
|
+
export interface SubstringConfig {
|
|
85
|
+
/** Start index (zero-based) */
|
|
86
|
+
Start: number;
|
|
87
|
+
/** Number of characters to extract. If omitted, extracts to end */
|
|
88
|
+
Length?: number;
|
|
89
|
+
}
|
|
90
|
+
/** Configuration for custom JavaScript expression evaluation */
|
|
91
|
+
export interface CustomConfig {
|
|
92
|
+
/** JavaScript expression to evaluate. The source value is available as 'value' and all fields as 'fields' */
|
|
93
|
+
Expression: string;
|
|
94
|
+
}
|
|
95
|
+
/** Result of running a transform step or pipeline. */
|
|
96
|
+
export interface TransformStepResult {
|
|
97
|
+
/** The resulting value (undefined when Skipped). */
|
|
98
|
+
Value: unknown;
|
|
99
|
+
/** True when an OnError='Skip' step asked to drop the field entirely. */
|
|
100
|
+
Skipped: boolean;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=transforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/fieldRules/transforms.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+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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,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,kGAAkG;AAClG,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;AAED,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAChC,oDAAoD;IACpD,KAAK,EAAE,OAAO,CAAC;IACf,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field-value transform pipeline types.
|
|
3
|
+
*
|
|
4
|
+
* This package is the canonical home for these types. The MemberJunction integration field-mapping
|
|
5
|
+
* engine and the rules-based bulk-update processor both consume them — author once, reuse everywhere.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=transforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transforms.js","sourceRoot":"","sources":["../../src/fieldRules/transforms.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,9 +14,11 @@ export * from './util/SerializationUtils.js';
|
|
|
14
14
|
export * from './ValidationTypes.js';
|
|
15
15
|
export * from './JSONValidator.js';
|
|
16
16
|
export * from './SafeExpressionEvaluator.js';
|
|
17
|
+
export * from './fieldRules/index.js';
|
|
17
18
|
export * from './SQLExpressionValidator.js';
|
|
18
19
|
export * from './warningManager.js';
|
|
19
20
|
export * from './EncryptionUtils.js';
|
|
21
|
+
export * from './KeyedSerialTaskQueue.js';
|
|
20
22
|
export * from './Global.js';
|
|
21
23
|
export * from './RegisterClass.js';
|
|
22
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAChE,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAChE,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,cAAc,CAAA;AAC5B,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AAMtC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -15,9 +15,11 @@ export * from './util/SerializationUtils.js';
|
|
|
15
15
|
export * from './ValidationTypes.js';
|
|
16
16
|
export * from './JSONValidator.js';
|
|
17
17
|
export * from './SafeExpressionEvaluator.js';
|
|
18
|
+
export * from './fieldRules/index.js';
|
|
18
19
|
export * from './SQLExpressionValidator.js';
|
|
19
20
|
export * from './warningManager.js';
|
|
20
21
|
export * from './EncryptionUtils.js';
|
|
22
|
+
export * from './KeyedSerialTaskQueue.js';
|
|
21
23
|
// NOTE: TelemetryManager has moved to @memberjunction/core
|
|
22
24
|
// Import from there instead of here
|
|
23
25
|
// Export the main classes
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAChE,cAAc,aAAa,CAAA;AAC3B,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