@memberjunction/record-comparison 0.0.1 → 5.44.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 +51 -43
- package/dist/RecordComparisonEngine.d.ts +193 -0
- package/dist/RecordComparisonEngine.d.ts.map +1 -0
- package/dist/RecordComparisonEngine.js +268 -0
- package/dist/RecordComparisonEngine.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/operations/RecordComparisonCompareOperation.d.ts +10 -0
- package/dist/operations/RecordComparisonCompareOperation.d.ts.map +1 -0
- package/dist/operations/RecordComparisonCompareOperation.js +63 -0
- package/dist/operations/RecordComparisonCompareOperation.js.map +1 -0
- package/package.json +28 -7
package/README.md
CHANGED
|
@@ -1,45 +1,53 @@
|
|
|
1
1
|
# @memberjunction/record-comparison
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
3
|
+
Framework-agnostic **record comparison** primitive for MemberJunction.
|
|
4
|
+
|
|
5
|
+
`RecordComparisonEngine` loads a set of records for a single entity and computes a
|
|
6
|
+
structured, field-level delta between them — a survivor candidate plus its potential
|
|
7
|
+
matches diffed column-by-column. It performs a read-only load (`RunView` with
|
|
8
|
+
`ResultType: 'simple'` and a targeted field list) and never mutates records.
|
|
9
|
+
|
|
10
|
+
## Why this package exists
|
|
11
|
+
|
|
12
|
+
The comparison logic is needed by two callers that sit on **opposite sides** of the
|
|
13
|
+
dependency graph:
|
|
14
|
+
|
|
15
|
+
- The **LLM duplicate-detection reasoning path** (`@memberjunction/ai-vector-dupe`),
|
|
16
|
+
which feeds the differing-field deltas to the reasoning provider as context.
|
|
17
|
+
- The **server/UI side-by-side comparison panel**
|
|
18
|
+
(`@memberjunction/core-entities-server` → `MJServer` resolver → GraphQL client →
|
|
19
|
+
Angular `record-merge`).
|
|
20
|
+
|
|
21
|
+
`@memberjunction/core-entities-server` depends on `@memberjunction/ai-vector-dupe`, so
|
|
22
|
+
the dupe package sits *lower* in the graph and cannot reach an engine that lives in the
|
|
23
|
+
server package without creating a build cycle. Hoisting the engine into this low-level
|
|
24
|
+
package (its only dependency is `@memberjunction/core`) gives both sides a single
|
|
25
|
+
implementation with no cycle and no duplicated delta logic.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { RecordComparisonEngine } from '@memberjunction/record-comparison';
|
|
31
|
+
import { CompositeKey } from '@memberjunction/core';
|
|
32
|
+
|
|
33
|
+
const engine = new RecordComparisonEngine();
|
|
34
|
+
|
|
35
|
+
// By entity name (resolver / UI path) — resolves the entity from metadata.
|
|
36
|
+
const result = await engine.CompareRecords(
|
|
37
|
+
{ EntityName: 'Accounts', Keys: [survivorKey, candidateKey] },
|
|
38
|
+
contextUser,
|
|
39
|
+
provider // request-scoped IMetadataProvider (multi-provider safety)
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// With an already-resolved EntityInfo + an injected RunView (dupe path) — skips the
|
|
43
|
+
// by-name lookup and reuses the caller's request-scoped RunView.
|
|
44
|
+
const result2 = await engine.CompareRecordsForEntity(
|
|
45
|
+
entityInfo,
|
|
46
|
+
[sourceKey, ...candidateKeys],
|
|
47
|
+
contextUser,
|
|
48
|
+
{ runView }
|
|
49
|
+
);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`result.Fields` is a plain-data delta matrix (no `BaseEntity` instances), so it
|
|
53
|
+
serializes cleanly across GraphQL and into a reasoning prompt.
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { RunView, CompositeKey, EntityInfo, EntityFieldInfo, UserInfo, IMetadataProvider } from '@memberjunction/core';
|
|
2
|
+
/**
|
|
3
|
+
* Input to {@link RecordComparisonEngine.CompareRecords}.
|
|
4
|
+
*
|
|
5
|
+
* Describes the set of records (a survivor candidate plus its potential matches)
|
|
6
|
+
* to load and diff field-by-field for a single entity.
|
|
7
|
+
*/
|
|
8
|
+
export interface RecordComparisonInput {
|
|
9
|
+
/** Registered entity name (e.g. "Accounts"), NOT the physical table name. */
|
|
10
|
+
EntityName: string;
|
|
11
|
+
/**
|
|
12
|
+
* The composite keys of the records to compare. By convention the first key is
|
|
13
|
+
* the survivor candidate and the remainder are potential matches, but the engine
|
|
14
|
+
* treats all records uniformly — ordering is preserved in the output column index.
|
|
15
|
+
*/
|
|
16
|
+
Keys: CompositeKey[];
|
|
17
|
+
/**
|
|
18
|
+
* Optional include-list of field names to restrict the comparison to. When omitted,
|
|
19
|
+
* all visible (non-PK, non-system) fields are compared. Field names are matched
|
|
20
|
+
* case-insensitively against the entity's field metadata.
|
|
21
|
+
*/
|
|
22
|
+
IncludeFields?: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* One record loaded for comparison. The `Key` correlates this record back to the
|
|
26
|
+
* input column index; `Values` is a plain map of fieldName → value for that record.
|
|
27
|
+
*/
|
|
28
|
+
export interface RecordComparisonRecord {
|
|
29
|
+
/** Zero-based index aligned with the input `Keys` array (the comparison column). */
|
|
30
|
+
ColumnIndex: number;
|
|
31
|
+
/** The composite key identifying this record (as supplied in the input). */
|
|
32
|
+
Key: CompositeKey;
|
|
33
|
+
/** A human-readable label for the record (name-field value when available, else the key). */
|
|
34
|
+
Label: string;
|
|
35
|
+
/** Plain field-name → value map for this record (only the compared fields). */
|
|
36
|
+
Values: Record<string, RecordFieldValue>;
|
|
37
|
+
}
|
|
38
|
+
/** A scalar field value as loaded from the database (never a BaseEntity). */
|
|
39
|
+
export type RecordFieldValue = string | number | boolean | null;
|
|
40
|
+
/**
|
|
41
|
+
* Options for {@link RecordComparisonEngine.CompareRecordsForEntity}.
|
|
42
|
+
*/
|
|
43
|
+
export interface RecordComparisonOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Optional include-list of field names. When omitted, all visible (non-PK, non-system)
|
|
46
|
+
* fields are compared. Matched case-insensitively against the entity's field metadata.
|
|
47
|
+
*/
|
|
48
|
+
IncludeFields?: string[];
|
|
49
|
+
/**
|
|
50
|
+
* An already-constructed `RunView` to load the records through. When supplied, it is used
|
|
51
|
+
* verbatim, so callers can thread their own request-scoped/provider-bound RunView (e.g. the
|
|
52
|
+
* duplicate detector). When omitted, a RunView is built from {@link RecordComparisonOptions.Provider}.
|
|
53
|
+
*/
|
|
54
|
+
RunViewInstance?: RunView;
|
|
55
|
+
/** Request-scoped metadata provider (multi-provider safety) used to build a RunView when one isn't supplied. */
|
|
56
|
+
Provider?: IMetadataProvider;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The per-record value of a single field within a {@link RecordComparisonFieldDelta}.
|
|
60
|
+
*/
|
|
61
|
+
export interface RecordComparisonFieldCell {
|
|
62
|
+
/** Column index aligned with {@link RecordComparisonRecord.ColumnIndex}. */
|
|
63
|
+
ColumnIndex: number;
|
|
64
|
+
/** The field's value for this record. */
|
|
65
|
+
Value: RecordFieldValue;
|
|
66
|
+
/**
|
|
67
|
+
* True when this cell's value is equal (case-insensitive, trimmed) to the
|
|
68
|
+
* reference cell (column 0, the survivor candidate). Column 0 is always true.
|
|
69
|
+
*/
|
|
70
|
+
EqualsReference: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The delta for a single field across all compared records.
|
|
74
|
+
*/
|
|
75
|
+
export interface RecordComparisonFieldDelta {
|
|
76
|
+
/** Field name (matches the entity field metadata Name). */
|
|
77
|
+
FieldName: string;
|
|
78
|
+
/** Display name for the field (falls back to FieldName). */
|
|
79
|
+
DisplayName: string;
|
|
80
|
+
/** Optional grouping category from the field metadata. */
|
|
81
|
+
Category: string | null;
|
|
82
|
+
/** Per-record values for this field, in column order. */
|
|
83
|
+
Cells: RecordComparisonFieldCell[];
|
|
84
|
+
/**
|
|
85
|
+
* True when at least one record's value differs from the reference (column 0).
|
|
86
|
+
* False when every record shares the same value.
|
|
87
|
+
*/
|
|
88
|
+
Differs: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The serializable result of comparing a set of records: the loaded records plus a
|
|
92
|
+
* per-field delta matrix. This is the LLM "deltas" payload and (eventually) the UI
|
|
93
|
+
* side-by-side model — it is plain-data only and contains no BaseEntity instances.
|
|
94
|
+
*/
|
|
95
|
+
export interface RecordComparisonResult {
|
|
96
|
+
/** Whether the comparison succeeded. */
|
|
97
|
+
Success: boolean;
|
|
98
|
+
/** Populated when {@link Success} is false. */
|
|
99
|
+
ErrorMessage?: string;
|
|
100
|
+
/** Registered entity name that was compared. */
|
|
101
|
+
EntityName: string;
|
|
102
|
+
/** The loaded records, in input column order. */
|
|
103
|
+
Records: RecordComparisonRecord[];
|
|
104
|
+
/** The per-field delta matrix. Only fields with at least one non-empty value are included. */
|
|
105
|
+
Fields: RecordComparisonFieldDelta[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Framework-agnostic engine that loads a set of records for one entity and computes a
|
|
109
|
+
* structured field-level delta between them.
|
|
110
|
+
*
|
|
111
|
+
* This is the shared comparison primitive used by the LLM reasoning path (it feeds the
|
|
112
|
+
* "deltas" context to the reasoning provider) and, opportunistically, by the UI
|
|
113
|
+
* side-by-side comparison panel. It performs a read-only load (`RunView` with
|
|
114
|
+
* `ResultType: 'simple'` + targeted `Fields`) — it never mutates records.
|
|
115
|
+
*
|
|
116
|
+
* No Angular, no Router, no resolver coupling. Server-side: always thread `contextUser`
|
|
117
|
+
* and (in multi-provider scenarios) the request-scoped `provider`.
|
|
118
|
+
*/
|
|
119
|
+
export declare class RecordComparisonEngine {
|
|
120
|
+
/**
|
|
121
|
+
* Loads the requested records and computes the field-delta matrix.
|
|
122
|
+
*
|
|
123
|
+
* @param input the entity, keys, and optional field include-list to compare
|
|
124
|
+
* @param contextUser the server-side context user (REQUIRED for correct isolation)
|
|
125
|
+
* @param provider optional request-scoped metadata provider (multi-provider safety)
|
|
126
|
+
*/
|
|
127
|
+
CompareRecords(input: RecordComparisonInput, contextUser: UserInfo, provider?: IMetadataProvider): Promise<RecordComparisonResult>;
|
|
128
|
+
/**
|
|
129
|
+
* The lower-level comparison entry point: given an already-resolved {@link EntityInfo}
|
|
130
|
+
* (no by-name metadata lookup), load the keyed records and compute the field-delta matrix.
|
|
131
|
+
*
|
|
132
|
+
* Callers that already hold the entity and a request-scoped `RunView` (e.g. the duplicate
|
|
133
|
+
* detector) use this directly via {@link RecordComparisonOptions.RunViewInstance}, avoiding a
|
|
134
|
+
* redundant metadata resolution. The by-name {@link RecordComparisonEngine.CompareRecords}
|
|
135
|
+
* resolves the entity and delegates here.
|
|
136
|
+
*
|
|
137
|
+
* @param entity the resolved entity to compare records within
|
|
138
|
+
* @param keys the composite keys to compare (column 0 is the reference/survivor candidate)
|
|
139
|
+
* @param contextUser the server-side context user (thread for correct isolation)
|
|
140
|
+
* @param options include-list, an injected RunView, and/or the request-scoped provider
|
|
141
|
+
*/
|
|
142
|
+
CompareRecordsForEntity(entity: EntityInfo, keys: CompositeKey[], contextUser?: UserInfo, options?: RecordComparisonOptions): Promise<RecordComparisonResult>;
|
|
143
|
+
/**
|
|
144
|
+
* Resolves the set of fields to compare: the include-list (case-insensitive) when
|
|
145
|
+
* supplied, otherwise all non-PK, non-system fields. Sorted name-field → DefaultInView → Sequence.
|
|
146
|
+
*/
|
|
147
|
+
protected selectFields(entity: EntityInfo, includeFields?: string[]): EntityFieldInfo[];
|
|
148
|
+
/** True when a field should participate in the comparison. */
|
|
149
|
+
protected isComparableField(field: EntityFieldInfo, includeSet: Set<string> | null): boolean;
|
|
150
|
+
/** True for MemberJunction system/internal columns that should not be diffed. */
|
|
151
|
+
protected isSystemField(fieldName: string): boolean;
|
|
152
|
+
/** Orders fields name-field first, then DefaultInView, then by Sequence/Name. */
|
|
153
|
+
protected compareFieldOrder(a: EntityFieldInfo, b: EntityFieldInfo): number;
|
|
154
|
+
/**
|
|
155
|
+
* Loads the records via a single read-only RunView OR-ing every supplied key.
|
|
156
|
+
* Returns plain rows (ResultType 'simple') or null on failure.
|
|
157
|
+
*/
|
|
158
|
+
protected loadRecords(entity: EntityInfo, keys: CompositeKey[], fields: EntityFieldInfo[], contextUser: UserInfo | undefined, options?: RecordComparisonOptions): Promise<Record<string, RecordFieldValue>[] | null>;
|
|
159
|
+
/** Builds the field-name select list: PK fields + the compared fields (deduped). */
|
|
160
|
+
protected buildSelectFieldNames(entity: EntityInfo, fields: EntityFieldInfo[]): string[];
|
|
161
|
+
/** Builds an OR-ed WHERE clause across all keys, e.g. "(ID='a') OR (ID='b')". */
|
|
162
|
+
protected buildKeysFilter(keys: CompositeKey[]): string | null;
|
|
163
|
+
/**
|
|
164
|
+
* Correlates each input key (by column index) with its loaded row and builds the
|
|
165
|
+
* per-record value maps. Missing rows yield a record with all-null values.
|
|
166
|
+
*/
|
|
167
|
+
protected buildRecords(entity: EntityInfo, keys: CompositeKey[], fields: EntityFieldInfo[], rawRecords: Record<string, RecordFieldValue>[]): RecordComparisonRecord[];
|
|
168
|
+
/** Finds the loaded row whose primary-key values match the supplied composite key. */
|
|
169
|
+
protected findRowForKey(entity: EntityInfo, key: CompositeKey, rawRecords: Record<string, RecordFieldValue>[]): Record<string, RecordFieldValue> | null;
|
|
170
|
+
/** True when every PK value on the row equals the key's value (case-insensitive). */
|
|
171
|
+
protected rowMatchesKey(entity: EntityInfo, key: CompositeKey, row: Record<string, RecordFieldValue>): boolean;
|
|
172
|
+
/** Extracts the compared-field values from a loaded row (null when row missing). */
|
|
173
|
+
protected extractFieldValues(fields: EntityFieldInfo[], row: Record<string, RecordFieldValue> | null): Record<string, RecordFieldValue>;
|
|
174
|
+
/** Produces a readable label: the name-field value when present, else the key string. */
|
|
175
|
+
protected buildRecordLabel(entity: EntityInfo, key: CompositeKey, row: Record<string, RecordFieldValue> | null): string;
|
|
176
|
+
/**
|
|
177
|
+
* Builds the per-field delta matrix from the loaded records. Column 0 is the
|
|
178
|
+
* reference (survivor candidate); every other cell is compared against it.
|
|
179
|
+
* Fields where every record's value is empty are dropped.
|
|
180
|
+
*/
|
|
181
|
+
protected buildFieldDeltas(fields: EntityFieldInfo[], records: RecordComparisonRecord[]): RecordComparisonFieldDelta[];
|
|
182
|
+
/** Builds the per-record cells for one field, flagging equality against column 0. */
|
|
183
|
+
protected buildFieldCells(field: EntityFieldInfo, records: RecordComparisonRecord[]): RecordComparisonFieldCell[];
|
|
184
|
+
/** True when every cell's value is null/empty (such a field carries no signal). */
|
|
185
|
+
protected allCellsEmpty(cells: RecordComparisonFieldCell[]): boolean;
|
|
186
|
+
/** Case-insensitive, trimmed equality used for both diff highlighting and PK matching. */
|
|
187
|
+
protected valuesEqual(a: RecordFieldValue, b: RecordFieldValue): boolean;
|
|
188
|
+
/** Coerces a loaded value into a comparable scalar; passes scalars through, else null. */
|
|
189
|
+
protected normalizeValue(value: RecordFieldValue | undefined): RecordFieldValue;
|
|
190
|
+
/** Builds a failed-shape result. */
|
|
191
|
+
protected errorResult(entityName: string, message: string): RecordComparisonResult;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=RecordComparisonEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordComparisonEngine.d.ts","sourceRoot":"","sources":["../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,gBAAgB,CAAC;IAQnC,yFAAyF;IACzF,SAAS,CAAC,gBAAgB,CACtB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,YAAY,EACjB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,IAAI,GAC7C,MAAM;IAWT;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CACtB,MAAM,EAAE,eAAe,EAAE,EACzB,OAAO,EAAE,sBAAsB,EAAE,GAClC,0BAA0B,EAAE;IAkB/B,qFAAqF;IACrF,SAAS,CAAC,eAAe,CACrB,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,sBAAsB,EAAE,GAClC,yBAAyB,EAAE;IAY9B,mFAAmF;IACnF,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,yBAAyB,EAAE,GAAG,OAAO;IAIpE,0FAA0F;IAC1F,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,GAAG,OAAO;IAUxE,0FAA0F;IAC1F,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,GAAG,gBAAgB;IAO/E,oCAAoC;IACpC,SAAS,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,sBAAsB;CASrF"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { LogError, Metadata, RunView } from '@memberjunction/core';
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic engine that loads a set of records for one entity and computes a
|
|
4
|
+
* structured field-level delta between them.
|
|
5
|
+
*
|
|
6
|
+
* This is the shared comparison primitive used by the LLM reasoning path (it feeds the
|
|
7
|
+
* "deltas" context to the reasoning provider) and, opportunistically, by the UI
|
|
8
|
+
* side-by-side comparison panel. It performs a read-only load (`RunView` with
|
|
9
|
+
* `ResultType: 'simple'` + targeted `Fields`) — it never mutates records.
|
|
10
|
+
*
|
|
11
|
+
* No Angular, no Router, no resolver coupling. Server-side: always thread `contextUser`
|
|
12
|
+
* and (in multi-provider scenarios) the request-scoped `provider`.
|
|
13
|
+
*/
|
|
14
|
+
export class RecordComparisonEngine {
|
|
15
|
+
/**
|
|
16
|
+
* Loads the requested records and computes the field-delta matrix.
|
|
17
|
+
*
|
|
18
|
+
* @param input the entity, keys, and optional field include-list to compare
|
|
19
|
+
* @param contextUser the server-side context user (REQUIRED for correct isolation)
|
|
20
|
+
* @param provider optional request-scoped metadata provider (multi-provider safety)
|
|
21
|
+
*/
|
|
22
|
+
async CompareRecords(input, contextUser, provider) {
|
|
23
|
+
const md = provider ?? Metadata.Provider;
|
|
24
|
+
const entity = md?.EntityByName(input.EntityName);
|
|
25
|
+
if (!entity) {
|
|
26
|
+
return this.errorResult(input.EntityName, `Entity '${input.EntityName}' not found in metadata`);
|
|
27
|
+
}
|
|
28
|
+
return this.CompareRecordsForEntity(entity, input.Keys, contextUser, {
|
|
29
|
+
IncludeFields: input.IncludeFields,
|
|
30
|
+
Provider: provider
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The lower-level comparison entry point: given an already-resolved {@link EntityInfo}
|
|
35
|
+
* (no by-name metadata lookup), load the keyed records and compute the field-delta matrix.
|
|
36
|
+
*
|
|
37
|
+
* Callers that already hold the entity and a request-scoped `RunView` (e.g. the duplicate
|
|
38
|
+
* detector) use this directly via {@link RecordComparisonOptions.RunViewInstance}, avoiding a
|
|
39
|
+
* redundant metadata resolution. The by-name {@link RecordComparisonEngine.CompareRecords}
|
|
40
|
+
* resolves the entity and delegates here.
|
|
41
|
+
*
|
|
42
|
+
* @param entity the resolved entity to compare records within
|
|
43
|
+
* @param keys the composite keys to compare (column 0 is the reference/survivor candidate)
|
|
44
|
+
* @param contextUser the server-side context user (thread for correct isolation)
|
|
45
|
+
* @param options include-list, an injected RunView, and/or the request-scoped provider
|
|
46
|
+
*/
|
|
47
|
+
async CompareRecordsForEntity(entity, keys, contextUser, options) {
|
|
48
|
+
try {
|
|
49
|
+
if (!keys || keys.length === 0) {
|
|
50
|
+
return this.errorResult(entity.Name, 'No keys supplied to compare');
|
|
51
|
+
}
|
|
52
|
+
const fields = this.selectFields(entity, options?.IncludeFields);
|
|
53
|
+
const rawRecords = await this.loadRecords(entity, keys, fields, contextUser, options);
|
|
54
|
+
if (rawRecords === null) {
|
|
55
|
+
return this.errorResult(entity.Name, 'Failed to load records for comparison');
|
|
56
|
+
}
|
|
57
|
+
const records = this.buildRecords(entity, keys, fields, rawRecords);
|
|
58
|
+
const deltas = this.buildFieldDeltas(fields, records);
|
|
59
|
+
return {
|
|
60
|
+
Success: true,
|
|
61
|
+
EntityName: entity.Name,
|
|
62
|
+
Records: records,
|
|
63
|
+
Fields: deltas
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
LogError(e);
|
|
68
|
+
return this.errorResult(entity.Name, e instanceof Error ? e.message : String(e));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolves the set of fields to compare: the include-list (case-insensitive) when
|
|
73
|
+
* supplied, otherwise all non-PK, non-system fields. Sorted name-field → DefaultInView → Sequence.
|
|
74
|
+
*/
|
|
75
|
+
selectFields(entity, includeFields) {
|
|
76
|
+
const includeSet = includeFields && includeFields.length > 0
|
|
77
|
+
? new Set(includeFields.map(f => f.trim().toLowerCase()))
|
|
78
|
+
: null;
|
|
79
|
+
const candidates = entity.Fields.filter(f => this.isComparableField(f, includeSet));
|
|
80
|
+
return candidates.sort((a, b) => this.compareFieldOrder(a, b));
|
|
81
|
+
}
|
|
82
|
+
/** True when a field should participate in the comparison. */
|
|
83
|
+
isComparableField(field, includeSet) {
|
|
84
|
+
if (includeSet) {
|
|
85
|
+
return includeSet.has(field.Name.toLowerCase());
|
|
86
|
+
}
|
|
87
|
+
if (field.IsPrimaryKey) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
return !this.isSystemField(field.Name);
|
|
91
|
+
}
|
|
92
|
+
/** True for MemberJunction system/internal columns that should not be diffed. */
|
|
93
|
+
isSystemField(fieldName) {
|
|
94
|
+
return fieldName.startsWith('__mj_');
|
|
95
|
+
}
|
|
96
|
+
/** Orders fields name-field first, then DefaultInView, then by Sequence/Name. */
|
|
97
|
+
compareFieldOrder(a, b) {
|
|
98
|
+
if (a.IsNameField !== b.IsNameField) {
|
|
99
|
+
return a.IsNameField ? -1 : 1;
|
|
100
|
+
}
|
|
101
|
+
if (a.DefaultInView !== b.DefaultInView) {
|
|
102
|
+
return a.DefaultInView ? -1 : 1;
|
|
103
|
+
}
|
|
104
|
+
const seqA = a.Sequence ?? 0;
|
|
105
|
+
const seqB = b.Sequence ?? 0;
|
|
106
|
+
if (seqA !== seqB) {
|
|
107
|
+
return seqA - seqB;
|
|
108
|
+
}
|
|
109
|
+
return a.Name.localeCompare(b.Name);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Loads the records via a single read-only RunView OR-ing every supplied key.
|
|
113
|
+
* Returns plain rows (ResultType 'simple') or null on failure.
|
|
114
|
+
*/
|
|
115
|
+
async loadRecords(entity, keys, fields, contextUser, options) {
|
|
116
|
+
const filter = this.buildKeysFilter(keys);
|
|
117
|
+
if (!filter) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
// Prefer a caller-supplied RunView (already bound to the request-scoped provider).
|
|
121
|
+
// Otherwise build one from the provider: concrete MJ providers implement both
|
|
122
|
+
// IMetadataProvider and IRunViewProvider, so the cast threads it into RunView for
|
|
123
|
+
// multi-provider safety.
|
|
124
|
+
const rv = options?.RunViewInstance ?? new RunView(options?.Provider ?? null);
|
|
125
|
+
const result = await rv.RunView({
|
|
126
|
+
EntityName: entity.Name,
|
|
127
|
+
ExtraFilter: filter,
|
|
128
|
+
Fields: this.buildSelectFieldNames(entity, fields),
|
|
129
|
+
ResultType: 'simple',
|
|
130
|
+
MaxRows: keys.length
|
|
131
|
+
}, contextUser);
|
|
132
|
+
if (!result.Success) {
|
|
133
|
+
LogError(`RecordComparisonEngine.loadRecords failed: ${result.ErrorMessage}`);
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return result.Results ?? [];
|
|
137
|
+
}
|
|
138
|
+
/** Builds the field-name select list: PK fields + the compared fields (deduped). */
|
|
139
|
+
buildSelectFieldNames(entity, fields) {
|
|
140
|
+
const names = new Set();
|
|
141
|
+
for (const pk of entity.PrimaryKeys) {
|
|
142
|
+
names.add(pk.Name);
|
|
143
|
+
}
|
|
144
|
+
for (const f of fields) {
|
|
145
|
+
names.add(f.Name);
|
|
146
|
+
}
|
|
147
|
+
return Array.from(names);
|
|
148
|
+
}
|
|
149
|
+
/** Builds an OR-ed WHERE clause across all keys, e.g. "(ID='a') OR (ID='b')". */
|
|
150
|
+
buildKeysFilter(keys) {
|
|
151
|
+
const clauses = keys
|
|
152
|
+
.filter(k => k.HasValue)
|
|
153
|
+
.map(k => `(${k.ToWhereClause()})`);
|
|
154
|
+
return clauses.length > 0 ? clauses.join(' OR ') : null;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Correlates each input key (by column index) with its loaded row and builds the
|
|
158
|
+
* per-record value maps. Missing rows yield a record with all-null values.
|
|
159
|
+
*/
|
|
160
|
+
buildRecords(entity, keys, fields, rawRecords) {
|
|
161
|
+
return keys.map((key, columnIndex) => {
|
|
162
|
+
const row = this.findRowForKey(entity, key, rawRecords);
|
|
163
|
+
const values = this.extractFieldValues(fields, row);
|
|
164
|
+
return {
|
|
165
|
+
ColumnIndex: columnIndex,
|
|
166
|
+
Key: key,
|
|
167
|
+
Label: this.buildRecordLabel(entity, key, row),
|
|
168
|
+
Values: values
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/** Finds the loaded row whose primary-key values match the supplied composite key. */
|
|
173
|
+
findRowForKey(entity, key, rawRecords) {
|
|
174
|
+
return rawRecords.find(row => this.rowMatchesKey(entity, key, row)) ?? null;
|
|
175
|
+
}
|
|
176
|
+
/** True when every PK value on the row equals the key's value (case-insensitive). */
|
|
177
|
+
rowMatchesKey(entity, key, row) {
|
|
178
|
+
return entity.PrimaryKeys.every(pk => {
|
|
179
|
+
const keyValue = key.GetValueByFieldName(pk.Name);
|
|
180
|
+
return this.valuesEqual(row[pk.Name], keyValue);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/** Extracts the compared-field values from a loaded row (null when row missing). */
|
|
184
|
+
extractFieldValues(fields, row) {
|
|
185
|
+
const values = {};
|
|
186
|
+
for (const f of fields) {
|
|
187
|
+
values[f.Name] = row ? this.normalizeValue(row[f.Name]) : null;
|
|
188
|
+
}
|
|
189
|
+
return values;
|
|
190
|
+
}
|
|
191
|
+
/** Produces a readable label: the name-field value when present, else the key string. */
|
|
192
|
+
buildRecordLabel(entity, key, row) {
|
|
193
|
+
const nameField = entity.Fields.find(f => f.IsNameField);
|
|
194
|
+
if (row && nameField) {
|
|
195
|
+
const v = row[nameField.Name];
|
|
196
|
+
if (v !== null && v !== undefined && String(v).trim().length > 0) {
|
|
197
|
+
return String(v);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return key.Values();
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Builds the per-field delta matrix from the loaded records. Column 0 is the
|
|
204
|
+
* reference (survivor candidate); every other cell is compared against it.
|
|
205
|
+
* Fields where every record's value is empty are dropped.
|
|
206
|
+
*/
|
|
207
|
+
buildFieldDeltas(fields, records) {
|
|
208
|
+
const deltas = [];
|
|
209
|
+
for (const field of fields) {
|
|
210
|
+
const cells = this.buildFieldCells(field, records);
|
|
211
|
+
if (this.allCellsEmpty(cells)) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
deltas.push({
|
|
215
|
+
FieldName: field.Name,
|
|
216
|
+
DisplayName: field.DisplayNameOrName,
|
|
217
|
+
Category: field.Category ?? null,
|
|
218
|
+
Cells: cells,
|
|
219
|
+
Differs: cells.some(c => !c.EqualsReference)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return deltas;
|
|
223
|
+
}
|
|
224
|
+
/** Builds the per-record cells for one field, flagging equality against column 0. */
|
|
225
|
+
buildFieldCells(field, records) {
|
|
226
|
+
const referenceValue = records.length > 0 ? records[0].Values[field.Name] ?? null : null;
|
|
227
|
+
return records.map(record => {
|
|
228
|
+
const value = record.Values[field.Name] ?? null;
|
|
229
|
+
return {
|
|
230
|
+
ColumnIndex: record.ColumnIndex,
|
|
231
|
+
Value: value,
|
|
232
|
+
EqualsReference: this.valuesEqual(value, referenceValue)
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/** True when every cell's value is null/empty (such a field carries no signal). */
|
|
237
|
+
allCellsEmpty(cells) {
|
|
238
|
+
return cells.every(c => c.Value === null || c.Value === '' || c.Value === undefined);
|
|
239
|
+
}
|
|
240
|
+
/** Case-insensitive, trimmed equality used for both diff highlighting and PK matching. */
|
|
241
|
+
valuesEqual(a, b) {
|
|
242
|
+
if (a === null || a === undefined) {
|
|
243
|
+
return b === null || b === undefined;
|
|
244
|
+
}
|
|
245
|
+
if (b === null || b === undefined) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
return String(a).trim().toLowerCase() === String(b).trim().toLowerCase();
|
|
249
|
+
}
|
|
250
|
+
/** Coerces a loaded value into a comparable scalar; passes scalars through, else null. */
|
|
251
|
+
normalizeValue(value) {
|
|
252
|
+
if (value === undefined) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
return value;
|
|
256
|
+
}
|
|
257
|
+
/** Builds a failed-shape result. */
|
|
258
|
+
errorResult(entityName, message) {
|
|
259
|
+
return {
|
|
260
|
+
Success: false,
|
|
261
|
+
ErrorMessage: message,
|
|
262
|
+
EntityName: entityName,
|
|
263
|
+
Records: [],
|
|
264
|
+
Fields: []
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=RecordComparisonEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordComparisonEngine.js","sourceRoot":"","sources":["../src/RecordComparisonEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EACR,QAAQ,EACR,OAAO,EAOV,MAAM,sBAAsB,CAAC;AAkH9B;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,sBAAsB;IAC/B;;;;;;OAMG;IACI,KAAK,CAAC,cAAc,CACvB,KAA4B,EAC5B,WAAqB,EACrB,QAA4B;QAE5B,MAAM,EAAE,GAAG,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;QACzC,MAAM,MAAM,GAAG,EAAE,EAAE,YAAY,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,UAAU,EAAE,WAAW,KAAK,CAAC,UAAU,yBAAyB,CAAC,CAAC;QACpG,CAAC;QACD,OAAO,IAAI,CAAC,uBAAuB,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE;YACjE,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,QAAQ,EAAE,QAAQ;SACrB,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,KAAK,CAAC,uBAAuB,CAChC,MAAkB,EAClB,IAAoB,EACpB,WAAsB,EACtB,OAAiC;QAEjC,IAAI,CAAC;YACD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,6BAA6B,CAAC,CAAC;YACxE,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;YACjE,MAAM,UAAU,GAAG,MAAM,IAA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zC,cAAc,+CAA+C,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+CAA+C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
2
|
+
import { RecordComparisonCompareOperation, type RecordComparisonCompareInput, type RecordComparisonCompareOutput } from '@memberjunction/core-entities';
|
|
3
|
+
export declare class RecordComparisonCompareServerOperation extends RecordComparisonCompareOperation {
|
|
4
|
+
protected InternalExecute(input: RecordComparisonCompareInput, provider: IMetadataProvider, user: UserInfo): Promise<RecordComparisonCompareOutput>;
|
|
5
|
+
/** Builds a {@link CompositeKey} from a wire-form comparison key. */
|
|
6
|
+
private toCompositeKey;
|
|
7
|
+
}
|
|
8
|
+
/** Tree-shaking anchor — referenced so bundlers retain the `@RegisterClass` registration. */
|
|
9
|
+
export declare function LoadRecordComparisonCompareOperation(): void;
|
|
10
|
+
//# sourceMappingURL=RecordComparisonCompareOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecordComparisonCompareOperation.d.ts","sourceRoot":"","sources":["../../src/operations/RecordComparisonCompareOperation.ts"],"names":[],"mappings":"AAaA,OAAO,EAAwC,iBAAiB,EAAgB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACvH,OAAO,EACH,gCAAgC,EAChC,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAErC,MAAM,+BAA+B,CAAC;AAGvC,qBACa,sCAAuC,SAAQ,gCAAgC;cACxE,eAAe,CAC3B,KAAK,EAAE,4BAA4B,EACnC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,GACf,OAAO,CAAC,6BAA6B,CAAC;IAwBzC,qEAAqE;IACrE,OAAO,CAAC,cAAc;CASzB;AAED,6FAA6F;AAC7F,wBAAgB,oCAAoC,IAAI,IAAI,CAE3D"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* @fileoverview Server implementation of the `RecordComparison.Compare` Remote Operation — loads a
|
|
9
|
+
* set of an entity's records by composite key and computes the field-level delta matrix between them.
|
|
10
|
+
*
|
|
11
|
+
* Extends the CodeGen-emitted {@link RecordComparisonCompareOperation} base in
|
|
12
|
+
* `@memberjunction/core-entities` (`generated/remote_operations.ts` — operation key + typed I/O, from
|
|
13
|
+
* the `MJ: Remote Operations` row) and supplies the server body via {@link RecordComparisonEngine}.
|
|
14
|
+
* Registered under `RecordComparison.Compare`; replaces the bespoke `GetRecordComparison` GraphQL
|
|
15
|
+
* resolver + the hand-written `GraphQLRecordComparisonClient` transport.
|
|
16
|
+
*
|
|
17
|
+
* @module @memberjunction/record-comparison
|
|
18
|
+
*/
|
|
19
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
20
|
+
import { BaseRemotableOperation, CompositeKey, KeyValuePair } from '@memberjunction/core';
|
|
21
|
+
import { RecordComparisonCompareOperation, } from '@memberjunction/core-entities';
|
|
22
|
+
import { RecordComparisonEngine } from '../RecordComparisonEngine.js';
|
|
23
|
+
let RecordComparisonCompareServerOperation = class RecordComparisonCompareServerOperation extends RecordComparisonCompareOperation {
|
|
24
|
+
async InternalExecute(input, provider, user) {
|
|
25
|
+
if (!input?.EntityName) {
|
|
26
|
+
throw new Error('EntityName is required');
|
|
27
|
+
}
|
|
28
|
+
const engineInput = {
|
|
29
|
+
EntityName: input.EntityName,
|
|
30
|
+
Keys: (input.Keys ?? []).map((k) => this.toCompositeKey(k)),
|
|
31
|
+
IncludeFields: input.IncludeFields,
|
|
32
|
+
};
|
|
33
|
+
const result = await new RecordComparisonEngine().CompareRecords(engineInput, user, provider);
|
|
34
|
+
if (!result.Success) {
|
|
35
|
+
// Surface as a logical failure on the wrapping RemoteOpResult.
|
|
36
|
+
throw new Error(result.ErrorMessage ?? 'Record comparison failed');
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
EntityName: result.EntityName,
|
|
40
|
+
Records: result.Records ?? [],
|
|
41
|
+
Fields: result.Fields ?? [],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Builds a {@link CompositeKey} from a wire-form comparison key. */
|
|
45
|
+
toCompositeKey(key) {
|
|
46
|
+
const pairs = (key.KeyValuePairs ?? []).map((kvp) => {
|
|
47
|
+
const pair = new KeyValuePair();
|
|
48
|
+
pair.FieldName = kvp.FieldName;
|
|
49
|
+
pair.Value = kvp.Value;
|
|
50
|
+
return pair;
|
|
51
|
+
});
|
|
52
|
+
return CompositeKey.FromKeyValuePairs(pairs);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
RecordComparisonCompareServerOperation = __decorate([
|
|
56
|
+
RegisterClass(BaseRemotableOperation, 'RecordComparison.Compare')
|
|
57
|
+
], RecordComparisonCompareServerOperation);
|
|
58
|
+
export { RecordComparisonCompareServerOperation };
|
|
59
|
+
/** Tree-shaking anchor — referenced so bundlers retain the `@RegisterClass` registration. */
|
|
60
|
+
export function LoadRecordComparisonCompareOperation() {
|
|
61
|
+
// intentionally empty
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=RecordComparisonCompareOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"R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M,IAAI,EAAE;SAC9B,CAAC;IACN,CAAC;IAED,qEAAqE;IAC7D,cAAc,CAAC,GAAwB;QAC3C,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAChD,MAAM,IAAI,GAAG,IAAI,YAAY,EAAE,CAAC;YAChC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;YAC/B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;YACvB,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,OAAO,YAAY,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACJ,CAAA;AAvCY,sCAAsC;IADlD,aAAa,CAAC,sBAAsB,EAAE,0BAA0B,CAAC;GACrD,sCAAsC,CAuClD;;AAED,6FAA6F;AAC7F,MAAM,UAAU,oCAAoC;IAChD,sBAAsB;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/record-comparison",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "5.44.0",
|
|
5
|
+
"description": "MemberJunction: Framework-agnostic record comparison engine — loads a set of records for one entity and computes a structured field-level delta. Shared by the duplicate-detection reasoning path and the UI side-by-side comparison panel.",
|
|
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
|
+
"author": "MemberJunction.com",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@memberjunction/core": "5.44.0",
|
|
20
|
+
"@memberjunction/core-entities": "5.44.0",
|
|
21
|
+
"@memberjunction/global": "5.44.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "24.10.11",
|
|
25
|
+
"typescript": "^5.9.3"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/MemberJunction/MJ"
|
|
30
|
+
}
|
|
10
31
|
}
|