@memberjunction/version-history 6.1.4 → 6.2.0-edge.1

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.
@@ -1,6 +1,6 @@
1
1
  import { CompositeKey, Metadata, RunView, LogError, LogStatus } from '@memberjunction/core';
2
2
  import { UUIDsEqual } from '@memberjunction/global';
3
- import { buildCompositeKeyFromRecord, escapeSqlString } from './constants.js';
3
+ import { BuildCompositeKeyFromRecord, escapeSqlString } from './constants.js';
4
4
  // =============================================================================
5
5
  // System FK Skip Patterns
6
6
  // =============================================================================
@@ -390,7 +390,7 @@ export class DependencyGraphWalker {
390
390
  * and attach it as a child of the parent. Returns null if already visited.
391
391
  */
392
392
  registerNode(entityInfo, recordData, relationship, parentNode, visited, stats) {
393
- const key = buildCompositeKeyFromRecord(entityInfo, recordData);
393
+ const key = BuildCompositeKeyFromRecord(entityInfo, recordData);
394
394
  const vKey = this.visitKey(entityInfo.Name, key.ToConcatenatedString());
395
395
  if (visited.has(vKey)) {
396
396
  stats.VisitedSkips++;
@@ -1,6 +1,6 @@
1
1
  import { Metadata, RunView, LogError, } from '@memberjunction/core';
2
2
  import { UUIDsEqual } from '@memberjunction/global';
3
- import { ENTITY_VERSION_LABEL_ITEMS, ENTITY_VERSION_LABELS, ENTITY_RECORD_CHANGES, sqlEquals, loadRecordChangeSnapshot, loadEntityById, } from './constants.js';
3
+ import { ENTITY_VERSION_LABEL_ITEMS, ENTITY_VERSION_LABELS, ENTITY_RECORD_CHANGES, SqlEquals, LoadRecordChangeSnapshot, LoadEntityById, } from './constants.js';
4
4
  /**
5
5
  * Compares state between two version labels, or between a label and the
6
6
  * current live state, producing a structured diff grouped by entity.
@@ -16,7 +16,7 @@ export class DiffEngine {
16
16
  async DiffLabels(fromLabelId, toLabelId, contextUser) {
17
17
  // Short-circuit: identical labels produce an empty diff
18
18
  if (UUIDsEqual(fromLabelId, toLabelId)) {
19
- const label = await loadEntityById(ENTITY_VERSION_LABELS, fromLabelId, contextUser);
19
+ const label = await LoadEntityById(ENTITY_VERSION_LABELS, fromLabelId, contextUser);
20
20
  const labelName = label ? label.Name : fromLabelId;
21
21
  return {
22
22
  FromLabelID: fromLabelId,
@@ -28,8 +28,8 @@ export class DiffEngine {
28
28
  };
29
29
  }
30
30
  const [fromLabel, toLabel] = await Promise.all([
31
- loadEntityById(ENTITY_VERSION_LABELS, fromLabelId, contextUser),
32
- loadEntityById(ENTITY_VERSION_LABELS, toLabelId, contextUser),
31
+ LoadEntityById(ENTITY_VERSION_LABELS, fromLabelId, contextUser),
32
+ LoadEntityById(ENTITY_VERSION_LABELS, toLabelId, contextUser),
33
33
  ]);
34
34
  if (!fromLabel)
35
35
  throw new Error(`Version label '${fromLabelId}' not found`);
@@ -59,7 +59,7 @@ export class DiffEngine {
59
59
  * existing are reported as Deleted.
60
60
  */
61
61
  async DiffLabelToCurrentState(labelId, contextUser) {
62
- const label = await loadEntityById(ENTITY_VERSION_LABELS, labelId, contextUser);
62
+ const label = await LoadEntityById(ENTITY_VERSION_LABELS, labelId, contextUser);
63
63
  if (!label)
64
64
  throw new Error(`Version label '${labelId}' not found`);
65
65
  const fromIndex = await this.buildSnapshotIndex(labelId, contextUser);
@@ -87,9 +87,9 @@ export class DiffEngine {
87
87
  return null;
88
88
  const rv = new RunView();
89
89
  const filter = [
90
- sqlEquals('VersionLabelID', labelId),
91
- sqlEquals('EntityID', entityInfo.ID),
92
- sqlEquals('RecordID', recordId),
90
+ SqlEquals('VersionLabelID', labelId),
91
+ SqlEquals('EntityID', entityInfo.ID),
92
+ SqlEquals('RecordID', recordId),
93
93
  ].join(' AND ');
94
94
  const result = await rv.RunView({
95
95
  EntityName: ENTITY_VERSION_LABEL_ITEMS,
@@ -113,7 +113,7 @@ export class DiffEngine {
113
113
  const rv = new RunView();
114
114
  const result = await rv.RunView({
115
115
  EntityName: ENTITY_VERSION_LABEL_ITEMS,
116
- ExtraFilter: sqlEquals('VersionLabelID', labelId),
116
+ ExtraFilter: SqlEquals('VersionLabelID', labelId),
117
117
  Fields: ['ID', 'RecordChangeID', 'EntityID', 'RecordID'],
118
118
  ResultType: 'simple',
119
119
  }, contextUser);
@@ -165,8 +165,8 @@ export class DiffEngine {
165
165
  */
166
166
  async findLatestRecordChange(rv, entityId, recordId, contextUser) {
167
167
  const filter = [
168
- sqlEquals('EntityID', entityId),
169
- sqlEquals('RecordID', recordId),
168
+ SqlEquals('EntityID', entityId),
169
+ SqlEquals('RecordID', recordId),
170
170
  ].join(' AND ');
171
171
  const result = await rv.RunView({
172
172
  EntityName: ENTITY_RECORD_CHANGES,
@@ -257,7 +257,7 @@ export class DiffEngine {
257
257
  * Build a diff result for a record that was added.
258
258
  */
259
259
  async buildAddedDiff(entityName, recordId, toChangeId, contextUser) {
260
- const toSnapshot = await loadRecordChangeSnapshot(toChangeId, contextUser);
260
+ const toSnapshot = await LoadRecordChangeSnapshot(toChangeId, contextUser);
261
261
  return {
262
262
  RecordID: recordId,
263
263
  EntityName: entityName,
@@ -271,7 +271,7 @@ export class DiffEngine {
271
271
  * Build a diff result for a record that was deleted.
272
272
  */
273
273
  async buildDeletedDiff(entityName, recordId, fromChangeId, contextUser) {
274
- const fromSnapshot = await loadRecordChangeSnapshot(fromChangeId, contextUser);
274
+ const fromSnapshot = await LoadRecordChangeSnapshot(fromChangeId, contextUser);
275
275
  return {
276
276
  RecordID: recordId,
277
277
  EntityName: entityName,
@@ -299,8 +299,8 @@ export class DiffEngine {
299
299
  */
300
300
  async buildModifiedDiff(entityName, recordId, fromChangeId, toChangeId, contextUser) {
301
301
  const [fromSnapshot, toSnapshot] = await Promise.all([
302
- loadRecordChangeSnapshot(fromChangeId, contextUser),
303
- loadRecordChangeSnapshot(toChangeId, contextUser),
302
+ LoadRecordChangeSnapshot(fromChangeId, contextUser),
303
+ LoadRecordChangeSnapshot(toChangeId, contextUser),
304
304
  ]);
305
305
  const fieldChanges = this.compareSnapshots(fromSnapshot, toSnapshot);
306
306
  const diffType = fieldChanges.length > 0 ? 'Modified' : 'Unchanged';
@@ -321,7 +321,7 @@ export class DiffEngine {
321
321
  const rv = new RunView();
322
322
  const result = await rv.RunView({
323
323
  EntityName: ENTITY_RECORD_CHANGES,
324
- ExtraFilter: sqlEquals('ID', recordChangeId),
324
+ ExtraFilter: SqlEquals('ID', recordChangeId),
325
325
  Fields: ['ID', 'ChangedAt'],
326
326
  MaxRows: 1,
327
327
  ResultType: 'simple',
@@ -329,7 +329,7 @@ export class DiffEngine {
329
329
  if (!result.Success || result.Results.length === 0)
330
330
  return null;
331
331
  const changedAt = result.Results[0].ChangedAt;
332
- const parsed = await loadRecordChangeSnapshot(recordChangeId, contextUser);
332
+ const parsed = await LoadRecordChangeSnapshot(recordChangeId, contextUser);
333
333
  if (!parsed)
334
334
  return null;
335
335
  return {
@@ -1,5 +1,5 @@
1
1
  import { Metadata, RunView, LogError, LogStatus } from '@memberjunction/core';
2
- import { ENTITY_VERSION_LABELS, sqlEquals, sqlContains, loadEntityById, } from './constants.js';
2
+ import { ENTITY_VERSION_LABELS, SqlEquals, SqlContains, LoadEntityById, } from './constants.js';
3
3
  /**
4
4
  * Manages the lifecycle of version labels: creation, querying, archiving,
5
5
  * and status updates. Does NOT handle snapshot capture — that is delegated
@@ -38,7 +38,7 @@ export class LabelManager {
38
38
  * Load a single version label by ID.
39
39
  */
40
40
  async GetLabel(labelId, contextUser) {
41
- const label = await loadEntityById(ENTITY_VERSION_LABELS, labelId, contextUser);
41
+ const label = await LoadEntityById(ENTITY_VERSION_LABELS, labelId, contextUser);
42
42
  if (!label) {
43
43
  throw new Error(`Version label '${labelId}' not found`);
44
44
  }
@@ -127,26 +127,26 @@ export class LabelManager {
127
127
  buildFilterClauses(filter) {
128
128
  const clauses = [];
129
129
  if (filter.Scope) {
130
- clauses.push(sqlEquals('Scope', filter.Scope));
130
+ clauses.push(SqlEquals('Scope', filter.Scope));
131
131
  }
132
132
  if (filter.Status) {
133
- clauses.push(sqlEquals('Status', filter.Status));
133
+ clauses.push(SqlEquals('Status', filter.Status));
134
134
  }
135
135
  if (filter.EntityName) {
136
136
  const md = this.ProviderToUse;
137
137
  const entityInfo = md.EntityByName(filter.EntityName);
138
138
  if (entityInfo) {
139
- clauses.push(sqlEquals('EntityID', entityInfo.ID));
139
+ clauses.push(SqlEquals('EntityID', entityInfo.ID));
140
140
  }
141
141
  }
142
142
  if (filter.RecordID) {
143
- clauses.push(sqlEquals('RecordID', filter.RecordID));
143
+ clauses.push(SqlEquals('RecordID', filter.RecordID));
144
144
  }
145
145
  if (filter.CreatedByUserID) {
146
- clauses.push(sqlEquals('CreatedByUserID', filter.CreatedByUserID));
146
+ clauses.push(SqlEquals('CreatedByUserID', filter.CreatedByUserID));
147
147
  }
148
148
  if (filter.NameContains) {
149
- clauses.push(sqlContains('Name', filter.NameContains));
149
+ clauses.push(SqlContains('Name', filter.NameContains));
150
150
  }
151
151
  return clauses;
152
152
  }
@@ -11,8 +11,8 @@ import { RestoreOptions, RestoreResult } from './types.js';
11
11
  * - Supports dry-run mode for previewing changes without applying them
12
12
  */
13
13
  export declare class RestoreEngine {
14
- private LabelMgr;
15
- private SnapshotBldr;
14
+ private labelMgr;
15
+ private snapshotBldr;
16
16
  /** Optional provider override; falls back to Metadata.Provider when not set. */
17
17
  private _provider?;
18
18
  /** Returns the active provider — explicit override if set, otherwise the global default. */
@@ -2,7 +2,7 @@ import { CompositeKey, Metadata, RunView, LogError, LogStatus, } from '@memberju
2
2
  import { UUIDsEqual } from '@memberjunction/global';
3
3
  import { LabelManager } from './LabelManager.js';
4
4
  import { SnapshotBuilder } from './SnapshotBuilder.js';
5
- import { ENTITY_VERSION_LABEL_ITEMS, ENTITY_VERSION_LABEL_RESTORES, ENTITY_VERSION_LABELS, sqlEquals, sqlNotIn, loadRecordChangeSnapshot, loadEntityById, buildPrimaryKeyForLoad, } from './constants.js';
5
+ import { ENTITY_VERSION_LABEL_ITEMS, ENTITY_VERSION_LABEL_RESTORES, ENTITY_VERSION_LABELS, SqlEquals, SqlNotIn, LoadRecordChangeSnapshot, LoadEntityById, BuildPrimaryKeyForLoad, } from './constants.js';
6
6
  /** Batch size for progress update writes — only persist every N items. */
7
7
  const PROGRESS_UPDATE_INTERVAL = 10;
8
8
  /**
@@ -17,8 +17,8 @@ const PROGRESS_UPDATE_INTERVAL = 10;
17
17
  */
18
18
  export class RestoreEngine {
19
19
  constructor() {
20
- this.LabelMgr = new LabelManager();
21
- this.SnapshotBldr = new SnapshotBuilder();
20
+ this.labelMgr = new LabelManager();
21
+ this.snapshotBldr = new SnapshotBuilder();
22
22
  }
23
23
  /** Returns the active provider — explicit override if set, otherwise the global default. */
24
24
  get ProviderToUse() {
@@ -32,7 +32,7 @@ export class RestoreEngine {
32
32
  this._provider = provider;
33
33
  const resolvedOptions = this.resolveDefaults(options);
34
34
  // Load the target label
35
- const label = await loadEntityById(ENTITY_VERSION_LABELS, labelId, contextUser);
35
+ const label = await LoadEntityById(ENTITY_VERSION_LABELS, labelId, contextUser);
36
36
  if (!label)
37
37
  throw new Error(`Version label '${labelId}' not found`);
38
38
  const labelName = label.Name;
@@ -64,7 +64,7 @@ export class RestoreEngine {
64
64
  }
65
65
  // Mark the label as restored
66
66
  if (!resolvedOptions.DryRun && finalStatus !== 'Error') {
67
- await this.LabelMgr.MarkLabelRestored(labelId, contextUser);
67
+ await this.labelMgr.MarkLabelRestored(labelId, contextUser);
68
68
  }
69
69
  LogStatus(`VersionHistory: Restore complete. ${restoredCount} restored, ${failedCount} failed, ${skippedCount} skipped.`);
70
70
  return {
@@ -117,7 +117,7 @@ export class RestoreEngine {
117
117
  */
118
118
  async loadLabelItems(labelId, options, contextUser) {
119
119
  const rv = new RunView();
120
- let extraFilter = sqlEquals('VersionLabelID', labelId);
120
+ let extraFilter = SqlEquals('VersionLabelID', labelId);
121
121
  // Apply entity exclusion
122
122
  if (options.SkipEntities && options.SkipEntities.length > 0) {
123
123
  const md = this.ProviderToUse;
@@ -125,7 +125,7 @@ export class RestoreEngine {
125
125
  .map(name => md.EntityByName(name)?.ID)
126
126
  .filter((id) => id != null);
127
127
  if (excludeIds.length > 0) {
128
- extraFilter += ` AND ${sqlNotIn('EntityID', excludeIds)}`;
128
+ extraFilter += ` AND ${SqlNotIn('EntityID', excludeIds)}`;
129
129
  }
130
130
  }
131
131
  const result = await rv.RunView({
@@ -209,7 +209,7 @@ export class RestoreEngine {
209
209
  return this.failedItemResult(`Unknown(${item.EntityID})`, item.RecordID, `Entity with ID '${item.EntityID}' not found in metadata`);
210
210
  }
211
211
  try {
212
- const snapshotData = await loadRecordChangeSnapshot(item.RecordChangeID, contextUser);
212
+ const snapshotData = await LoadRecordChangeSnapshot(item.RecordChangeID, contextUser);
213
213
  if (!snapshotData) {
214
214
  return this.failedItemResult(entityInfo.Name, item.RecordID, 'Could not load snapshot from RecordChange');
215
215
  }
@@ -263,7 +263,7 @@ export class RestoreEngine {
263
263
  const entity = await md.GetEntityObject(entityInfo.Name, contextUser);
264
264
  // Try to load existing record using the entity's actual primary key
265
265
  try {
266
- const key = buildPrimaryKeyForLoad(entityInfo, recordId);
266
+ const key = BuildPrimaryKeyForLoad(entityInfo, recordId);
267
267
  const loaded = await entity.InnerLoad(key);
268
268
  if (loaded)
269
269
  return entity;
@@ -314,7 +314,7 @@ export class RestoreEngine {
314
314
  * records that will be affected by the restore.
315
315
  */
316
316
  async createPreRestoreLabel(targetLabelName, targetLabelScope, items, contextUser) {
317
- const label = await this.LabelMgr.CreateLabel({
317
+ const label = await this.labelMgr.CreateLabel({
318
318
  Name: `Pre-Restore: ${targetLabelName} (${new Date().toISOString()})`,
319
319
  Description: `Automatic safety snapshot created before restoring to label '${targetLabelName}'`,
320
320
  Scope: targetLabelScope,
@@ -330,7 +330,7 @@ export class RestoreEngine {
330
330
  // ToConcatenatedString). Parse it — wrapping it as the first PK's value would have made
331
331
  // the key `ID='ID|abc'`, and a composite key can't be a single value at all.
332
332
  const key = CompositeKey.FromURLSegment(entityInfo, item.RecordID);
333
- await this.SnapshotBldr.CaptureRecord(preRestoreLabelId, entityInfo.Name, key, false, // Don't walk dependencies — we already have the full item list
333
+ await this.snapshotBldr.CaptureRecord(preRestoreLabelId, entityInfo.Name, key, false, // Don't walk dependencies — we already have the full item list
334
334
  {}, contextUser);
335
335
  }
336
336
  LogStatus(`VersionHistory: Created pre-restore safety label (${preRestoreLabelId})`);
@@ -362,7 +362,7 @@ export class RestoreEngine {
362
362
  */
363
363
  async updateRestoreProgress(restoreId, completedItems, failedItems, contextUser) {
364
364
  try {
365
- const restore = await loadEntityById(ENTITY_VERSION_LABEL_RESTORES, restoreId, contextUser);
365
+ const restore = await LoadEntityById(ENTITY_VERSION_LABEL_RESTORES, restoreId, contextUser);
366
366
  if (!restore)
367
367
  return;
368
368
  restore.CompletedItems = completedItems;
@@ -380,7 +380,7 @@ export class RestoreEngine {
380
380
  */
381
381
  async finalizeRestoreAudit(restoreId, status, failedCount, details, contextUser) {
382
382
  try {
383
- const restore = await loadEntityById(ENTITY_VERSION_LABEL_RESTORES, restoreId, contextUser);
383
+ const restore = await LoadEntityById(ENTITY_VERSION_LABEL_RESTORES, restoreId, contextUser);
384
384
  if (!restore)
385
385
  return;
386
386
  restore.Status = status;
@@ -17,7 +17,7 @@ import { CaptureResult, CreateLabelProgressCallback, WalkOptions } from './types
17
17
  * a handful of batched queries (one per unique entity type).
18
18
  */
19
19
  export declare class SnapshotBuilder {
20
- private Walker;
20
+ private walker;
21
21
  /** Optional provider override; falls back to Metadata.Provider when not set. */
22
22
  private _provider?;
23
23
  /** Returns the active provider — explicit override if set, otherwise the global default. */
@@ -1,6 +1,6 @@
1
1
  import { Metadata, RunView, LogError, LogStatus, } from '@memberjunction/core';
2
2
  import { DependencyGraphWalker } from './DependencyGraphWalker.js';
3
- import { ENTITY_VERSION_LABEL_ITEMS, ENTITY_RECORD_CHANGES, buildCompositeKeyFromRecord, sqlEquals, escapeSqlString, } from './constants.js';
3
+ import { ENTITY_VERSION_LABEL_ITEMS, ENTITY_RECORD_CHANGES, BuildCompositeKeyFromRecord, SqlEquals, escapeSqlString, } from './constants.js';
4
4
  // =============================================================================
5
5
  // SnapshotBuilder
6
6
  // =============================================================================
@@ -22,7 +22,7 @@ import { ENTITY_VERSION_LABEL_ITEMS, ENTITY_RECORD_CHANGES, buildCompositeKeyFro
22
22
  */
23
23
  export class SnapshotBuilder {
24
24
  constructor() {
25
- this.Walker = new DependencyGraphWalker();
25
+ this.walker = new DependencyGraphWalker();
26
26
  }
27
27
  /** Returns the active provider — explicit override if set, otherwise the global default. */
28
28
  get ProviderToUse() {
@@ -62,7 +62,7 @@ export class SnapshotBuilder {
62
62
  let itemsCaptured = 0;
63
63
  let syntheticCount = 0;
64
64
  for (const record of result.Results) {
65
- const key = buildCompositeKeyFromRecord(entityInfo, record);
65
+ const key = BuildCompositeKeyFromRecord(entityInfo, record);
66
66
  const captureItemResult = await this.captureSingleRecord(labelId, entityName, key, contextUser, record);
67
67
  if (captureItemResult.Success) {
68
68
  itemsCaptured++;
@@ -130,8 +130,8 @@ export class SnapshotBuilder {
130
130
  Message: `Walking dependency graph for ${entityName}...`,
131
131
  Percentage: 10,
132
132
  });
133
- const root = await this.Walker.WalkDependents(entityName, recordKey, walkOptions, contextUser);
134
- const flatNodes = this.Walker.FlattenTopological(root);
133
+ const root = await this.walker.WalkDependents(entityName, recordKey, walkOptions, contextUser);
134
+ const flatNodes = this.walker.FlattenTopological(root);
135
135
  // Step 2: Batch-lookup RecordChanges for all nodes
136
136
  this.emitProgress(onProgress, {
137
137
  Step: 'capturing_snapshots',
@@ -274,7 +274,7 @@ export class SnapshotBuilder {
274
274
  async lookupChangesChunk(entityId, recordIds, contextUser) {
275
275
  const results = new Map();
276
276
  const escapedIds = recordIds.map(id => `'${escapeSqlString(id)}'`).join(', ');
277
- const filter = `${sqlEquals('EntityID', entityId)} AND RecordID IN (${escapedIds})`;
277
+ const filter = `${SqlEquals('EntityID', entityId)} AND RecordID IN (${escapedIds})`;
278
278
  try {
279
279
  const rv = new RunView();
280
280
  const result = await rv.RunView({
@@ -414,7 +414,7 @@ export class SnapshotBuilder {
414
414
  */
415
415
  async findLatestRecordChange(entityId, recordId, contextUser) {
416
416
  const rv = new RunView();
417
- const filter = `${sqlEquals('EntityID', entityId)} AND ${sqlEquals('RecordID', recordId)}`;
417
+ const filter = `${SqlEquals('EntityID', entityId)} AND ${SqlEquals('RecordID', recordId)}`;
418
418
  const result = await rv.RunView({
419
419
  EntityName: ENTITY_RECORD_CHANGES,
420
420
  ExtraFilter: filter,
@@ -39,11 +39,11 @@ import { CaptureResult, CreateLabelParams, DependencyNode, DiffResult, LabelFilt
39
39
  * ```
40
40
  */
41
41
  export declare class VersionHistoryEngine {
42
- private LabelMgr;
43
- private SnapshotBldr;
44
- private GraphWalker;
45
- private Differ;
46
- private Restorer;
42
+ private labelMgr;
43
+ private snapshotBldr;
44
+ private graphWalker;
45
+ private differ;
46
+ private restorer;
47
47
  /**
48
48
  * Create a new version label and capture the appropriate snapshot based
49
49
  * on the label's scope.
@@ -43,11 +43,11 @@ import { RestoreEngine } from './RestoreEngine.js';
43
43
  */
44
44
  export class VersionHistoryEngine {
45
45
  constructor() {
46
- this.LabelMgr = new LabelManager();
47
- this.SnapshotBldr = new SnapshotBuilder();
48
- this.GraphWalker = new DependencyGraphWalker();
49
- this.Differ = new DiffEngine();
50
- this.Restorer = new RestoreEngine();
46
+ this.labelMgr = new LabelManager();
47
+ this.snapshotBldr = new SnapshotBuilder();
48
+ this.graphWalker = new DependencyGraphWalker();
49
+ this.differ = new DiffEngine();
50
+ this.restorer = new RestoreEngine();
51
51
  }
52
52
  // =======================================================================
53
53
  // Label operations
@@ -69,7 +69,7 @@ export class VersionHistoryEngine {
69
69
  Percentage: 5,
70
70
  });
71
71
  // Create the label record
72
- const label = await this.LabelMgr.CreateLabel(params, contextUser);
72
+ const label = await this.labelMgr.CreateLabel(params, contextUser);
73
73
  const labelId = label.ID;
74
74
  const scope = params.Scope ?? 'Record';
75
75
  // Track creation timing
@@ -84,15 +84,15 @@ export class VersionHistoryEngine {
84
84
  MaxDepth: params.MaxDepth ?? 10,
85
85
  ExcludeEntities: params.ExcludeEntities ?? [],
86
86
  };
87
- captureResult = await this.SnapshotBldr.CaptureRecord(labelId, params.EntityName, params.RecordKey, params.IncludeDependencies ?? true, walkOptions, contextUser, onProgress);
87
+ captureResult = await this.snapshotBldr.CaptureRecord(labelId, params.EntityName, params.RecordKey, params.IncludeDependencies ?? true, walkOptions, contextUser, onProgress);
88
88
  break;
89
89
  }
90
90
  case 'Entity': {
91
- captureResult = await this.SnapshotBldr.CaptureEntity(labelId, params.EntityName, contextUser);
91
+ captureResult = await this.snapshotBldr.CaptureEntity(labelId, params.EntityName, contextUser);
92
92
  break;
93
93
  }
94
94
  case 'System': {
95
- captureResult = await this.SnapshotBldr.CaptureSystem(labelId, contextUser);
95
+ captureResult = await this.snapshotBldr.CaptureSystem(labelId, contextUser);
96
96
  break;
97
97
  }
98
98
  default:
@@ -135,19 +135,19 @@ export class VersionHistoryEngine {
135
135
  * Archive a label, marking it as no longer active.
136
136
  */
137
137
  async ArchiveLabel(labelId, contextUser) {
138
- return this.LabelMgr.ArchiveLabel(labelId, contextUser);
138
+ return this.labelMgr.ArchiveLabel(labelId, contextUser);
139
139
  }
140
140
  /**
141
141
  * Load a single version label by ID.
142
142
  */
143
143
  async GetLabel(labelId, contextUser) {
144
- return this.LabelMgr.GetLabel(labelId, contextUser);
144
+ return this.labelMgr.GetLabel(labelId, contextUser);
145
145
  }
146
146
  /**
147
147
  * Query version labels with optional filters.
148
148
  */
149
149
  async GetLabels(filter, contextUser) {
150
- return this.LabelMgr.GetLabels(filter, contextUser);
150
+ return this.labelMgr.GetLabels(filter, contextUser);
151
151
  }
152
152
  // =======================================================================
153
153
  // Diff operations
@@ -157,20 +157,20 @@ export class VersionHistoryEngine {
157
157
  * Returns a structured diff grouped by entity with field-level changes.
158
158
  */
159
159
  async DiffLabels(fromLabelId, toLabelId, contextUser) {
160
- return this.Differ.DiffLabels(fromLabelId, toLabelId, contextUser);
160
+ return this.differ.DiffLabels(fromLabelId, toLabelId, contextUser);
161
161
  }
162
162
  /**
163
163
  * Compare a version label's state to the current live state.
164
164
  * Useful for seeing "what has changed since this label was created?"
165
165
  */
166
166
  async DiffLabelToCurrentState(labelId, contextUser) {
167
- return this.Differ.DiffLabelToCurrentState(labelId, contextUser);
167
+ return this.differ.DiffLabelToCurrentState(labelId, contextUser);
168
168
  }
169
169
  /**
170
170
  * Get the snapshot of a specific record at a specific label.
171
171
  */
172
172
  async GetStateAtLabel(entityName, recordId, labelId, contextUser) {
173
- return this.Differ.GetRecordSnapshotAtLabel(entityName, recordId, labelId, contextUser);
173
+ return this.differ.GetRecordSnapshotAtLabel(entityName, recordId, labelId, contextUser);
174
174
  }
175
175
  // =======================================================================
176
176
  // Restore operations
@@ -182,7 +182,7 @@ export class VersionHistoryEngine {
182
182
  * changes in dependency order. Supports dry-run mode for previewing.
183
183
  */
184
184
  async RestoreToLabel(labelId, options, contextUser) {
185
- return this.Restorer.RestoreToLabel(labelId, options, contextUser);
185
+ return this.restorer.RestoreToLabel(labelId, options, contextUser);
186
186
  }
187
187
  // =======================================================================
188
188
  // Dependency graph operations
@@ -192,7 +192,7 @@ export class VersionHistoryEngine {
192
192
  * dependent (child) records through One-To-Many relationships.
193
193
  */
194
194
  async GetRecordDependencyGraph(entityName, recordKey, options, contextUser) {
195
- return this.GraphWalker.WalkDependents(entityName, recordKey, options, contextUser);
195
+ return this.graphWalker.WalkDependents(entityName, recordKey, options, contextUser);
196
196
  }
197
197
  }
198
198
  //# sourceMappingURL=VersionHistoryEngine.js.map
@@ -20,6 +20,8 @@ export declare const escapeSqlString: (value: string | null | undefined) => stri
20
20
  /**
21
21
  * Build a safe SQL equality filter: FieldName = 'escapedValue'
22
22
  */
23
+ export declare function SqlEquals(fieldName: string, value: string): string;
24
+ /** @deprecated Use {@link SqlEquals}. */
23
25
  export declare function sqlEquals(fieldName: string, value: string): string;
24
26
  /**
25
27
  * Build a safe SQL LIKE filter: FieldName LIKE '%escapedValue%'
@@ -30,32 +32,44 @@ export declare function sqlEquals(fieldName: string, value: string): string;
30
32
  * match, escape the metacharacters and add `ESCAPE '\'` (see `escapeLikeValue()` in
31
33
  * `@memberjunction/core`, `generic/runQuerySQLFilterImplementations.ts`).
32
34
  */
35
+ export declare function SqlContains(fieldName: string, value: string): string;
36
+ /** @deprecated Use {@link SqlContains}. */
33
37
  export declare function sqlContains(fieldName: string, value: string): string;
34
38
  /**
35
39
  * Build a safe SQL IN filter: FieldName IN ('a','b','c')
36
40
  */
41
+ export declare function SqlIn(fieldName: string, values: string[]): string;
42
+ /** @deprecated Use {@link SqlIn}. */
37
43
  export declare function sqlIn(fieldName: string, values: string[]): string;
38
44
  /**
39
45
  * Build a safe SQL NOT IN filter: FieldName NOT IN ('a','b','c')
40
46
  */
47
+ export declare function SqlNotIn(fieldName: string, values: string[]): string;
48
+ /** @deprecated Use {@link SqlNotIn}. */
41
49
  export declare function sqlNotIn(fieldName: string, values: string[]): string;
42
50
  import { CompositeKey, EntityInfo } from '@memberjunction/core';
43
51
  /**
44
52
  * Build a CompositeKey from entity metadata and a record data object.
45
53
  * Shared utility to avoid duplication across Walker and SnapshotBuilder.
46
54
  */
55
+ export declare function BuildCompositeKeyFromRecord(entityInfo: EntityInfo, record: Record<string, unknown>): CompositeKey;
56
+ /** @deprecated Use {@link BuildCompositeKeyFromRecord}. */
47
57
  export declare function buildCompositeKeyFromRecord(entityInfo: EntityInfo, record: Record<string, unknown>): CompositeKey;
48
58
  /**
49
59
  * Build a CompositeKey for loading from a stored record id. Accepts the bare value of a
50
60
  * single-column key (any column name) or the `Field1|Value1||Field2|Value2` segment Record
51
61
  * Changes / Version Label Items persist, so composite keys load too.
52
62
  */
63
+ export declare function BuildPrimaryKeyForLoad(entityInfo: EntityInfo, value: string): CompositeKey;
64
+ /** @deprecated Use {@link BuildPrimaryKeyForLoad}. */
53
65
  export declare function buildPrimaryKeyForLoad(entityInfo: EntityInfo, value: string): CompositeKey;
54
66
  /**
55
67
  * Build a CompositeKey for an entity that we know uses 'ID' as PK.
56
68
  * Only for MJ system entities (VersionLabel, VersionLabelItem, etc.)
57
69
  * where we control the schema and know the PK is always 'ID'.
58
70
  */
71
+ export declare function BuildIdKey(id: string): CompositeKey;
72
+ /** @deprecated Use {@link BuildIdKey}. */
59
73
  export declare function buildIdKey(id: string): CompositeKey;
60
74
  import { BaseEntity, IMetadataProvider, UserInfo } from '@memberjunction/core';
61
75
  /**
@@ -63,10 +77,14 @@ import { BaseEntity, IMetadataProvider, UserInfo } from '@memberjunction/core';
63
77
  * Returns parsed JSON or null on failure.
64
78
  * Shared by DiffEngine and RestoreEngine.
65
79
  */
80
+ export declare function LoadRecordChangeSnapshot(recordChangeId: string, contextUser: UserInfo): Promise<Record<string, unknown> | null>;
81
+ /** @deprecated Use {@link LoadRecordChangeSnapshot}. */
66
82
  export declare function loadRecordChangeSnapshot(recordChangeId: string, contextUser: UserInfo): Promise<Record<string, unknown> | null>;
67
83
  /**
68
84
  * Load a strongly-typed entity by its ID using InnerLoad with the entity's actual PK name.
69
85
  * Returns null if not found or on error.
70
86
  */
87
+ export declare function LoadEntityById<T extends BaseEntity = BaseEntity>(entityName: string, id: string, contextUser: UserInfo, provider?: IMetadataProvider): Promise<T | null>;
88
+ /** @deprecated Use {@link LoadEntityById}. */
71
89
  export declare function loadEntityById<T extends BaseEntity = BaseEntity>(entityName: string, id: string, contextUser: UserInfo, provider?: IMetadataProvider): Promise<T | null>;
72
90
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,qCAAqC;AACrC,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D,0CAA0C;AAC1C,eAAO,MAAM,0BAA0B,4BAA4B,CAAC;AAEpE,6CAA6C;AAC7C,eAAO,MAAM,6BAA6B,+BAA+B,CAAC;AAE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OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAEzC;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAClE,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,QAAQ,EACrB,QAAQ,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAanB;AAED,8CAA8C;AAC9C,wBAAsB,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAClE,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,QAAQ,EACrB,QAAQ,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAEnB"}
package/dist/constants.js CHANGED
@@ -27,9 +27,13 @@ export const escapeSqlString = (value) => EscapeSQLString(value);
27
27
  /**
28
28
  * Build a safe SQL equality filter: FieldName = 'escapedValue'
29
29
  */
30
- export function sqlEquals(fieldName, value) {
30
+ export function SqlEquals(fieldName, value) {
31
31
  return `${fieldName} = '${EscapeSQLString(value)}'`;
32
32
  }
33
+ /** @deprecated Use {@link SqlEquals}. */
34
+ export function sqlEquals(fieldName, value) {
35
+ return SqlEquals(fieldName, value);
36
+ }
33
37
  /**
34
38
  * Build a safe SQL LIKE filter: FieldName LIKE '%escapedValue%'
35
39
  *
@@ -39,23 +43,35 @@ export function sqlEquals(fieldName, value) {
39
43
  * match, escape the metacharacters and add `ESCAPE '\'` (see `escapeLikeValue()` in
40
44
  * `@memberjunction/core`, `generic/runQuerySQLFilterImplementations.ts`).
41
45
  */
42
- export function sqlContains(fieldName, value) {
46
+ export function SqlContains(fieldName, value) {
43
47
  return `${fieldName} LIKE '%${EscapeSQLString(value)}%'`;
44
48
  }
49
+ /** @deprecated Use {@link SqlContains}. */
50
+ export function sqlContains(fieldName, value) {
51
+ return SqlContains(fieldName, value);
52
+ }
45
53
  /**
46
54
  * Build a safe SQL IN filter: FieldName IN ('a','b','c')
47
55
  */
48
- export function sqlIn(fieldName, values) {
56
+ export function SqlIn(fieldName, values) {
49
57
  const escaped = values.map(v => `'${EscapeSQLString(v)}'`).join(', ');
50
58
  return `${fieldName} IN (${escaped})`;
51
59
  }
60
+ /** @deprecated Use {@link SqlIn}. */
61
+ export function sqlIn(fieldName, values) {
62
+ return SqlIn(fieldName, values);
63
+ }
52
64
  /**
53
65
  * Build a safe SQL NOT IN filter: FieldName NOT IN ('a','b','c')
54
66
  */
55
- export function sqlNotIn(fieldName, values) {
67
+ export function SqlNotIn(fieldName, values) {
56
68
  const escaped = values.map(v => `'${EscapeSQLString(v)}'`).join(', ');
57
69
  return `${fieldName} NOT IN (${escaped})`;
58
70
  }
71
+ /** @deprecated Use {@link SqlNotIn}. */
72
+ export function sqlNotIn(fieldName, values) {
73
+ return SqlNotIn(fieldName, values);
74
+ }
59
75
  // ---------------------------------------------------------------------------
60
76
  // Composite key utilities
61
77
  // ---------------------------------------------------------------------------
@@ -64,25 +80,37 @@ import { CompositeKey } from '@memberjunction/core';
64
80
  * Build a CompositeKey from entity metadata and a record data object.
65
81
  * Shared utility to avoid duplication across Walker and SnapshotBuilder.
66
82
  */
67
- export function buildCompositeKeyFromRecord(entityInfo, record) {
83
+ export function BuildCompositeKeyFromRecord(entityInfo, record) {
68
84
  return CompositeKey.FromEntityRecord(entityInfo, record);
69
85
  }
86
+ /** @deprecated Use {@link BuildCompositeKeyFromRecord}. */
87
+ export function buildCompositeKeyFromRecord(entityInfo, record) {
88
+ return BuildCompositeKeyFromRecord(entityInfo, record);
89
+ }
70
90
  /**
71
91
  * Build a CompositeKey for loading from a stored record id. Accepts the bare value of a
72
92
  * single-column key (any column name) or the `Field1|Value1||Field2|Value2` segment Record
73
93
  * Changes / Version Label Items persist, so composite keys load too.
74
94
  */
75
- export function buildPrimaryKeyForLoad(entityInfo, value) {
95
+ export function BuildPrimaryKeyForLoad(entityInfo, value) {
76
96
  return CompositeKey.FromURLSegment(entityInfo, value);
77
97
  }
98
+ /** @deprecated Use {@link BuildPrimaryKeyForLoad}. */
99
+ export function buildPrimaryKeyForLoad(entityInfo, value) {
100
+ return BuildPrimaryKeyForLoad(entityInfo, value);
101
+ }
78
102
  /**
79
103
  * Build a CompositeKey for an entity that we know uses 'ID' as PK.
80
104
  * Only for MJ system entities (VersionLabel, VersionLabelItem, etc.)
81
105
  * where we control the schema and know the PK is always 'ID'.
82
106
  */
83
- export function buildIdKey(id) {
107
+ export function BuildIdKey(id) {
84
108
  return CompositeKey.FromID(id); // first-pk-ok: documented for MJ system entities only (Version Labels / Label Items / Restores / Record Changes), whose key is ID
85
109
  }
110
+ /** @deprecated Use {@link BuildIdKey}. */
111
+ export function buildIdKey(id) {
112
+ return BuildIdKey(id);
113
+ }
86
114
  // ---------------------------------------------------------------------------
87
115
  // Record change utilities
88
116
  // ---------------------------------------------------------------------------
@@ -92,11 +120,11 @@ import { Metadata, RunView, LogError } from '@memberjunction/core';
92
120
  * Returns parsed JSON or null on failure.
93
121
  * Shared by DiffEngine and RestoreEngine.
94
122
  */
95
- export async function loadRecordChangeSnapshot(recordChangeId, contextUser) {
123
+ export async function LoadRecordChangeSnapshot(recordChangeId, contextUser) {
96
124
  const rv = new RunView();
97
125
  const result = await rv.RunView({
98
126
  EntityName: ENTITY_RECORD_CHANGES,
99
- ExtraFilter: sqlEquals('ID', recordChangeId),
127
+ ExtraFilter: SqlEquals('ID', recordChangeId),
100
128
  // 'EntityID' is required, not decorative: field-level security projects a Record Change's
101
129
  // payload against the entity the row is ABOUT, and a row arriving without EntityID cannot be
102
130
  // resolved — so the payload is withheld. See guides/FIELD_LEVEL_SECURITY_GUIDE.md §3.2.
@@ -126,11 +154,15 @@ export async function loadRecordChangeSnapshot(recordChangeId, contextUser) {
126
154
  return null;
127
155
  }
128
156
  }
157
+ /** @deprecated Use {@link LoadRecordChangeSnapshot}. */
158
+ export async function loadRecordChangeSnapshot(recordChangeId, contextUser) {
159
+ return LoadRecordChangeSnapshot(recordChangeId, contextUser);
160
+ }
129
161
  /**
130
162
  * Load a strongly-typed entity by its ID using InnerLoad with the entity's actual PK name.
131
163
  * Returns null if not found or on error.
132
164
  */
133
- export async function loadEntityById(entityName, id, contextUser, provider) {
165
+ export async function LoadEntityById(entityName, id, contextUser, provider) {
134
166
  const md = provider ?? Metadata.Provider;
135
167
  const entityInfo = md.EntityByName(entityName);
136
168
  if (!entityInfo) {
@@ -138,10 +170,14 @@ export async function loadEntityById(entityName, id, contextUser, provider) {
138
170
  return null;
139
171
  }
140
172
  const entity = await md.GetEntityObject(entityName, contextUser);
141
- const key = buildPrimaryKeyForLoad(entityInfo, id);
173
+ const key = BuildPrimaryKeyForLoad(entityInfo, id);
142
174
  const loaded = await entity.InnerLoad(key);
143
175
  if (!loaded)
144
176
  return null;
145
177
  return entity;
146
178
  }
179
+ /** @deprecated Use {@link LoadEntityById}. */
180
+ export async function loadEntityById(entityName, id, contextUser, provider) {
181
+ return LoadEntityById(entityName, id, contextUser, provider);
182
+ }
147
183
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E,qCAAqC;AACrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAE1D,0CAA0C;AAC1C,MAAM,CAAC,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AAEpE,6CAA6C;AAC7C,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAE1E,qCAAqC;AACrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAE1D,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E;;;;;;GAMG;AAC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Q,CAAC,oEAAoE,cAAc,GAAG,CAAC,CAAC;QAChG,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC;AAED,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC1C,cAAsB,EACtB,WAAqB;IAErB,OAAO,wBAAwB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AACjE,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAChC,UAAkB,EAClB,EAAU,EACV,WAAqB,EACrB,QAA4B;IAE5B,MAAM,EAAE,GAAG,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;IACzC,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,QAAQ,CAAC,2BAA2B,UAAU,yBAAyB,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,eAAe,CAAI,UAAU,EAAE,WAAW,CAAC,CAAC;IACpE,MAAM,GAAG,GAAG,sBAAsB,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,8CAA8C;AAC9C,MAAM,CAAC,KAAK,UAAU,cAAc,CAChC,UAAkB,EAClB,EAAU,EACV,WAAqB,EACrB,QAA4B;IAE5B,OAAO,cAAc,CAAC,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/version-history",
3
3
  "type": "module",
4
- "version": "6.1.4",
4
+ "version": "6.2.0-edge.1",
5
5
  "description": "Server-side version history engine providing label-based versioning, dependency-graph snapshots, cross-entity diffs, and point-in-time restore for MemberJunction record changes",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -14,9 +14,9 @@
14
14
  "typescript": "^5.9.3"
15
15
  },
16
16
  "dependencies": {
17
- "@memberjunction/core": "6.1.4",
18
- "@memberjunction/core-entities": "6.1.4",
19
- "@memberjunction/global": "6.1.4"
17
+ "@memberjunction/core": "6.2.0-edge.1",
18
+ "@memberjunction/core-entities": "6.2.0-edge.1",
19
+ "@memberjunction/global": "6.2.0-edge.1"
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",