@memberjunction/archiving-engine 6.2.0-edge.4 → 6.2.0-edge.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ArchiveDriverResolver.d.ts +8 -0
- package/dist/ArchiveDriverResolver.d.ts.map +1 -0
- package/dist/ArchiveDriverResolver.js +16 -0
- package/dist/ArchiveDriverResolver.js.map +1 -0
- package/dist/ArchiveEngine.d.ts +66 -8
- package/dist/ArchiveEngine.d.ts.map +1 -1
- package/dist/ArchiveEngine.js +217 -47
- package/dist/ArchiveEngine.js.map +1 -1
- package/dist/ArchiveProcessor.d.ts +17 -12
- package/dist/ArchiveProcessor.d.ts.map +1 -1
- package/dist/ArchiveProcessor.js +54 -53
- package/dist/ArchiveProcessor.js.map +1 -1
- package/dist/BaseArchiveDriver.d.ts +10 -2
- package/dist/BaseArchiveDriver.d.ts.map +1 -1
- package/dist/BaseArchiveDriver.js +8 -0
- package/dist/BaseArchiveDriver.js.map +1 -1
- package/dist/DefaultArchiveDriver.d.ts +27 -9
- package/dist/DefaultArchiveDriver.d.ts.map +1 -1
- package/dist/DefaultArchiveDriver.js +52 -15
- package/dist/DefaultArchiveDriver.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +15 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseArchiveDriver } from './BaseArchiveDriver.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves an archive driver by its registered class name via ClassFactory.
|
|
4
|
+
* Returns a `DefaultArchiveDriver` when no class name is given, the registered driver
|
|
5
|
+
* when the name resolves, and `null` when the name is not registered.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ResolveArchiveDriver(driverClassName: string | null): BaseArchiveDriver | null;
|
|
8
|
+
//# sourceMappingURL=ArchiveDriverResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArchiveDriverResolver.d.ts","sourceRoot":"","sources":["../src/ArchiveDriverResolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,iBAAiB,GAAG,IAAI,CAM7F"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MJGlobal } from '@memberjunction/global';
|
|
2
|
+
import { BaseArchiveDriver } from './BaseArchiveDriver.js';
|
|
3
|
+
import { DefaultArchiveDriver } from './DefaultArchiveDriver.js';
|
|
4
|
+
/**
|
|
5
|
+
* Resolves an archive driver by its registered class name via ClassFactory.
|
|
6
|
+
* Returns a `DefaultArchiveDriver` when no class name is given, the registered driver
|
|
7
|
+
* when the name resolves, and `null` when the name is not registered.
|
|
8
|
+
*/
|
|
9
|
+
export function ResolveArchiveDriver(driverClassName) {
|
|
10
|
+
if (!driverClassName) {
|
|
11
|
+
return new DefaultArchiveDriver();
|
|
12
|
+
}
|
|
13
|
+
const result = MJGlobal.Instance.ClassFactory.TryCreateInstance(BaseArchiveDriver, driverClassName);
|
|
14
|
+
return result.Resolved ? result.Instance : null;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ArchiveDriverResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArchiveDriverResolver.js","sourceRoot":"","sources":["../src/ArchiveDriverResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,eAA8B;IAC/D,IAAI,CAAC,eAAe,EAAE,CAAC;QACnB,OAAO,IAAI,oBAAoB,EAAE,CAAC;IACtC,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,iBAAiB,CAAoB,iBAAiB,EAAE,eAAe,CAAC,CAAC;IACvH,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC"}
|
package/dist/ArchiveEngine.d.ts
CHANGED
|
@@ -33,19 +33,28 @@ export declare class ArchiveEngine extends BaseSingleton<ArchiveEngine> {
|
|
|
33
33
|
* Executes a complete archive run for the given configuration.
|
|
34
34
|
*
|
|
35
35
|
* Steps:
|
|
36
|
-
* 1. Validates
|
|
37
|
-
* 2. Loads the ArchiveConfiguration and its entity configurations
|
|
38
|
-
* 3.
|
|
39
|
-
* 4. Creates an ArchiveRun record
|
|
40
|
-
* 5. Initializes the storage driver
|
|
36
|
+
* 1. Validates the configuration is active and not already running
|
|
37
|
+
* 2. Loads the ArchiveConfiguration and its entity configurations (by Priority)
|
|
38
|
+
* 3. For a Purge configuration, refuses entities that cannot be purged safely
|
|
39
|
+
* 4. Creates an ArchiveRun record carrying the configuration's StorageMode
|
|
40
|
+
* 5. Initializes the storage driver (Store only)
|
|
41
41
|
* 6. Processes each entity via ArchiveProcessor
|
|
42
42
|
* 7. Updates the ArchiveRun with final totals
|
|
43
43
|
*
|
|
44
|
+
* A thrown error after step 4 marks the ArchiveRun Failed with the message in ErrorLog
|
|
45
|
+
* and the totals of the entities processed before the error.
|
|
46
|
+
*
|
|
44
47
|
* @param configId - ID of the ArchiveConfiguration to execute
|
|
45
48
|
* @param contextUser - User context for authorization and database operations
|
|
46
49
|
* @returns Summary result of the archive run
|
|
47
50
|
*/
|
|
48
51
|
RunArchive(configId: string, contextUser: UserInfo): Promise<ArchiveRunResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Initializes storage (Store only), processes every entity, and finalizes the run
|
|
54
|
+
* with its totals. Throws when storage initialization or entity processing throws;
|
|
55
|
+
* totals then holds the counts of the entities processed before the error.
|
|
56
|
+
*/
|
|
57
|
+
private executeArchiveRun;
|
|
49
58
|
/**
|
|
50
59
|
* Loads the ArchiveConfiguration record by ID.
|
|
51
60
|
*/
|
|
@@ -56,23 +65,72 @@ export declare class ArchiveEngine extends BaseSingleton<ArchiveEngine> {
|
|
|
56
65
|
*/
|
|
57
66
|
private loadConfigurationEntities;
|
|
58
67
|
/**
|
|
59
|
-
* Creates a new ArchiveRun record to track this execution
|
|
68
|
+
* Creates a new ArchiveRun record to track this execution, carrying the
|
|
69
|
+
* configuration's StorageMode.
|
|
60
70
|
*/
|
|
61
71
|
private createArchiveRun;
|
|
62
72
|
/**
|
|
63
73
|
* Updates the ArchiveRun record with final totals and completion status.
|
|
64
74
|
*/
|
|
65
75
|
private finalizeArchiveRun;
|
|
76
|
+
/**
|
|
77
|
+
* Marks the ArchiveRun as Failed with the error message, a completion time, and the
|
|
78
|
+
* totals of the entities processed before the error. Never throws; a failed save is logged.
|
|
79
|
+
*/
|
|
80
|
+
private failArchiveRun;
|
|
81
|
+
/**
|
|
82
|
+
* Copies the aggregated totals onto the ArchiveRun's count fields.
|
|
83
|
+
*/
|
|
84
|
+
private applyTotals;
|
|
66
85
|
/**
|
|
67
86
|
* Initializes the ArchiveStorageManager from the configuration's storage account.
|
|
68
87
|
*/
|
|
69
88
|
private initializeStorage;
|
|
70
89
|
/**
|
|
71
|
-
* Processes all configured entities sequentially (order matters for dependency safety)
|
|
90
|
+
* Processes all configured entities sequentially (order matters for dependency safety)
|
|
91
|
+
* and adds each entity's counts to totals as soon as that entity completes.
|
|
72
92
|
*/
|
|
73
93
|
private processAllEntities;
|
|
74
94
|
/**
|
|
75
|
-
*
|
|
95
|
+
* Returns why a Purge configuration cannot run, or null when it can (Store
|
|
96
|
+
* configurations always can). A purge keeps no copy, so every entity must change
|
|
97
|
+
* its source rows, must not copy the old values into Record Changes, must use a
|
|
98
|
+
* registered driver that supports purging, and under HardDelete must not use soft
|
|
99
|
+
* delete. The Record Changes and soft delete checks also cover every entity the
|
|
100
|
+
* HardDelete cascade reaches. One blocked entity refuses the whole run.
|
|
101
|
+
*/
|
|
102
|
+
private findPurgeBlocker;
|
|
103
|
+
/**
|
|
104
|
+
* Returns why one entity configuration cannot be purged, or null when it can.
|
|
105
|
+
* Checks run in order: metadata, ArchiveOnly mode, Record Changes tracking, driver
|
|
106
|
+
* registration, driver purge support, and (for HardDelete) soft delete and the
|
|
107
|
+
* delete cascade.
|
|
108
|
+
*/
|
|
109
|
+
private findEntityPurgeBlocker;
|
|
110
|
+
/**
|
|
111
|
+
* Returns why a HardDelete purge of the entity cannot run, or null when it can: the
|
|
112
|
+
* entity must not use soft delete, and no entity its delete cascade reaches may track
|
|
113
|
+
* Record Changes, use soft delete, or be missing from metadata.
|
|
114
|
+
*/
|
|
115
|
+
private findHardDeleteBlocker;
|
|
116
|
+
/**
|
|
117
|
+
* Walks the HardDelete cascade of the entity (the same One To Many relationships the
|
|
118
|
+
* default driver deletes, excluding self references) and returns the first reachable
|
|
119
|
+
* entity that blocks a purge, with the reason, or null.
|
|
120
|
+
*/
|
|
121
|
+
private findBlockedCascadeEntity;
|
|
122
|
+
/**
|
|
123
|
+
* Returns why an entity reached by a HardDelete cascade blocks a purge, or null when
|
|
124
|
+
* it does not. The reason completes a sentence that names the dependent entity.
|
|
125
|
+
*/
|
|
126
|
+
private cascadeBlockReason;
|
|
127
|
+
/**
|
|
128
|
+
* Builds a failure ArchiveRunResult with zero counts. StorageMode is set only when
|
|
129
|
+
* the configuration loaded.
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* Builds a failed result. Totals, when given, are the counts of the entities
|
|
133
|
+
* processed before the failure.
|
|
76
134
|
*/
|
|
77
135
|
private buildFailureResult;
|
|
78
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArchiveEngine.d.ts","sourceRoot":"","sources":["../src/ArchiveEngine.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ArchiveEngine.d.ts","sourceRoot":"","sources":["../src/ArchiveEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,iBAAiB,EAA0C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACjJ,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAA+D,MAAM,SAAS,CAAC;AAIxG;;;;;;;;;GASG;AACH,qBAAa,aAAc,SAAQ,aAAa,CAAC,aAAa,CAAC;IAC3D;;OAEG;IACH,WAAkB,QAAQ,IAAI,aAAa,CAE1C;IAED,SAAS;IAIT,OAAO,CAAC,SAAS,CAA0C;IAE3D,2FAA2F;IAC3F,OAAO,CAAC,SAAS,CAAgC;IAEjD,+EAA+E;IAC/E,IAAW,QAAQ,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,EAGvD;IAED,qEAAqE;IACrE,IAAW,QAAQ,IAAI,iBAAiB,CAEvC;IAED;;OAEG;IACH,IAAW,QAAQ,IAAI,eAAe,CAErC;IAMD;;;;;;;;;;;;;;;;;;OAkBG;IACU,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA0C3F;;;;OAIG;YACW,iBAAiB;IAgC/B;;OAEG;YACW,iBAAiB;IAO/B;;;OAGG;YACW,yBAAyB;IAoBvC;;;OAGG;YACW,gBAAgB;IAmB9B;;OAEG;YACW,kBAAkB;IAmBhC;;;OAGG;YACW,cAAc;IAgB5B;;OAEG;IACH,OAAO,CAAC,WAAW;IAYnB;;OAEG;YACW,iBAAiB;IAe/B;;;OAGG;YACW,kBAAkB;IAgChC;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IA4B9B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAsBhC;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;;OAGG;IACH;;;OAGG;IACH,OAAO,CAAC,kBAAkB;CAmB7B"}
|
package/dist/ArchiveEngine.js
CHANGED
|
@@ -3,6 +3,8 @@ import { BaseSingleton } from '@memberjunction/global';
|
|
|
3
3
|
import { ArchiveProcessor } from './ArchiveProcessor.js';
|
|
4
4
|
import { ArchiveRecovery } from './ArchiveRecovery.js';
|
|
5
5
|
import { ArchiveStorageManager } from './ArchiveStorageManager.js';
|
|
6
|
+
import { IsPurgeStorageMode } from './types.js';
|
|
7
|
+
import { ResolveArchiveDriver } from './ArchiveDriverResolver.js';
|
|
6
8
|
/**
|
|
7
9
|
* Main orchestrator for archive operations. Singleton that coordinates
|
|
8
10
|
* loading configurations, initializing storage, processing entities,
|
|
@@ -46,57 +48,81 @@ export class ArchiveEngine extends BaseSingleton {
|
|
|
46
48
|
* Executes a complete archive run for the given configuration.
|
|
47
49
|
*
|
|
48
50
|
* Steps:
|
|
49
|
-
* 1. Validates
|
|
50
|
-
* 2. Loads the ArchiveConfiguration and its entity configurations
|
|
51
|
-
* 3.
|
|
52
|
-
* 4. Creates an ArchiveRun record
|
|
53
|
-
* 5. Initializes the storage driver
|
|
51
|
+
* 1. Validates the configuration is active and not already running
|
|
52
|
+
* 2. Loads the ArchiveConfiguration and its entity configurations (by Priority)
|
|
53
|
+
* 3. For a Purge configuration, refuses entities that cannot be purged safely
|
|
54
|
+
* 4. Creates an ArchiveRun record carrying the configuration's StorageMode
|
|
55
|
+
* 5. Initializes the storage driver (Store only)
|
|
54
56
|
* 6. Processes each entity via ArchiveProcessor
|
|
55
57
|
* 7. Updates the ArchiveRun with final totals
|
|
56
58
|
*
|
|
59
|
+
* A thrown error after step 4 marks the ArchiveRun Failed with the message in ErrorLog
|
|
60
|
+
* and the totals of the entities processed before the error.
|
|
61
|
+
*
|
|
57
62
|
* @param configId - ID of the ArchiveConfiguration to execute
|
|
58
63
|
* @param contextUser - User context for authorization and database operations
|
|
59
64
|
* @returns Summary result of the archive run
|
|
60
65
|
*/
|
|
61
66
|
async RunArchive(configId, contextUser) {
|
|
67
|
+
let config = null;
|
|
68
|
+
let archiveRun = null;
|
|
69
|
+
const totals = { Archived: 0, Failed: 0, Skipped: 0, Bytes: 0 };
|
|
62
70
|
try {
|
|
63
|
-
|
|
71
|
+
config = await this.loadConfiguration(configId, contextUser);
|
|
64
72
|
if (!config) {
|
|
65
73
|
return this.buildFailureResult('', `ArchiveConfiguration not found: ${configId}`);
|
|
66
74
|
}
|
|
67
|
-
const isActive = config.
|
|
75
|
+
const isActive = config.IsActive;
|
|
68
76
|
if (!isActive) {
|
|
69
|
-
return this.buildFailureResult('', `ArchiveConfiguration "${config.
|
|
77
|
+
return this.buildFailureResult('', `ArchiveConfiguration "${config.Name}" is not active. Set IsActive to true before running.`, config.StorageMode);
|
|
70
78
|
}
|
|
71
|
-
const status = config.
|
|
79
|
+
const status = config.Status;
|
|
72
80
|
if (status === 'Running') {
|
|
73
|
-
return this.buildFailureResult('', `ArchiveConfiguration "${config.
|
|
81
|
+
return this.buildFailureResult('', `ArchiveConfiguration "${config.Name}" is already running. Wait for the current run to complete.`, config.StorageMode);
|
|
74
82
|
}
|
|
75
83
|
const configEntities = await this.loadConfigurationEntities(configId, contextUser);
|
|
76
84
|
if (configEntities.length === 0) {
|
|
77
|
-
return this.buildFailureResult('', 'No entity configurations found for this archive configuration');
|
|
85
|
+
return this.buildFailureResult('', 'No entity configurations found for this archive configuration', config.StorageMode);
|
|
78
86
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
await this.
|
|
84
|
-
return
|
|
85
|
-
Success: totals.Failed === 0,
|
|
86
|
-
ArchiveRunId: archiveRun.Get('ID'),
|
|
87
|
-
TotalRecords: totals.Archived + totals.Failed + totals.Skipped,
|
|
88
|
-
ArchivedRecords: totals.Archived,
|
|
89
|
-
FailedRecords: totals.Failed,
|
|
90
|
-
SkippedRecords: totals.Skipped,
|
|
91
|
-
TotalBytesArchived: totals.Bytes,
|
|
92
|
-
};
|
|
87
|
+
const purgeBlocker = this.findPurgeBlocker(config, configEntities);
|
|
88
|
+
if (purgeBlocker) {
|
|
89
|
+
return this.buildFailureResult('', purgeBlocker, config.StorageMode);
|
|
90
|
+
}
|
|
91
|
+
archiveRun = await this.createArchiveRun(config, contextUser);
|
|
92
|
+
return await this.executeArchiveRun(config, configEntities, archiveRun, totals, contextUser);
|
|
93
93
|
}
|
|
94
94
|
catch (error) {
|
|
95
95
|
const message = error instanceof Error ? error.message : String(error);
|
|
96
96
|
LogError(`ArchiveEngine.RunArchive failed: ${message}`);
|
|
97
|
-
|
|
97
|
+
if (archiveRun && archiveRun.Status === 'Running') {
|
|
98
|
+
await this.failArchiveRun(archiveRun, message, totals);
|
|
99
|
+
}
|
|
100
|
+
return this.buildFailureResult(archiveRun?.ID ?? '', message, config?.StorageMode, archiveRun ? totals : undefined);
|
|
98
101
|
}
|
|
99
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Initializes storage (Store only), processes every entity, and finalizes the run
|
|
105
|
+
* with its totals. Throws when storage initialization or entity processing throws;
|
|
106
|
+
* totals then holds the counts of the entities processed before the error.
|
|
107
|
+
*/
|
|
108
|
+
async executeArchiveRun(config, configEntities, archiveRun, totals, contextUser) {
|
|
109
|
+
const storageManager = IsPurgeStorageMode(config.StorageMode)
|
|
110
|
+
? null
|
|
111
|
+
: await this.initializeStorage(config, contextUser);
|
|
112
|
+
LogStatus(`ArchiveEngine: Starting ${config.StorageMode} run ${archiveRun.ID} with ${configEntities.length} entities`);
|
|
113
|
+
await this.processAllEntities(configEntities, config, archiveRun, storageManager, totals, contextUser);
|
|
114
|
+
await this.finalizeArchiveRun(archiveRun, totals, contextUser);
|
|
115
|
+
return {
|
|
116
|
+
Success: totals.Failed === 0,
|
|
117
|
+
ArchiveRunId: archiveRun.ID,
|
|
118
|
+
TotalRecords: totals.Archived + totals.Failed + totals.Skipped,
|
|
119
|
+
ArchivedRecords: totals.Archived,
|
|
120
|
+
FailedRecords: totals.Failed,
|
|
121
|
+
SkippedRecords: totals.Skipped,
|
|
122
|
+
TotalBytesArchived: totals.Bytes,
|
|
123
|
+
StorageMode: config.StorageMode,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
100
126
|
// ========================================
|
|
101
127
|
// Configuration Loading
|
|
102
128
|
// ========================================
|
|
@@ -130,20 +156,22 @@ export class ArchiveEngine extends BaseSingleton {
|
|
|
130
156
|
// Archive Run Lifecycle
|
|
131
157
|
// ========================================
|
|
132
158
|
/**
|
|
133
|
-
* Creates a new ArchiveRun record to track this execution
|
|
159
|
+
* Creates a new ArchiveRun record to track this execution, carrying the
|
|
160
|
+
* configuration's StorageMode.
|
|
134
161
|
*/
|
|
135
162
|
async createArchiveRun(config, contextUser) {
|
|
136
163
|
const md = this.Provider;
|
|
137
164
|
const run = await md.GetEntityObject('MJ: Archive Runs', contextUser);
|
|
138
|
-
run.
|
|
139
|
-
run.
|
|
140
|
-
run.
|
|
141
|
-
run.
|
|
165
|
+
run.ArchiveConfigurationID = config.ID;
|
|
166
|
+
run.UserID = contextUser.ID;
|
|
167
|
+
run.Status = 'Running';
|
|
168
|
+
run.StartedAt = new Date();
|
|
169
|
+
run.StorageMode = config.StorageMode;
|
|
142
170
|
const saved = await run.Save();
|
|
143
171
|
if (!saved) {
|
|
144
|
-
throw new Error(`Failed to create ArchiveRun record: ${run.LatestResult?.
|
|
172
|
+
throw new Error(`Failed to create ArchiveRun record: ${run.LatestResult?.CompleteMessage ?? 'Unknown error'}`);
|
|
145
173
|
}
|
|
146
|
-
LogStatus(`ArchiveEngine: Created ArchiveRun ${run.
|
|
174
|
+
LogStatus(`ArchiveEngine: Created ArchiveRun ${run.ID}`);
|
|
147
175
|
return run;
|
|
148
176
|
}
|
|
149
177
|
/**
|
|
@@ -159,9 +187,39 @@ export class ArchiveEngine extends BaseSingleton {
|
|
|
159
187
|
archiveRun.Set('TotalBytesArchived', totals.Bytes);
|
|
160
188
|
const saved = await archiveRun.Save();
|
|
161
189
|
if (!saved) {
|
|
162
|
-
LogError(`Failed to finalize ArchiveRun ${archiveRun.
|
|
190
|
+
LogError(`Failed to finalize ArchiveRun ${archiveRun.ID}: ${archiveRun.LatestResult?.Message ?? 'Unknown error'}`);
|
|
163
191
|
}
|
|
164
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Marks the ArchiveRun as Failed with the error message, a completion time, and the
|
|
195
|
+
* totals of the entities processed before the error. Never throws; a failed save is logged.
|
|
196
|
+
*/
|
|
197
|
+
async failArchiveRun(archiveRun, message, totals) {
|
|
198
|
+
try {
|
|
199
|
+
archiveRun.Status = 'Failed';
|
|
200
|
+
archiveRun.CompletedAt = new Date();
|
|
201
|
+
archiveRun.ErrorLog = message;
|
|
202
|
+
this.applyTotals(archiveRun, totals);
|
|
203
|
+
const saved = await archiveRun.Save();
|
|
204
|
+
if (!saved) {
|
|
205
|
+
LogError(`Failed to mark ArchiveRun ${archiveRun.ID} as Failed: ${archiveRun.LatestResult?.CompleteMessage ?? 'Unknown error'}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
const saveError = error instanceof Error ? error.message : String(error);
|
|
210
|
+
LogError(`Failed to mark ArchiveRun ${archiveRun.ID} as Failed: ${saveError}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Copies the aggregated totals onto the ArchiveRun's count fields.
|
|
215
|
+
*/
|
|
216
|
+
applyTotals(archiveRun, totals) {
|
|
217
|
+
archiveRun.TotalRecords = totals.Archived + totals.Failed + totals.Skipped;
|
|
218
|
+
archiveRun.ArchivedRecords = totals.Archived;
|
|
219
|
+
archiveRun.FailedRecords = totals.Failed;
|
|
220
|
+
archiveRun.SkippedRecords = totals.Skipped;
|
|
221
|
+
archiveRun.TotalBytesArchived = totals.Bytes;
|
|
222
|
+
}
|
|
165
223
|
// ========================================
|
|
166
224
|
// Storage Initialization
|
|
167
225
|
// ========================================
|
|
@@ -169,7 +227,7 @@ export class ArchiveEngine extends BaseSingleton {
|
|
|
169
227
|
* Initializes the ArchiveStorageManager from the configuration's storage account.
|
|
170
228
|
*/
|
|
171
229
|
async initializeStorage(config, contextUser) {
|
|
172
|
-
const storageAccountId = config.
|
|
230
|
+
const storageAccountId = config.StorageAccountID;
|
|
173
231
|
if (!storageAccountId) {
|
|
174
232
|
throw new Error('ArchiveConfiguration has no StorageAccountID configured');
|
|
175
233
|
}
|
|
@@ -181,10 +239,10 @@ export class ArchiveEngine extends BaseSingleton {
|
|
|
181
239
|
// Entity Processing
|
|
182
240
|
// ========================================
|
|
183
241
|
/**
|
|
184
|
-
* Processes all configured entities sequentially (order matters for dependency safety)
|
|
242
|
+
* Processes all configured entities sequentially (order matters for dependency safety)
|
|
243
|
+
* and adds each entity's counts to totals as soon as that entity completes.
|
|
185
244
|
*/
|
|
186
|
-
async processAllEntities(configEntities, config, archiveRun, storageManager, contextUser) {
|
|
187
|
-
const totals = { Archived: 0, Failed: 0, Skipped: 0, Bytes: 0 };
|
|
245
|
+
async processAllEntities(configEntities, config, archiveRun, storageManager, totals, contextUser) {
|
|
188
246
|
for (const configEntity of configEntities) {
|
|
189
247
|
const processor = new ArchiveProcessor();
|
|
190
248
|
const entityResult = await processor.ProcessEntity(configEntity, config, archiveRun, storageManager, contextUser);
|
|
@@ -192,29 +250,141 @@ export class ArchiveEngine extends BaseSingleton {
|
|
|
192
250
|
totals.Failed += entityResult.Failed;
|
|
193
251
|
totals.Skipped += entityResult.Skipped;
|
|
194
252
|
totals.Bytes += entityResult.Bytes;
|
|
195
|
-
const entityName = configEntity.
|
|
253
|
+
const entityName = configEntity.Entity;
|
|
196
254
|
LogStatus(`ArchiveEngine: Entity "${entityName}" complete - ` +
|
|
197
255
|
`archived: ${entityResult.Archived}, failed: ${entityResult.Failed}, ` +
|
|
198
256
|
`skipped: ${entityResult.Skipped}, bytes: ${entityResult.Bytes}`);
|
|
199
257
|
}
|
|
200
|
-
|
|
258
|
+
}
|
|
259
|
+
// ========================================
|
|
260
|
+
// Purge Validation
|
|
261
|
+
// ========================================
|
|
262
|
+
/**
|
|
263
|
+
* Returns why a Purge configuration cannot run, or null when it can (Store
|
|
264
|
+
* configurations always can). A purge keeps no copy, so every entity must change
|
|
265
|
+
* its source rows, must not copy the old values into Record Changes, must use a
|
|
266
|
+
* registered driver that supports purging, and under HardDelete must not use soft
|
|
267
|
+
* delete. The Record Changes and soft delete checks also cover every entity the
|
|
268
|
+
* HardDelete cascade reaches. One blocked entity refuses the whole run.
|
|
269
|
+
*/
|
|
270
|
+
findPurgeBlocker(config, configEntities) {
|
|
271
|
+
if (!IsPurgeStorageMode(config.StorageMode)) {
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
for (const configEntity of configEntities) {
|
|
275
|
+
const blocker = this.findEntityPurgeBlocker(config, configEntity);
|
|
276
|
+
if (blocker) {
|
|
277
|
+
return blocker;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Returns why one entity configuration cannot be purged, or null when it can.
|
|
284
|
+
* Checks run in order: metadata, ArchiveOnly mode, Record Changes tracking, driver
|
|
285
|
+
* registration, driver purge support, and (for HardDelete) soft delete and the
|
|
286
|
+
* delete cascade.
|
|
287
|
+
*/
|
|
288
|
+
findEntityPurgeBlocker(config, configEntity) {
|
|
289
|
+
const entityName = configEntity.Entity;
|
|
290
|
+
const entityInfo = this.Provider.EntityByName(entityName);
|
|
291
|
+
if (!entityInfo) {
|
|
292
|
+
return `Entity "${entityName}" was not found in metadata`;
|
|
293
|
+
}
|
|
294
|
+
const mode = configEntity.Mode ?? config.DefaultMode;
|
|
295
|
+
if (mode === 'ArchiveOnly') {
|
|
296
|
+
return `Entity "${entityName}" uses ArchiveOnly mode, which changes nothing when StorageMode is Purge. Use StripFields or HardDelete.`;
|
|
297
|
+
}
|
|
298
|
+
if (entityInfo.TrackRecordChanges) {
|
|
299
|
+
return `Entity "${entityName}" tracks Record Changes, so purging it would copy the cleared values into Record Changes. Turn off TrackRecordChanges for the entity or use StorageMode Store.`;
|
|
300
|
+
}
|
|
301
|
+
const driver = ResolveArchiveDriver(configEntity.DriverClass);
|
|
302
|
+
if (!driver) {
|
|
303
|
+
return `Archive driver "${configEntity.DriverClass}" for entity "${entityName}" is not registered. Register the driver class or clear DriverClass to use the default driver.`;
|
|
304
|
+
}
|
|
305
|
+
if (!driver.SupportsPurge) {
|
|
306
|
+
return `The archive driver for entity "${entityName}" does not support StorageMode Purge.`;
|
|
307
|
+
}
|
|
308
|
+
return mode === 'HardDelete' ? this.findHardDeleteBlocker(entityInfo) : null;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Returns why a HardDelete purge of the entity cannot run, or null when it can: the
|
|
312
|
+
* entity must not use soft delete, and no entity its delete cascade reaches may track
|
|
313
|
+
* Record Changes, use soft delete, or be missing from metadata.
|
|
314
|
+
*/
|
|
315
|
+
findHardDeleteBlocker(entityInfo) {
|
|
316
|
+
if (entityInfo.DeleteType === 'Soft') {
|
|
317
|
+
return `Entity "${entityInfo.Name}" uses soft delete, so HardDelete would keep its rows. Use Mode StripFields, turn off soft delete for the entity, or use StorageMode Store.`;
|
|
318
|
+
}
|
|
319
|
+
const blocked = this.findBlockedCascadeEntity(entityInfo);
|
|
320
|
+
if (!blocked) {
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
return `Entity "${entityInfo.Name}" cannot be purged with HardDelete: dependent entity "${blocked.Name}" ${blocked.Reason}`;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Walks the HardDelete cascade of the entity (the same One To Many relationships the
|
|
327
|
+
* default driver deletes, excluding self references) and returns the first reachable
|
|
328
|
+
* entity that blocks a purge, with the reason, or null.
|
|
329
|
+
*/
|
|
330
|
+
findBlockedCascadeEntity(entityInfo, visited = new Set()) {
|
|
331
|
+
visited.add(entityInfo.ID);
|
|
332
|
+
const cascadeRels = entityInfo.RelatedEntities.filter(r => r.Type?.trim() === 'One To Many' && r.RelatedEntityID !== entityInfo.ID);
|
|
333
|
+
for (const rel of cascadeRels) {
|
|
334
|
+
if (!rel.RelatedEntity || !rel.RelatedEntityJoinField || visited.has(rel.RelatedEntityID)) {
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
const child = this.Provider.EntityByName(rel.RelatedEntity);
|
|
338
|
+
const reason = this.cascadeBlockReason(child);
|
|
339
|
+
if (reason) {
|
|
340
|
+
return { Name: child?.Name ?? rel.RelatedEntity, Reason: reason };
|
|
341
|
+
}
|
|
342
|
+
const deeper = child ? this.findBlockedCascadeEntity(child, visited) : null;
|
|
343
|
+
if (deeper) {
|
|
344
|
+
return deeper;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Returns why an entity reached by a HardDelete cascade blocks a purge, or null when
|
|
351
|
+
* it does not. The reason completes a sentence that names the dependent entity.
|
|
352
|
+
*/
|
|
353
|
+
cascadeBlockReason(entityInfo) {
|
|
354
|
+
if (!entityInfo) {
|
|
355
|
+
return 'was not found in metadata, so its rows cannot be checked before they are deleted.';
|
|
356
|
+
}
|
|
357
|
+
if (entityInfo.TrackRecordChanges) {
|
|
358
|
+
return 'tracks Record Changes, so deleting it would copy its rows into Record Changes. Turn off TrackRecordChanges for the dependent entity, use Mode StripFields, or use StorageMode Store.';
|
|
359
|
+
}
|
|
360
|
+
if (entityInfo.DeleteType === 'Soft') {
|
|
361
|
+
return 'uses soft delete, so HardDelete would keep its rows. Turn off soft delete for the dependent entity, use Mode StripFields, or use StorageMode Store.';
|
|
362
|
+
}
|
|
363
|
+
return null;
|
|
201
364
|
}
|
|
202
365
|
// ========================================
|
|
203
366
|
// Helpers
|
|
204
367
|
// ========================================
|
|
205
368
|
/**
|
|
206
|
-
* Builds a failure ArchiveRunResult with zero counts.
|
|
369
|
+
* Builds a failure ArchiveRunResult with zero counts. StorageMode is set only when
|
|
370
|
+
* the configuration loaded.
|
|
371
|
+
*/
|
|
372
|
+
/**
|
|
373
|
+
* Builds a failed result. Totals, when given, are the counts of the entities
|
|
374
|
+
* processed before the failure.
|
|
207
375
|
*/
|
|
208
|
-
buildFailureResult(archiveRunId, errorMessage) {
|
|
376
|
+
buildFailureResult(archiveRunId, errorMessage, storageMode, totals) {
|
|
377
|
+
const counts = totals ?? { Archived: 0, Failed: 0, Skipped: 0, Bytes: 0 };
|
|
209
378
|
return {
|
|
210
379
|
Success: false,
|
|
211
380
|
ArchiveRunId: archiveRunId,
|
|
212
|
-
TotalRecords:
|
|
213
|
-
ArchivedRecords:
|
|
214
|
-
FailedRecords:
|
|
215
|
-
SkippedRecords:
|
|
216
|
-
TotalBytesArchived:
|
|
381
|
+
TotalRecords: counts.Archived + counts.Failed + counts.Skipped,
|
|
382
|
+
ArchivedRecords: counts.Archived,
|
|
383
|
+
FailedRecords: counts.Failed,
|
|
384
|
+
SkippedRecords: counts.Skipped,
|
|
385
|
+
TotalBytesArchived: counts.Bytes,
|
|
217
386
|
ErrorMessage: errorMessage,
|
|
387
|
+
StorageMode: storageMode,
|
|
218
388
|
};
|
|
219
389
|
}
|
|
220
390
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArchiveEngine.js","sourceRoot":"","sources":["../src/ArchiveEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAqB,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACrI,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAA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berjunction/core';
|
|
2
2
|
import { ArchiveStorageManager } from './ArchiveStorageManager.js';
|
|
3
|
+
import type { MJArchiveConfigurationEntity, MJArchiveConfigurationEntityEntity, MJArchiveRunEntity } from '@memberjunction/core-entities';
|
|
3
4
|
/**
|
|
4
5
|
* Result of processing a single entity within an archive run.
|
|
5
6
|
*/
|
|
@@ -25,20 +26,16 @@ export declare class ArchiveProcessor {
|
|
|
25
26
|
get Provider(): IMetadataProvider;
|
|
26
27
|
/**
|
|
27
28
|
* Processes all eligible records for a single entity configuration.
|
|
29
|
+
* Throws before any record is read when the configured DriverClass is not registered.
|
|
28
30
|
*
|
|
29
31
|
* @param configEntity - The ArchiveConfigurationEntity record defining which entity/fields to archive
|
|
30
32
|
* @param config - The parent ArchiveConfiguration record
|
|
31
33
|
* @param archiveRun - The current ArchiveRun record for logging
|
|
32
|
-
* @param storageManager - Initialized storage manager for writing documents
|
|
34
|
+
* @param storageManager - Initialized storage manager for writing documents; null when StorageMode is 'Purge'
|
|
33
35
|
* @param contextUser - User context for all database operations
|
|
34
36
|
* @returns Aggregated counts and bytes for this entity
|
|
35
37
|
*/
|
|
36
|
-
ProcessEntity(configEntity:
|
|
37
|
-
/**
|
|
38
|
-
* Resolves the archive driver by class name via ClassFactory, falling back
|
|
39
|
-
* to DefaultArchiveDriver if no class name is specified or resolution fails.
|
|
40
|
-
*/
|
|
41
|
-
private resolveDriver;
|
|
38
|
+
ProcessEntity(configEntity: MJArchiveConfigurationEntityEntity, config: MJArchiveConfigurationEntity, archiveRun: MJArchiveRunEntity, storageManager: ArchiveStorageManager | null, contextUser: UserInfo): Promise<EntityProcessingResult>;
|
|
42
39
|
/**
|
|
43
40
|
* Parses the FieldConfiguration JSON column from the ArchiveConfigurationEntity record.
|
|
44
41
|
* The FieldConfiguration column is NVARCHAR(MAX) storing JSON conforming to ArchiveFieldConfiguration.
|
|
@@ -49,8 +46,9 @@ export declare class ArchiveProcessor {
|
|
|
49
46
|
*/
|
|
50
47
|
private validateFieldConfiguration;
|
|
51
48
|
/**
|
|
52
|
-
* Builds the SQL filter expression for querying eligible records
|
|
53
|
-
*
|
|
49
|
+
* Builds the SQL filter expression for querying eligible records: the retention cutoff
|
|
50
|
+
* (the entity's RetentionDays, else the configuration's DefaultRetentionDays) plus any
|
|
51
|
+
* custom filter expression. Throws when the resolved retention period is negative.
|
|
54
52
|
*/
|
|
55
53
|
private buildRecordFilter;
|
|
56
54
|
/**
|
|
@@ -62,7 +60,8 @@ export declare class ArchiveProcessor {
|
|
|
62
60
|
*/
|
|
63
61
|
private getBatchSize;
|
|
64
62
|
/**
|
|
65
|
-
* Processes records in batches, calling the driver for each record
|
|
63
|
+
* Processes records in batches, calling the driver for each record. An ArchiveRunDetail
|
|
64
|
+
* is logged for every record on Store runs and only for failed records on Purge runs.
|
|
66
65
|
*/
|
|
67
66
|
private processRecordBatches;
|
|
68
67
|
/**
|
|
@@ -70,10 +69,16 @@ export declare class ArchiveProcessor {
|
|
|
70
69
|
*/
|
|
71
70
|
private processSingleBatch;
|
|
72
71
|
/**
|
|
73
|
-
* Processes a single record: checks eligibility, archives, and logs
|
|
72
|
+
* Processes a single record: checks eligibility, archives, and logs an ArchiveRunDetail
|
|
73
|
+
* (always on Store runs, only on failure on Purge runs).
|
|
74
74
|
* Returns 'skipped', 'failed', or the number of bytes archived.
|
|
75
75
|
*/
|
|
76
76
|
private processSingleRecord;
|
|
77
|
+
/**
|
|
78
|
+
* Store runs log a detail for every record. Purge runs keep no copy, so they log
|
|
79
|
+
* failed records only. Any value other than Purge is treated as Store.
|
|
80
|
+
*/
|
|
81
|
+
private shouldLogRunDetail;
|
|
77
82
|
/**
|
|
78
83
|
* Creates an ArchiveRunDetail record to log the result of archiving a single record.
|
|
79
84
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArchiveProcessor.d.ts","sourceRoot":"","sources":["../src/ArchiveProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":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