@memberjunction/metadata-sync 3.4.0 → 4.1.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.
Files changed (130) hide show
  1. package/README.md +907 -2200
  2. package/dist/config.d.ts +1 -0
  3. package/dist/config.d.ts.map +1 -0
  4. package/dist/config.js +17 -27
  5. package/dist/config.js.map +1 -1
  6. package/dist/constants/metadata-keywords.d.ts +1 -0
  7. package/dist/constants/metadata-keywords.d.ts.map +1 -0
  8. package/dist/constants/metadata-keywords.js +31 -42
  9. package/dist/constants/metadata-keywords.js.map +1 -1
  10. package/dist/index.d.ts +39 -37
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +26 -62
  13. package/dist/index.js.map +1 -1
  14. package/dist/lib/EntityPropertyExtractor.d.ts +1 -0
  15. package/dist/lib/EntityPropertyExtractor.d.ts.map +1 -0
  16. package/dist/lib/EntityPropertyExtractor.js +1 -5
  17. package/dist/lib/EntityPropertyExtractor.js.map +1 -1
  18. package/dist/lib/FieldExternalizer.d.ts +1 -0
  19. package/dist/lib/FieldExternalizer.d.ts.map +1 -0
  20. package/dist/lib/FieldExternalizer.js +14 -21
  21. package/dist/lib/FieldExternalizer.js.map +1 -1
  22. package/dist/lib/RecordProcessor.d.ts +3 -2
  23. package/dist/lib/RecordProcessor.d.ts.map +1 -0
  24. package/dist/lib/RecordProcessor.js +16 -25
  25. package/dist/lib/RecordProcessor.js.map +1 -1
  26. package/dist/lib/RelatedEntityHandler.d.ts +3 -2
  27. package/dist/lib/RelatedEntityHandler.d.ts.map +1 -0
  28. package/dist/lib/RelatedEntityHandler.js +3 -9
  29. package/dist/lib/RelatedEntityHandler.js.map +1 -1
  30. package/dist/lib/config-manager.d.ts +2 -1
  31. package/dist/lib/config-manager.d.ts.map +1 -0
  32. package/dist/lib/config-manager.js +10 -15
  33. package/dist/lib/config-manager.js.map +1 -1
  34. package/dist/lib/database-reference-scanner.d.ts +3 -2
  35. package/dist/lib/database-reference-scanner.d.ts.map +1 -0
  36. package/dist/lib/database-reference-scanner.js +7 -13
  37. package/dist/lib/database-reference-scanner.js.map +1 -1
  38. package/dist/lib/deletion-auditor.d.ts +18 -3
  39. package/dist/lib/deletion-auditor.d.ts.map +1 -0
  40. package/dist/lib/deletion-auditor.js +111 -20
  41. package/dist/lib/deletion-auditor.js.map +1 -1
  42. package/dist/lib/deletion-report-generator.d.ts +2 -1
  43. package/dist/lib/deletion-report-generator.d.ts.map +1 -0
  44. package/dist/lib/deletion-report-generator.js +1 -5
  45. package/dist/lib/deletion-report-generator.js.map +1 -1
  46. package/dist/lib/entity-foreign-key-helper.d.ts +1 -0
  47. package/dist/lib/entity-foreign-key-helper.d.ts.map +1 -0
  48. package/dist/lib/entity-foreign-key-helper.js +1 -5
  49. package/dist/lib/entity-foreign-key-helper.js.map +1 -1
  50. package/dist/lib/file-backup-manager.d.ts +1 -0
  51. package/dist/lib/file-backup-manager.d.ts.map +1 -0
  52. package/dist/lib/file-backup-manager.js +22 -27
  53. package/dist/lib/file-backup-manager.js.map +1 -1
  54. package/dist/lib/file-write-batch.d.ts +2 -1
  55. package/dist/lib/file-write-batch.d.ts.map +1 -0
  56. package/dist/lib/file-write-batch.js +16 -21
  57. package/dist/lib/file-write-batch.js.map +1 -1
  58. package/dist/lib/json-preprocessor.d.ts +1 -0
  59. package/dist/lib/json-preprocessor.d.ts.map +1 -0
  60. package/dist/lib/json-preprocessor.js +21 -26
  61. package/dist/lib/json-preprocessor.js.map +1 -1
  62. package/dist/lib/json-write-helper.d.ts +2 -1
  63. package/dist/lib/json-write-helper.d.ts.map +1 -0
  64. package/dist/lib/json-write-helper.js +4 -11
  65. package/dist/lib/json-write-helper.js.map +1 -1
  66. package/dist/lib/provider-utils.d.ts +2 -1
  67. package/dist/lib/provider-utils.d.ts.map +1 -0
  68. package/dist/lib/provider-utils.js +15 -46
  69. package/dist/lib/provider-utils.js.map +1 -1
  70. package/dist/lib/record-dependency-analyzer.d.ts +41 -2
  71. package/dist/lib/record-dependency-analyzer.d.ts.map +1 -0
  72. package/dist/lib/record-dependency-analyzer.js +108 -40
  73. package/dist/lib/record-dependency-analyzer.js.map +1 -1
  74. package/dist/lib/singleton-manager.d.ts +2 -1
  75. package/dist/lib/singleton-manager.d.ts.map +1 -0
  76. package/dist/lib/singleton-manager.js +4 -9
  77. package/dist/lib/singleton-manager.js.map +1 -1
  78. package/dist/lib/sql-logger.d.ts +2 -1
  79. package/dist/lib/sql-logger.d.ts.map +1 -0
  80. package/dist/lib/sql-logger.js +8 -16
  81. package/dist/lib/sql-logger.js.map +1 -1
  82. package/dist/lib/sync-engine.d.ts +2 -1
  83. package/dist/lib/sync-engine.d.ts.map +1 -0
  84. package/dist/lib/sync-engine.js +58 -76
  85. package/dist/lib/sync-engine.js.map +1 -1
  86. package/dist/lib/transaction-manager.d.ts +2 -1
  87. package/dist/lib/transaction-manager.d.ts.map +1 -0
  88. package/dist/lib/transaction-manager.js +6 -11
  89. package/dist/lib/transaction-manager.js.map +1 -1
  90. package/dist/services/FileResetService.d.ts +1 -0
  91. package/dist/services/FileResetService.d.ts.map +1 -0
  92. package/dist/services/FileResetService.js +17 -24
  93. package/dist/services/FileResetService.js.map +1 -1
  94. package/dist/services/FormattingService.d.ts +2 -1
  95. package/dist/services/FormattingService.d.ts.map +1 -0
  96. package/dist/services/FormattingService.js +68 -73
  97. package/dist/services/FormattingService.js.map +1 -1
  98. package/dist/services/InitService.d.ts +1 -0
  99. package/dist/services/InitService.d.ts.map +1 -0
  100. package/dist/services/InitService.js +12 -19
  101. package/dist/services/InitService.js.map +1 -1
  102. package/dist/services/PullService.d.ts +2 -1
  103. package/dist/services/PullService.d.ts.map +1 -0
  104. package/dist/services/PullService.js +49 -60
  105. package/dist/services/PullService.js.map +1 -1
  106. package/dist/services/PushService.d.ts +3 -1
  107. package/dist/services/PushService.d.ts.map +1 -0
  108. package/dist/services/PushService.js +144 -95
  109. package/dist/services/PushService.js.map +1 -1
  110. package/dist/services/StatusService.d.ts +2 -1
  111. package/dist/services/StatusService.d.ts.map +1 -0
  112. package/dist/services/StatusService.js +14 -22
  113. package/dist/services/StatusService.js.map +1 -1
  114. package/dist/services/ValidationService.d.ts +2 -1
  115. package/dist/services/ValidationService.d.ts.map +1 -0
  116. package/dist/services/ValidationService.js +41 -71
  117. package/dist/services/ValidationService.js.map +1 -1
  118. package/dist/services/WatchService.d.ts +4 -3
  119. package/dist/services/WatchService.d.ts.map +1 -0
  120. package/dist/services/WatchService.js +35 -43
  121. package/dist/services/WatchService.js.map +1 -1
  122. package/dist/services/index.d.ts +9 -8
  123. package/dist/services/index.d.ts.map +1 -0
  124. package/dist/services/index.js +8 -19
  125. package/dist/services/index.js.map +1 -1
  126. package/dist/types/validation.d.ts +2 -1
  127. package/dist/types/validation.d.ts.map +1 -0
  128. package/dist/types/validation.js +2 -23
  129. package/dist/types/validation.js.map +1 -1
  130. package/package.json +23 -21
@@ -1,42 +1,111 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RecordDependencyAnalyzer = void 0;
4
- const core_1 = require("@memberjunction/core");
5
- const metadata_keywords_1 = require("../constants/metadata-keywords");
1
+ import { Metadata } from '@memberjunction/core';
2
+ import { METADATA_KEYWORDS } from '../constants/metadata-keywords.js';
6
3
  /**
7
4
  * Analyzes and sorts records based on their dependencies
8
5
  */
9
- class RecordDependencyAnalyzer {
10
- metadata;
11
- flattenedRecords = [];
12
- recordIdMap = new Map();
13
- entityInfoCache = new Map();
14
- recordCounter = 0;
6
+ export class RecordDependencyAnalyzer {
15
7
  constructor() {
16
- this.metadata = new core_1.Metadata();
8
+ this.flattenedRecords = [];
9
+ this.recordIdMap = new Map();
10
+ this.entityInfoCache = new Map();
11
+ this.recordCounter = 0;
12
+ this.metadata = new Metadata();
17
13
  }
18
14
  /**
19
- * Main entry point: analyzes all records in a file and returns them in dependency order
15
+ * Phase 1: Flatten records from a single file without analyzing dependencies.
16
+ *
17
+ * This method flattens records including nested relatedEntities and assigns unique IDs,
18
+ * but does NOT analyze dependencies. Use this when collecting records from multiple files
19
+ * before running global dependency analysis.
20
+ *
21
+ * After collecting records from all files, call `analyzeAllDependencies()` to resolve
22
+ * cross-file dependencies.
23
+ *
24
+ * @param records The records from a metadata file
25
+ * @param entityName The root entity name for these records
26
+ * @returns Flattened records (dependencies not yet resolved)
20
27
  */
21
- async analyzeFileRecords(records, entityName) {
22
- // Reset state
28
+ flattenFileRecords(records, entityName) {
29
+ // Store the starting index to return only the newly added records
30
+ const startIndex = this.flattenedRecords.length;
31
+ // Flatten records (this adds to this.flattenedRecords and this.recordIdMap)
32
+ this.flattenRecords(records, entityName);
33
+ // Return only the records added from this file
34
+ return this.flattenedRecords.slice(startIndex);
35
+ }
36
+ /**
37
+ * Phase 2: Analyze dependencies across all collected records globally.
38
+ *
39
+ * This method should be called AFTER all files have been processed with `flattenFileRecords()`.
40
+ * It resolves @lookup, @parent, @root references and foreign key dependencies across
41
+ * ALL records, enabling correct cross-file dependency detection.
42
+ *
43
+ * @param allRecords All flattened records from all metadata files
44
+ * @returns Analysis result with sorted records, circular dependencies, etc.
45
+ */
46
+ analyzeAllDependencies(allRecords) {
47
+ // Set up state from the provided records
48
+ this.flattenedRecords = allRecords;
49
+ this.recordIdMap.clear();
50
+ for (const record of allRecords) {
51
+ this.recordIdMap.set(record.id, record);
52
+ }
53
+ // Analyze dependencies between ALL records (enables cross-file dependency detection)
54
+ this.analyzeDependencies();
55
+ // Detect circular dependencies
56
+ const circularDeps = this.detectCircularDependencies();
57
+ // Perform topological sort
58
+ const sortedRecords = this.topologicalSort();
59
+ // Build dependency graph for debugging
60
+ const dependencyGraph = new Map();
61
+ for (const record of this.flattenedRecords) {
62
+ dependencyGraph.set(record.id, record.dependencies);
63
+ }
64
+ // Group records into dependency levels for parallel processing
65
+ const dependencyLevels = this.groupByDependencyLevels(sortedRecords, dependencyGraph);
66
+ return {
67
+ sortedRecords,
68
+ circularDependencies: circularDeps,
69
+ dependencyGraph,
70
+ dependencyLevels
71
+ };
72
+ }
73
+ /**
74
+ * Resets the analyzer state. Call this before starting a new batch of files.
75
+ */
76
+ reset() {
23
77
  this.flattenedRecords = [];
24
78
  this.recordIdMap.clear();
25
79
  this.recordCounter = 0;
26
- // Step 1: Flatten all records (including nested relatedEntities)
80
+ }
81
+ /**
82
+ * Main entry point: analyzes all records in a file and returns them in dependency order.
83
+ *
84
+ * @deprecated Use `flattenFileRecords()` + `analyzeAllDependencies()` for multi-file scenarios
85
+ * to enable cross-file dependency detection. This method only detects dependencies within
86
+ * a single file.
87
+ *
88
+ * @param records The records from a metadata file
89
+ * @param entityName The root entity name for these records
90
+ * @returns Analysis result with sorted records
91
+ */
92
+ async analyzeFileRecords(records, entityName) {
93
+ // Reset state for single-file analysis (backward compatible behavior)
94
+ this.reset();
95
+ // Flatten records
27
96
  this.flattenRecords(records, entityName);
28
- // Step 2: Analyze dependencies between all flattened records
97
+ // Analyze dependencies (only within this file's records)
29
98
  this.analyzeDependencies();
30
- // Step 3: Detect circular dependencies
99
+ // Detect circular dependencies
31
100
  const circularDeps = this.detectCircularDependencies();
32
- // Step 4: Perform topological sort
101
+ // Perform topological sort
33
102
  const sortedRecords = this.topologicalSort();
34
- // Step 5: Build dependency graph for debugging
103
+ // Build dependency graph for debugging
35
104
  const dependencyGraph = new Map();
36
105
  for (const record of this.flattenedRecords) {
37
106
  dependencyGraph.set(record.id, record.dependencies);
38
107
  }
39
- // Step 6: Group records into dependency levels for parallel processing
108
+ // Group records into dependency levels for parallel processing
40
109
  const dependencyLevels = this.groupByDependencyLevels(sortedRecords, dependencyGraph);
41
110
  return {
42
111
  sortedRecords,
@@ -102,14 +171,14 @@ class RecordDependencyAnalyzer {
102
171
  for (const [fieldName, fieldValue] of Object.entries(record.record.fields)) {
103
172
  if (typeof fieldValue === 'string') {
104
173
  // Handle @lookup references
105
- if (fieldValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.LOOKUP)) {
174
+ if (fieldValue.startsWith(METADATA_KEYWORDS.LOOKUP)) {
106
175
  const dependency = this.findLookupDependency(fieldValue, record);
107
176
  if (dependency) {
108
177
  record.dependencies.add(dependency);
109
178
  }
110
179
  }
111
180
  // Handle @root references - these create dependencies on the root record
112
- else if (fieldValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.ROOT)) {
181
+ else if (fieldValue.startsWith(METADATA_KEYWORDS.ROOT)) {
113
182
  const rootDependency = this.findRootDependency(record);
114
183
  if (rootDependency) {
115
184
  record.dependencies.add(rootDependency);
@@ -173,7 +242,7 @@ class RecordDependencyAnalyzer {
173
242
  let resolvedValue = value.trim();
174
243
  // Special handling for nested @lookup references in lookup criteria
175
244
  // This creates a dependency on the looked-up record
176
- if (resolvedValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.LOOKUP)) {
245
+ if (resolvedValue.startsWith(METADATA_KEYWORDS.LOOKUP)) {
177
246
  const nestedDependency = this.findLookupDependency(resolvedValue, currentRecord);
178
247
  if (nestedDependency) {
179
248
  // Add this as a dependency of the current record
@@ -183,7 +252,7 @@ class RecordDependencyAnalyzer {
183
252
  }
184
253
  }
185
254
  // Special handling for @root references in lookup criteria
186
- else if (resolvedValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.ROOT)) {
255
+ else if (resolvedValue.startsWith(METADATA_KEYWORDS.ROOT)) {
187
256
  // Add dependency on root record
188
257
  const rootDep = this.findRootDependency(currentRecord);
189
258
  if (rootDep) {
@@ -193,19 +262,19 @@ class RecordDependencyAnalyzer {
193
262
  }
194
263
  // Special handling for @parent references in lookup criteria
195
264
  // If the value is @parent:field, we need to resolve it from the parent context
196
- else if (resolvedValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.PARENT) && currentRecord.parentContext) {
197
- const parentField = resolvedValue.substring(metadata_keywords_1.METADATA_KEYWORDS.PARENT.length);
265
+ else if (resolvedValue.startsWith(METADATA_KEYWORDS.PARENT) && currentRecord.parentContext) {
266
+ const parentField = resolvedValue.substring(METADATA_KEYWORDS.PARENT.length);
198
267
  // Try to resolve from parent context
199
268
  const parentValue = currentRecord.parentContext.record.fields?.[parentField] ||
200
269
  currentRecord.parentContext.record.primaryKey?.[parentField];
201
270
  if (parentValue && typeof parentValue === 'string') {
202
271
  // Check if parent value is also a @parent reference (nested parent refs)
203
- if (parentValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.PARENT)) {
272
+ if (parentValue.startsWith(METADATA_KEYWORDS.PARENT)) {
204
273
  // Find the parent record to get its parent context
205
274
  const parentRecord = this.flattenedRecords.find(r => r.record === currentRecord.parentContext.record &&
206
275
  r.entityName === currentRecord.parentContext.entityName);
207
276
  if (parentRecord && parentRecord.parentContext) {
208
- const grandParentField = parentValue.substring(metadata_keywords_1.METADATA_KEYWORDS.PARENT.length);
277
+ const grandParentField = parentValue.substring(METADATA_KEYWORDS.PARENT.length);
209
278
  const grandParentValue = parentRecord.parentContext.record.fields?.[grandParentField] ||
210
279
  parentRecord.parentContext.record.primaryKey?.[grandParentField];
211
280
  if (grandParentValue && typeof grandParentValue === 'string' && !grandParentValue.startsWith('@')) {
@@ -234,12 +303,12 @@ class RecordDependencyAnalyzer {
234
303
  candidate.record.primaryKey?.[field];
235
304
  let lookupValue = value;
236
305
  // Resolve candidate value if it's a @parent reference
237
- if (typeof candidateValue === 'string' && candidateValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.PARENT) && candidate.parentContext) {
238
- const parentField = candidateValue.substring(metadata_keywords_1.METADATA_KEYWORDS.PARENT.length);
306
+ if (typeof candidateValue === 'string' && candidateValue.startsWith(METADATA_KEYWORDS.PARENT) && candidate.parentContext) {
307
+ const parentField = candidateValue.substring(METADATA_KEYWORDS.PARENT.length);
239
308
  const parentRecord = candidate.parentContext.record;
240
309
  candidateValue = parentRecord.fields?.[parentField] || parentRecord.primaryKey?.[parentField];
241
310
  // If the parent field is also a @parent reference, resolve it recursively
242
- if (typeof candidateValue === 'string' && candidateValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.PARENT)) {
311
+ if (typeof candidateValue === 'string' && candidateValue.startsWith(METADATA_KEYWORDS.PARENT)) {
243
312
  // Find the candidate's parent in our flattened list
244
313
  const candidateParent = this.flattenedRecords.find(r => r.record === candidate.parentContext.record &&
245
314
  r.entityName === candidate.parentContext.entityName);
@@ -251,18 +320,18 @@ class RecordDependencyAnalyzer {
251
320
  }
252
321
  }
253
322
  // Resolve lookup value if it contains @parent reference
254
- if (typeof lookupValue === 'string' && lookupValue.includes(metadata_keywords_1.METADATA_KEYWORDS.PARENT)) {
323
+ if (typeof lookupValue === 'string' && lookupValue.includes(METADATA_KEYWORDS.PARENT)) {
255
324
  // Handle cases like "@parent:AgentID" or embedded references
256
- if (lookupValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.PARENT) && currentRecord.parentContext) {
257
- const parentField = lookupValue.substring(metadata_keywords_1.METADATA_KEYWORDS.PARENT.length);
325
+ if (lookupValue.startsWith(METADATA_KEYWORDS.PARENT) && currentRecord.parentContext) {
326
+ const parentField = lookupValue.substring(METADATA_KEYWORDS.PARENT.length);
258
327
  lookupValue = currentRecord.parentContext.record.fields?.[parentField] ||
259
328
  currentRecord.parentContext.record.primaryKey?.[parentField];
260
329
  // If still a reference, try to resolve from the parent's parent
261
- if (typeof lookupValue === 'string' && lookupValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.PARENT)) {
330
+ if (typeof lookupValue === 'string' && lookupValue.startsWith(METADATA_KEYWORDS.PARENT)) {
262
331
  const currentParent = this.flattenedRecords.find(r => r.record === currentRecord.parentContext.record &&
263
332
  r.entityName === currentRecord.parentContext.entityName);
264
333
  if (currentParent?.parentContext) {
265
- const grandParentField = lookupValue.substring(metadata_keywords_1.METADATA_KEYWORDS.PARENT.length);
334
+ const grandParentField = lookupValue.substring(METADATA_KEYWORDS.PARENT.length);
266
335
  lookupValue = currentParent.parentContext.record.fields?.[grandParentField] ||
267
336
  currentParent.parentContext.record.primaryKey?.[grandParentField];
268
337
  }
@@ -271,7 +340,7 @@ class RecordDependencyAnalyzer {
271
340
  }
272
341
  // Special case: if both values are @parent references pointing to the same parent field,
273
342
  // and they have the same parent context, they match
274
- if (value.startsWith(metadata_keywords_1.METADATA_KEYWORDS.PARENT) && candidateValue === value &&
343
+ if (value.startsWith(METADATA_KEYWORDS.PARENT) && candidateValue === value &&
275
344
  currentRecord.parentContext && candidate.parentContext) {
276
345
  // Check if they share the same parent
277
346
  if (currentRecord.parentContext.record === candidate.parentContext.record) {
@@ -509,7 +578,7 @@ class RecordDependencyAnalyzer {
509
578
  // Check if this field references the dependent record
510
579
  if (fieldValue && typeof fieldValue === 'string') {
511
580
  // Handle @lookup references
512
- if (fieldValue.startsWith(metadata_keywords_1.METADATA_KEYWORDS.LOOKUP)) {
581
+ if (fieldValue.startsWith(METADATA_KEYWORDS.LOOKUP)) {
513
582
  const resolvedDep = this.findLookupDependency(fieldValue, record);
514
583
  if (resolvedDep === dependencyId) {
515
584
  return field.Name;
@@ -599,5 +668,4 @@ class RecordDependencyAnalyzer {
599
668
  return dependents;
600
669
  }
601
670
  }
602
- exports.RecordDependencyAnalyzer = RecordDependencyAnalyzer;
603
671
  //# sourceMappingURL=record-dependency-analyzer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"record-dependency-analyzer.js","sourceRoot":"","sources":["../../src/lib/record-dependency-analyzer.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAE5D,sEAAyF;AA0CzF;;GAEG;AACH,MAAa,wBAAwB;IAC3B,QAAQ,CAAW;IACnB,gBAAgB,GAAsB,EAAE,CAAC;IACzC,WAAW,GAAiC,IAAI,GAAG,EAAE,CAAC;IACtD,eAAe,GAA4B,IAAI,GAAG,EAAE,CAAC;IACrD,aAAa,GAAW,CAAC,CAAC;IAElC;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAQ,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,kBAAkB,CAC7B,OAAqB,EACrB,UAAkB;QAElB,cAAc;QACd,IAA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/core';\nimport { RecordData } from './sync-engine';\nimport { METADATA_KEYWORDS, isNonKeywordAtSymbol } from '../constants/metadata-keywords';\n\n/**\n * Represents a flattened record with its context and dependencies\n */\nexport interface FlattenedRecord {\n record: RecordData;\n entityName: string;\n parentContext?: {\n entityName: string;\n record: RecordData;\n recordIndex: number;\n };\n depth: number;\n path: string; // Path to this record for debugging\n dependencies: Set<string>; // Set of record IDs this record depends on\n id: string; // Unique identifier for this record in the flattened list\n originalIndex: number; // Original index in the source array\n}\n\n/**\n * Represents a reverse dependency relationship\n * (which records depend on a given record)\n */\nexport interface ReverseDependency {\n recordId: string; // The record being referenced\n dependentId: string; // The record that depends on it\n entityName: string; // Entity of the dependent\n fieldName: string | null; // Foreign key field name (if known)\n filePath: string; // Location of dependent record\n}\n\n/**\n * Result of dependency analysis\n */\nexport interface DependencyAnalysisResult {\n sortedRecords: FlattenedRecord[];\n circularDependencies: string[][];\n dependencyGraph: Map<string, Set<string>>;\n dependencyLevels?: FlattenedRecord[][]; // Records grouped by dependency level for parallel processing\n}\n\n/**\n * Analyzes and sorts records based on their dependencies\n */\nexport class RecordDependencyAnalyzer {\n private metadata: Metadata;\n private flattenedRecords: FlattenedRecord[] = [];\n private recordIdMap: Map<string, FlattenedRecord> = new Map();\n private entityInfoCache: Map<string, EntityInfo> = new Map();\n private recordCounter: number = 0;\n\n constructor() {\n this.metadata = new Metadata();\n }\n\n /**\n * Main entry point: analyzes all records in a file and returns them in dependency order\n */\n public async analyzeFileRecords(\n records: RecordData[],\n entityName: string\n ): Promise<DependencyAnalysisResult> {\n // Reset state\n this.flattenedRecords = [];\n this.recordIdMap.clear();\n this.recordCounter = 0;\n\n // Step 1: Flatten all records (including nested relatedEntities)\n this.flattenRecords(records, entityName);\n\n // Step 2: Analyze dependencies between all flattened records\n this.analyzeDependencies();\n\n // Step 3: Detect circular dependencies\n const circularDeps = this.detectCircularDependencies();\n\n // Step 4: Perform topological sort\n const sortedRecords = this.topologicalSort();\n\n // Step 5: Build dependency graph for debugging\n const dependencyGraph = new Map<string, Set<string>>();\n for (const record of this.flattenedRecords) {\n dependencyGraph.set(record.id, record.dependencies);\n }\n\n // Step 6: Group records into dependency levels for parallel processing\n const dependencyLevels = this.groupByDependencyLevels(sortedRecords, dependencyGraph);\n\n return {\n sortedRecords,\n circularDependencies: circularDeps,\n dependencyGraph,\n dependencyLevels\n };\n }\n\n /**\n * Flattens all records including nested relatedEntities\n */\n private flattenRecords(\n records: RecordData[],\n entityName: string,\n parentContext?: FlattenedRecord['parentContext'],\n depth: number = 0,\n pathPrefix: string = '',\n parentRecordId?: string\n ): void {\n for (let i = 0; i < records.length; i++) {\n const record = records[i];\n const recordId = `${entityName}_${this.recordCounter++}`;\n const path = pathPrefix ? `${pathPrefix}/${entityName}[${i}]` : `${entityName}[${i}]`;\n\n // Validate that the record has a 'fields' property (required)\n if (!record.fields) {\n const hint = 'field' in record ? ' Did you mean \"fields\" instead of \"field\"?' : '';\n throw new Error(\n `Record at ${path} is missing required \"fields\" property.${hint} ` +\n `Each record must have a \"fields\" object containing the entity field values.`\n );\n }\n\n const flattenedRecord: FlattenedRecord = {\n record,\n entityName,\n parentContext,\n depth,\n path,\n dependencies: new Set(),\n id: recordId,\n originalIndex: i\n };\n\n // If this has a parent, add dependency on the parent\n if (parentRecordId) {\n flattenedRecord.dependencies.add(parentRecordId);\n }\n\n this.flattenedRecords.push(flattenedRecord);\n this.recordIdMap.set(recordId, flattenedRecord);\n\n // Recursively flatten related entities\n if (record.relatedEntities) {\n for (const [relatedEntityName, relatedRecords] of Object.entries(record.relatedEntities)) {\n this.flattenRecords(\n relatedRecords,\n relatedEntityName,\n {\n entityName,\n record,\n recordIndex: i\n },\n depth + 1,\n path,\n recordId // Pass current record ID as parent for children\n );\n }\n }\n }\n }\n\n /**\n * Analyzes dependencies between all flattened records\n */\n private analyzeDependencies(): void {\n for (const record of this.flattenedRecords) {\n // Get entity info for foreign key relationships\n const entityInfo = this.getEntityInfo(record.entityName);\n if (!entityInfo) continue;\n\n // Analyze field dependencies\n if (record.record.fields) {\n for (const [fieldName, fieldValue] of Object.entries(record.record.fields)) {\n if (typeof fieldValue === 'string') {\n // Handle @lookup references\n if (fieldValue.startsWith(METADATA_KEYWORDS.LOOKUP)) {\n const dependency = this.findLookupDependency(fieldValue, record);\n if (dependency) {\n record.dependencies.add(dependency);\n }\n }\n // Handle @root references - these create dependencies on the root record\n else if (fieldValue.startsWith(METADATA_KEYWORDS.ROOT)) {\n const rootDependency = this.findRootDependency(record);\n if (rootDependency) {\n record.dependencies.add(rootDependency);\n }\n }\n // @parent references don't create explicit dependencies in our flattened structure\n // because parent is guaranteed to be processed before children due to the way\n // we flatten records (parent always comes before its children)\n }\n }\n }\n\n // Check foreign key dependencies\n this.analyzeForeignKeyDependencies(record, entityInfo);\n }\n }\n\n /**\n * Analyzes foreign key dependencies based on EntityInfo\n */\n private analyzeForeignKeyDependencies(record: FlattenedRecord, entityInfo: EntityInfo): void {\n // Check all foreign key fields\n for (const field of entityInfo.ForeignKeys) {\n const fieldValue = record.record.fields?.[field.Name];\n if (fieldValue && typeof fieldValue === 'string' && !fieldValue.startsWith('@')) {\n // This is a direct foreign key value, find the referenced record\n const relatedEntityInfo = this.getEntityInfo(field.RelatedEntity);\n if (relatedEntityInfo) {\n const dependency = this.findRecordByPrimaryKey(\n field.RelatedEntity,\n fieldValue,\n relatedEntityInfo\n );\n if (dependency) {\n record.dependencies.add(dependency);\n }\n }\n }\n }\n }\n\n /**\n * Finds a record that matches a @lookup reference\n */\n private findLookupDependency(lookupValue: string, currentRecord: FlattenedRecord): string | null {\n // Parse lookup format: @lookup:EntityName.Field=Value or @lookup:Field=Value\n const lookupStr = lookupValue.substring(8); // Remove '@lookup:'\n \n // Handle the ?create syntax by removing it\n const cleanLookup = lookupStr.split('?')[0];\n \n // Parse entity name if present\n let targetEntity: string;\n let criteria: string;\n \n if (cleanLookup.includes('.')) {\n const parts = cleanLookup.split('.');\n targetEntity = parts[0];\n criteria = parts.slice(1).join('.');\n } else {\n // Same entity if not specified\n targetEntity = currentRecord.entityName;\n criteria = cleanLookup;\n }\n\n // Parse criteria (can be multiple with &)\n const criteriaMap = new Map<string, string>();\n for (const pair of criteria.split('&')) {\n const [field, value] = pair.split('=');\n if (field && value) {\n let resolvedValue = value.trim();\n \n // Special handling for nested @lookup references in lookup criteria\n // This creates a dependency on the looked-up record\n if (resolvedValue.startsWith(METADATA_KEYWORDS.LOOKUP)) {\n const nestedDependency = this.findLookupDependency(resolvedValue, currentRecord);\n if (nestedDependency) {\n // Add this as a dependency of the current record\n currentRecord.dependencies.add(nestedDependency);\n // Continue processing - we can't resolve the actual value here\n // but we've recorded the dependency\n }\n }\n // Special handling for @root references in lookup criteria\n else if (resolvedValue.startsWith(METADATA_KEYWORDS.ROOT)) {\n // Add dependency on root record\n const rootDep = this.findRootDependency(currentRecord);\n if (rootDep) {\n currentRecord.dependencies.add(rootDep);\n }\n // Note: We can't resolve the actual value here, but we've recorded the dependency\n }\n // Special handling for @parent references in lookup criteria\n // If the value is @parent:field, we need to resolve it from the parent context\n else if (resolvedValue.startsWith(METADATA_KEYWORDS.PARENT) && currentRecord.parentContext) {\n const parentField = resolvedValue.substring(METADATA_KEYWORDS.PARENT.length);\n \n // Try to resolve from parent context\n const parentValue = currentRecord.parentContext.record.fields?.[parentField] ||\n currentRecord.parentContext.record.primaryKey?.[parentField];\n \n if (parentValue && typeof parentValue === 'string') {\n // Check if parent value is also a @parent reference (nested parent refs)\n if (parentValue.startsWith(METADATA_KEYWORDS.PARENT)) {\n // Find the parent record to get its parent context\n const parentRecord = this.flattenedRecords.find(r =>\n r.record === currentRecord.parentContext!.record &&\n r.entityName === currentRecord.parentContext!.entityName\n );\n\n if (parentRecord && parentRecord.parentContext) {\n const grandParentField = parentValue.substring(METADATA_KEYWORDS.PARENT.length);\n const grandParentValue = parentRecord.parentContext.record.fields?.[grandParentField] ||\n parentRecord.parentContext.record.primaryKey?.[grandParentField];\n if (grandParentValue && typeof grandParentValue === 'string' && !grandParentValue.startsWith('@')) {\n resolvedValue = grandParentValue;\n }\n }\n } else if (!parentValue.startsWith('@')) {\n resolvedValue = parentValue;\n }\n }\n }\n \n criteriaMap.set(field.trim(), resolvedValue);\n }\n }\n\n // Find matching record in our flattened list\n for (const candidate of this.flattenedRecords) {\n if (candidate.entityName !== targetEntity) continue;\n if (candidate.id === currentRecord.id) continue; // Skip self\n\n // Check if all criteria match\n let allMatch = true;\n for (const [field, value] of criteriaMap) {\n let candidateValue = candidate.record.fields?.[field] || \n candidate.record.primaryKey?.[field];\n let lookupValue = value;\n \n // Resolve candidate value if it's a @parent reference\n if (typeof candidateValue === 'string' && candidateValue.startsWith(METADATA_KEYWORDS.PARENT) && candidate.parentContext) {\n const parentField = candidateValue.substring(METADATA_KEYWORDS.PARENT.length);\n const parentRecord = candidate.parentContext.record;\n candidateValue = parentRecord.fields?.[parentField] || parentRecord.primaryKey?.[parentField];\n\n // If the parent field is also a @parent reference, resolve it recursively\n if (typeof candidateValue === 'string' && candidateValue.startsWith(METADATA_KEYWORDS.PARENT)) {\n // Find the candidate's parent in our flattened list\n const candidateParent = this.flattenedRecords.find(r => \n r.record === candidate.parentContext!.record && \n r.entityName === candidate.parentContext!.entityName\n );\n if (candidateParent?.parentContext) {\n const grandParentField = candidateValue.substring(8);\n candidateValue = candidateParent.parentContext.record.fields?.[grandParentField] || \n candidateParent.parentContext.record.primaryKey?.[grandParentField];\n }\n }\n }\n \n // Resolve lookup value if it contains @parent reference\n if (typeof lookupValue === 'string' && lookupValue.includes(METADATA_KEYWORDS.PARENT)) {\n // Handle cases like \"@parent:AgentID\" or embedded references\n if (lookupValue.startsWith(METADATA_KEYWORDS.PARENT) && currentRecord.parentContext) {\n const parentField = lookupValue.substring(METADATA_KEYWORDS.PARENT.length);\n lookupValue = currentRecord.parentContext.record.fields?.[parentField] ||\n currentRecord.parentContext.record.primaryKey?.[parentField];\n\n // If still a reference, try to resolve from the parent's parent\n if (typeof lookupValue === 'string' && lookupValue.startsWith(METADATA_KEYWORDS.PARENT)) {\n const currentParent = this.flattenedRecords.find(r =>\n r.record === currentRecord.parentContext!.record &&\n r.entityName === currentRecord.parentContext!.entityName\n );\n if (currentParent?.parentContext) {\n const grandParentField = lookupValue.substring(METADATA_KEYWORDS.PARENT.length);\n lookupValue = currentParent.parentContext.record.fields?.[grandParentField] ||\n currentParent.parentContext.record.primaryKey?.[grandParentField];\n }\n }\n }\n }\n\n // Special case: if both values are @parent references pointing to the same parent field,\n // and they have the same parent context, they match\n if (value.startsWith(METADATA_KEYWORDS.PARENT) && candidateValue === value && \n currentRecord.parentContext && candidate.parentContext) {\n // Check if they share the same parent\n if (currentRecord.parentContext.record === candidate.parentContext.record) {\n // Same parent, same reference - they will resolve to the same value\n continue; // This criterion matches\n }\n }\n \n if (candidateValue !== lookupValue) {\n allMatch = false;\n break;\n }\n }\n\n if (allMatch) {\n return candidate.id;\n }\n }\n\n return null;\n }\n\n /**\n * Finds the root record for a given record\n */\n private findRootDependency(record: FlattenedRecord): string | null {\n // If this record has no parent, it IS the root, no dependency\n if (!record.parentContext) {\n return null;\n }\n \n // Walk up the parent chain to find the root\n let current = record;\n while (current.parentContext) {\n // Try to find the parent record in our flattened list\n const parentRecord = this.flattenedRecords.find(r => \n r.record === current.parentContext!.record && \n r.entityName === current.parentContext!.entityName\n );\n \n if (!parentRecord) {\n // Parent not found, something is wrong\n return null;\n }\n \n // If this parent has no parent, it's the root\n if (!parentRecord.parentContext) {\n return parentRecord.id;\n }\n \n current = parentRecord;\n }\n \n return null;\n }\n\n /**\n * Finds a record by its primary key value\n */\n private findRecordByPrimaryKey(\n entityName: string,\n primaryKeyValue: string,\n entityInfo: EntityInfo\n ): string | null {\n // Get primary key field name\n const primaryKeyField = entityInfo.PrimaryKeys[0]?.Name;\n if (!primaryKeyField) return null;\n\n for (const candidate of this.flattenedRecords) {\n if (candidate.entityName !== entityName) continue;\n\n const candidateValue = candidate.record.primaryKey?.[primaryKeyField] ||\n candidate.record.fields?.[primaryKeyField];\n if (candidateValue === primaryKeyValue) {\n return candidate.id;\n }\n }\n\n return null;\n }\n\n /**\n * Gets EntityInfo from cache or metadata\n */\n private getEntityInfo(entityName: string): EntityInfo | null {\n if (!this.entityInfoCache.has(entityName)) {\n const info = this.metadata.EntityByName(entityName);\n if (info) {\n this.entityInfoCache.set(entityName, info);\n }\n }\n return this.entityInfoCache.get(entityName) || null;\n }\n\n /**\n * Detects circular dependencies in the dependency graph\n */\n private detectCircularDependencies(): string[][] {\n const cycles: string[][] = [];\n const visited = new Set<string>();\n const recursionStack = new Set<string>();\n\n const detectCycle = (recordId: string, path: string[]): boolean => {\n visited.add(recordId);\n recursionStack.add(recordId);\n path.push(recordId);\n\n const record = this.recordIdMap.get(recordId);\n if (record) {\n for (const depId of record.dependencies) {\n if (!visited.has(depId)) {\n if (detectCycle(depId, [...path])) {\n return true;\n }\n } else if (recursionStack.has(depId)) {\n // Found a cycle\n const cycleStart = path.indexOf(depId);\n const cycle = path.slice(cycleStart);\n cycle.push(depId); // Complete the cycle\n cycles.push(cycle);\n return true;\n }\n }\n }\n\n recursionStack.delete(recordId);\n return false;\n };\n\n // Check all records for cycles\n for (const record of this.flattenedRecords) {\n if (!visited.has(record.id)) {\n detectCycle(record.id, []);\n }\n }\n\n return cycles;\n }\n\n /**\n * Performs topological sort on the dependency graph\n */\n private topologicalSort(): FlattenedRecord[] {\n const result: FlattenedRecord[] = [];\n const visited = new Set<string>();\n const tempStack = new Set<string>();\n\n const visit = (recordId: string): boolean => {\n if (tempStack.has(recordId)) {\n // Circular dependency - we've already detected these\n return false;\n }\n\n if (visited.has(recordId)) {\n return true;\n }\n\n tempStack.add(recordId);\n\n const record = this.recordIdMap.get(recordId);\n if (record) {\n // Visit dependencies first\n for (const depId of record.dependencies) {\n visit(depId);\n }\n }\n\n tempStack.delete(recordId);\n visited.add(recordId);\n \n if (record) {\n result.push(record);\n }\n\n return true;\n };\n\n // Process all records, starting with those that have no dependencies\n // First, process records with no dependencies\n for (const record of this.flattenedRecords) {\n if (record.dependencies.size === 0 && !visited.has(record.id)) {\n visit(record.id);\n }\n }\n\n // Then process any remaining records (handles disconnected components)\n for (const record of this.flattenedRecords) {\n if (!visited.has(record.id)) {\n visit(record.id);\n }\n }\n\n return result;\n }\n\n /**\n * Groups sorted records into dependency levels for parallel processing\n * Records in the same level have no dependencies on each other and can be processed in parallel\n */\n private groupByDependencyLevels(\n sortedRecords: FlattenedRecord[],\n dependencyGraph: Map<string, Set<string>>\n ): FlattenedRecord[][] {\n const levels: FlattenedRecord[][] = [];\n const recordLevels = new Map<string, number>();\n \n // Calculate the level for each record\n for (const record of sortedRecords) {\n let maxDependencyLevel = -1;\n \n // Find the maximum level of all dependencies\n for (const depId of record.dependencies) {\n const depLevel = recordLevels.get(depId);\n if (depLevel !== undefined && depLevel > maxDependencyLevel) {\n maxDependencyLevel = depLevel;\n }\n }\n \n // This record's level is one more than its highest dependency\n const recordLevel = maxDependencyLevel + 1;\n recordLevels.set(record.id, recordLevel);\n \n // Add to the appropriate level array\n if (!levels[recordLevel]) {\n levels[recordLevel] = [];\n }\n levels[recordLevel].push(record);\n }\n \n return levels;\n }\n\n /**\n * Build reverse dependency map from forward dependencies\n * Maps: record ID -> list of records that depend on it\n *\n * This is essential for deletion ordering - we need to know what depends on a record\n * before we can safely delete it.\n */\n public buildReverseDependencyMap(\n records: FlattenedRecord[]\n ): Map<string, ReverseDependency[]> {\n const reverseMap = new Map<string, ReverseDependency[]>();\n\n for (const record of records) {\n // For each dependency this record has...\n for (const depId of record.dependencies) {\n // Skip undefined or null dependency IDs (defensive check)\n if (!depId) {\n console.warn(`Warning: Record ${record.id} has undefined/null dependency, skipping`);\n continue;\n }\n\n // Add this record as a dependent of that dependency\n if (!reverseMap.has(depId)) {\n reverseMap.set(depId, []);\n }\n\n reverseMap.get(depId)!.push({\n recordId: depId,\n dependentId: record.id,\n entityName: record.entityName,\n fieldName: this.findForeignKeyFieldForDependency(record, depId),\n filePath: record.path\n });\n }\n }\n\n return reverseMap;\n }\n\n /**\n * Find the foreign key field that creates a dependency\n * Used for better error reporting\n */\n private findForeignKeyFieldForDependency(\n record: FlattenedRecord,\n dependencyId: string\n ): string | null {\n const entityInfo = this.getEntityInfo(record.entityName);\n if (!entityInfo) return null;\n\n const dependentRecord = this.recordIdMap.get(dependencyId);\n if (!dependentRecord) return null;\n\n // Check all foreign key fields\n for (const field of entityInfo.ForeignKeys) {\n const fieldValue = record.record.fields?.[field.Name];\n\n // Check if this field references the dependent record\n if (fieldValue && typeof fieldValue === 'string') {\n // Handle @lookup references\n if (fieldValue.startsWith(METADATA_KEYWORDS.LOOKUP)) {\n const resolvedDep = this.findLookupDependency(fieldValue, record);\n if (resolvedDep === dependencyId) {\n return field.Name;\n }\n }\n // Handle direct foreign key values\n else if (!fieldValue.startsWith('@')) {\n const relatedEntityInfo = this.getEntityInfo(field.RelatedEntity);\n if (relatedEntityInfo) {\n const dep = this.findRecordByPrimaryKey(\n field.RelatedEntity,\n fieldValue,\n relatedEntityInfo\n );\n if (dep === dependencyId) {\n return field.Name;\n }\n }\n }\n }\n }\n\n return null;\n }\n\n /**\n * Perform reverse topological sort for deletion order\n * Returns records grouped by dependency level, with leaf nodes (highest dependency level) first\n *\n * For deletions, we want to delete in reverse order of creation:\n * - Records at highest forward dependency levels (leaf nodes) delete FIRST\n * - Records at level 0 (root nodes with no dependencies) delete LAST\n *\n * This is simply the reverse of the forward topological sort used for creates.\n */\n public reverseTopologicalSort(\n records: FlattenedRecord[],\n reverseDependencies: Map<string, ReverseDependency[]>\n ): FlattenedRecord[][] {\n // Calculate forward dependency levels (same as creation order)\n const recordLevels = new Map<string, number>();\n\n // Calculate the level for each record based on its FORWARD dependencies\n for (const record of records) {\n let maxDependencyLevel = -1;\n\n // Find the maximum level of all dependencies (things this record depends ON)\n for (const depId of record.dependencies) {\n const depLevel = recordLevels.get(depId);\n if (depLevel !== undefined && depLevel > maxDependencyLevel) {\n maxDependencyLevel = depLevel;\n }\n }\n\n // This record's level is one more than its highest dependency\n const recordLevel = maxDependencyLevel + 1;\n recordLevels.set(record.id, recordLevel);\n }\n\n // Group records by level\n const forwardLevels: FlattenedRecord[][] = [];\n for (const record of records) {\n const level = recordLevels.get(record.id) || 0;\n\n if (!forwardLevels[level]) {\n forwardLevels[level] = [];\n }\n forwardLevels[level].push(record);\n }\n\n // Reverse the array for deletion order\n // Forward level 0 (roots) becomes last to delete\n // Forward level N (leaves) becomes first to delete\n return forwardLevels.reverse();\n }\n\n /**\n * Find all transitive dependents of a set of records\n * This is useful for finding all records that must be deleted when deleting a parent\n *\n * @param recordIds Set of record IDs to find dependents for\n * @param reverseDependencies Reverse dependency map\n * @returns Set of all record IDs that depend on the input records (transitively)\n */\n public findTransitiveDependents(\n recordIds: Set<string>,\n reverseDependencies: Map<string, ReverseDependency[]>\n ): Set<string> {\n const dependents = new Set<string>();\n const visited = new Set<string>();\n\n // BFS to find all transitive dependents\n const queue = Array.from(recordIds);\n\n while (queue.length > 0) {\n const recordId = queue.shift()!;\n if (visited.has(recordId)) continue;\n visited.add(recordId);\n\n const deps = reverseDependencies.get(recordId) || [];\n\n for (const dep of deps) {\n // Add dependent to result set\n dependents.add(dep.dependentId);\n\n // Queue for processing its dependents\n queue.push(dep.dependentId);\n }\n }\n\n return dependents;\n }\n}"]}
1
+ {"version":3,"file":"record-dependency-analyzer.js","sourceRoot":"","sources":["../../src/lib/record-dependency-analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gCAAgC,CAAC;AA0CzF;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAOnC;QALQ,qBAAgB,GAAsB,EAAE,CAAC;QACzC,gBAAW,GAAiC,IAAI,GAAG,EAAE,CAAC;QACtD,oBAAe,GAA4B,IAAI,GAAG,EAAE,CAAC;QACrD,kBAAa,GAAW,CAAC,CAAC;QAGhC,IAAI,CAAC,QAA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AC,WAAW,CAAC,CAAC;gBAEhC,sCAAsC;gBACtC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
@@ -6,7 +6,7 @@
6
6
  * initialized once per process, preventing duplicate metadata refreshes
7
7
  * and improving performance.
8
8
  */
9
- import { SyncEngine } from './sync-engine';
9
+ import { SyncEngine } from './sync-engine.js';
10
10
  import { UserInfo } from '@memberjunction/core';
11
11
  /**
12
12
  * Get or create a singleton SyncEngine instance
@@ -32,3 +32,4 @@ export declare function getSyncEngine(contextUser: UserInfo): Promise<SyncEngine
32
32
  * instance is created on the next request.
33
33
  */
34
34
  export declare function resetSyncEngine(): void;
35
+ //# sourceMappingURL=singleton-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleton-manager.d.ts","sourceRoot":"","sources":["../../src/lib/singleton-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAQhD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,aAAa,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAmB9E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAGtC"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * @fileoverview Singleton manager for shared instances across MetadataSync
4
3
  * @module singleton-manager
@@ -7,9 +6,7 @@
7
6
  * initialized once per process, preventing duplicate metadata refreshes
8
7
  * and improving performance.
9
8
  */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.resetSyncEngine = exports.getSyncEngine = void 0;
12
- const sync_engine_1 = require("./sync-engine");
9
+ import { SyncEngine } from './sync-engine.js';
13
10
  /** Global SyncEngine instance */
14
11
  let globalSyncEngine = null;
15
12
  /** Promise to track ongoing SyncEngine initialization */
@@ -30,7 +27,7 @@ let syncEngineInitPromise = null;
30
27
  * // Use syncEngine for operations
31
28
  * ```
32
29
  */
33
- async function getSyncEngine(contextUser) {
30
+ export async function getSyncEngine(contextUser) {
34
31
  // Return existing engine if already initialized
35
32
  if (globalSyncEngine) {
36
33
  return globalSyncEngine;
@@ -41,22 +38,20 @@ async function getSyncEngine(contextUser) {
41
38
  }
42
39
  // Start new initialization
43
40
  syncEngineInitPromise = (async () => {
44
- globalSyncEngine = new sync_engine_1.SyncEngine(contextUser);
41
+ globalSyncEngine = new SyncEngine(contextUser);
45
42
  await globalSyncEngine.initialize();
46
43
  return globalSyncEngine;
47
44
  })();
48
45
  return syncEngineInitPromise;
49
46
  }
50
- exports.getSyncEngine = getSyncEngine;
51
47
  /**
52
48
  * Reset the singleton SyncEngine instance
53
49
  *
54
50
  * Should be called when cleaning up resources to ensure a fresh
55
51
  * instance is created on the next request.
56
52
  */
57
- function resetSyncEngine() {
53
+ export function resetSyncEngine() {
58
54
  globalSyncEngine = null;
59
55
  syncEngineInitPromise = null;
60
56
  }
61
- exports.resetSyncEngine = resetSyncEngine;
62
57
  //# sourceMappingURL=singleton-manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"singleton-manager.js","sourceRoot":"","sources":["../../src/lib/singleton-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,+CAA2C;AAG3C,iCAAiC;AACjC,IAAI,gBAAgB,GAAsB,IAAI,CAAC;AAE/C,yDAAyD;AACzD,IAAI,qBAAqB,GAA+B,IAAI,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,aAAa,CAAC,WAAqB;IACvD,gDAAgD;IAChD,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,+CAA+C;IAC/C,IAAI,qBAAqB,EAAE,CAAC;QAC1B,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAED,2BAA2B;IAC3B,qBAAqB,GAAG,CAAC,KAAK,IAAI,EAAE;QAClC,gBAAgB,GAAG,IAAI,wBAAU,CAAC,WAAW,CAAC,CAAC;QAC/C,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;QACpC,OAAO,gBAAgB,CAAC;IAC1B,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAnBD,sCAmBC;AAED;;;;;GAKG;AACH,SAAgB,eAAe;IAC7B,gBAAgB,GAAG,IAAI,CAAC;IACxB,qBAAqB,GAAG,IAAI,CAAC;AAC/B,CAAC;AAHD,0CAGC","sourcesContent":["/**\n * @fileoverview Singleton manager for shared instances across MetadataSync\n * @module singleton-manager\n * \n * This module ensures that expensive resources like SyncEngine are only\n * initialized once per process, preventing duplicate metadata refreshes\n * and improving performance.\n */\n\nimport { SyncEngine } from './sync-engine';\nimport { UserInfo } from '@memberjunction/core';\n\n/** Global SyncEngine instance */\nlet globalSyncEngine: SyncEngine | null = null;\n\n/** Promise to track ongoing SyncEngine initialization */\nlet syncEngineInitPromise: Promise<SyncEngine> | null = null;\n\n/**\n * Get or create a singleton SyncEngine instance\n * \n * Ensures that only one SyncEngine is created and initialized per process,\n * preventing duplicate metadata refreshes that cause the double GetAllMetadata()\n * console output.\n * \n * @param contextUser - The user context for database operations\n * @returns Promise resolving to initialized SyncEngine instance\n * \n * @example\n * ```typescript\n * const syncEngine = await getSyncEngine(getSystemUser());\n * // Use syncEngine for operations\n * ```\n */\nexport async function getSyncEngine(contextUser: UserInfo): Promise<SyncEngine> {\n // Return existing engine if already initialized\n if (globalSyncEngine) {\n return globalSyncEngine;\n }\n \n // Return ongoing initialization if in progress\n if (syncEngineInitPromise) {\n return syncEngineInitPromise;\n }\n \n // Start new initialization\n syncEngineInitPromise = (async () => {\n globalSyncEngine = new SyncEngine(contextUser);\n await globalSyncEngine.initialize();\n return globalSyncEngine;\n })();\n \n return syncEngineInitPromise;\n}\n\n/**\n * Reset the singleton SyncEngine instance\n * \n * Should be called when cleaning up resources to ensure a fresh\n * instance is created on the next request.\n */\nexport function resetSyncEngine(): void {\n globalSyncEngine = null;\n syncEngineInitPromise = null;\n}"]}
1
+ {"version":3,"file":"singleton-manager.js","sourceRoot":"","sources":["../../src/lib/singleton-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,iCAAiC;AACjC,IAAI,gBAAgB,GAAsB,IAAI,CAAC;AAE/C,yDAAyD;AACzD,IAAI,qBAAqB,GAA+B,IAAI,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,WAAqB;IACvD,gDAAgD;IAChD,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,+CAA+C;IAC/C,IAAI,qBAAqB,EAAE,CAAC;QAC1B,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IAED,2BAA2B;IAC3B,qBAAqB,GAAG,CAAC,KAAK,IAAI,EAAE;QAClC,gBAAgB,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;QAC/C,MAAM,gBAAgB,CAAC,UAAU,EAAE,CAAC;QACpC,OAAO,gBAAgB,CAAC;IAC1B,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAC7B,gBAAgB,GAAG,IAAI,CAAC;IACxB,qBAAqB,GAAG,IAAI,CAAC;AAC/B,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * This module provides SQL logging functionality to capture all database operations
6
6
  * during push commands. It supports both raw SQL logging and migration-formatted output.
7
7
  */
8
- import { SyncConfig } from '../config';
8
+ import { SyncConfig } from '../config.js';
9
9
  export interface SQLLoggerOptions {
10
10
  enabled: boolean;
11
11
  outputDirectory: string;
@@ -42,3 +42,4 @@ export declare class SQLLogger {
42
42
  */
43
43
  private formatParamValue;
44
44
  }
45
+ //# sourceMappingURL=sql-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-logger.d.ts","sourceRoot":"","sources":["../../src/lib/sql-logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,aAAa,CAAS;gBAElB,UAAU,EAAE,UAAU,GAAG,IAAI;IAQzC,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAUjC;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI;IAmB/C;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,IAAI;IAQ7D;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgD7C;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAgBzB"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * @fileoverview SQL Logger for capturing database operations during metadata sync
4
3
  * @module sql-logger
@@ -6,18 +5,12 @@
6
5
  * This module provides SQL logging functionality to capture all database operations
7
6
  * during push commands. It supports both raw SQL logging and migration-formatted output.
8
7
  */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.SQLLogger = void 0;
14
- const fs_extra_1 = __importDefault(require("fs-extra"));
15
- const path_1 = __importDefault(require("path"));
16
- class SQLLogger {
17
- options;
18
- statements = [];
19
- isInitialized = false;
8
+ import fs from 'fs-extra';
9
+ import path from 'path';
10
+ export class SQLLogger {
20
11
  constructor(syncConfig) {
12
+ this.statements = [];
13
+ this.isInitialized = false;
21
14
  this.options = {
22
15
  enabled: syncConfig?.sqlLogging?.enabled ?? false,
23
16
  outputDirectory: syncConfig?.sqlLogging?.outputDirectory ?? './sql_logging',
@@ -35,7 +28,7 @@ class SQLLogger {
35
28
  return;
36
29
  }
37
30
  // Ensure output directory exists
38
- await fs_extra_1.default.ensureDir(this.options.outputDirectory);
31
+ await fs.ensureDir(this.options.outputDirectory);
39
32
  this.isInitialized = true;
40
33
  }
41
34
  /**
@@ -106,8 +99,8 @@ class SQLLogger {
106
99
  ...this.statements
107
100
  ].join('\n');
108
101
  }
109
- const filePath = path_1.default.join(this.options.outputDirectory, filename);
110
- await fs_extra_1.default.writeFile(filePath, content, 'utf8');
102
+ const filePath = path.join(this.options.outputDirectory, filename);
103
+ await fs.writeFile(filePath, content, 'utf8');
111
104
  return filePath;
112
105
  }
113
106
  /**
@@ -136,5 +129,4 @@ class SQLLogger {
136
129
  return String(value);
137
130
  }
138
131
  }
139
- exports.SQLLogger = SQLLogger;
140
132
  //# sourceMappingURL=sql-logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sql-logger.js","sourceRoot":"","sources":["../../src/lib/sql-logger.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,wDAA0B;AAC1B,gDAAwB;AASxB,MAAa,SAAS;IACZ,OAAO,CAAmB;IAC1B,UAAU,GAAa,EAAE,CAAC;IAC1B,aAAa,GAAG,KAAK,CAAC;IAE9B,YAAY,UAA6B;QACvC,IAAI,CAAC,OAAO,GAAG;YACb,OAAO,EAAE,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adata sync\n * @module sql-logger\n * \n * This module provides SQL logging functionality to capture all database operations\n * during push commands. It supports both raw SQL logging and migration-formatted output.\n */\n\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { SyncConfig } from '../config';\n\nexport interface SQLLoggerOptions {\n enabled: boolean;\n outputDirectory: string;\n formatAsMigration: boolean;\n}\n\nexport class SQLLogger {\n private options: SQLLoggerOptions;\n private statements: string[] = [];\n private isInitialized = false;\n \n constructor(syncConfig: SyncConfig | null) {\n this.options = {\n enabled: syncConfig?.sqlLogging?.enabled ?? false,\n outputDirectory: syncConfig?.sqlLogging?.outputDirectory ?? './sql_logging',\n formatAsMigration: syncConfig?.sqlLogging?.formatAsMigration ?? false\n };\n }\n \n get enabled(): boolean {\n return this.options.enabled;\n }\n \n /**\n * Initialize the SQL logger and prepare output directory\n */\n async initialize(): Promise<void> {\n if (!this.options.enabled || this.isInitialized) {\n return;\n }\n \n // Ensure output directory exists\n await fs.ensureDir(this.options.outputDirectory);\n this.isInitialized = true;\n }\n \n /**\n * Log a SQL statement\n */\n logStatement(sql: string, params?: any[]): void {\n if (!this.options.enabled) {\n return;\n }\n \n // Format SQL with parameters inline for readability\n let formattedSql = sql;\n if (params && params.length > 0) {\n // Replace parameter placeholders with actual values\n params.forEach((param, index) => {\n const placeholder = `@param${index + 1}`;\n const value = this.formatParamValue(param);\n formattedSql = formattedSql.replace(new RegExp(placeholder, 'g'), value);\n });\n }\n \n this.statements.push(formattedSql);\n }\n \n /**\n * Log a transaction boundary\n */\n logTransaction(action: 'BEGIN' | 'COMMIT' | 'ROLLBACK'): void {\n if (!this.options.enabled) {\n return;\n }\n \n this.statements.push(`${action} TRANSACTION;`);\n }\n \n /**\n * Write the collected SQL statements to file\n */\n async writeLog(): Promise<string | undefined> {\n if (!this.options.enabled || this.statements.length === 0) {\n return undefined;\n }\n \n await this.initialize();\n \n const timestamp = new Date().toISOString().replace(/[:.]/g, '-');\n let filename: string;\n let content: string;\n \n if (this.options.formatAsMigration) {\n // Format as Flyway migration\n const migrationTimestamp = timestamp.replace(/[-T]/g, '').substring(0, 14);\n filename = `V${migrationTimestamp}__MetadataSync_Push.sql`;\n \n content = [\n '-- MemberJunction MetadataSync Push Migration',\n `-- Generated at: ${new Date().toISOString()}`,\n '-- Description: Metadata changes pushed via mj sync push command',\n '',\n '-- Note: Schema placeholders can be replaced during deployment',\n '-- Replace ${flyway:defaultSchema} with your target schema name',\n '',\n ...this.statements.map(stmt => {\n // Add schema placeholders for migration format\n return stmt.replace(/(\\[?)__mj(\\]?)\\./g, '${flyway:defaultSchema}.');\n })\n ].join('\\n');\n } else {\n // Regular SQL log format\n filename = `metadatasync-push-${timestamp}.sql`;\n \n content = [\n '-- MemberJunction MetadataSync SQL Log',\n `-- Generated at: ${new Date().toISOString()}`,\n `-- Total statements: ${this.statements.length}`,\n '',\n ...this.statements\n ].join('\\n');\n }\n \n const filePath = path.join(this.options.outputDirectory, filename);\n await fs.writeFile(filePath, content, 'utf8');\n \n return filePath;\n }\n \n /**\n * Clear all logged statements\n */\n clear(): void {\n this.statements = [];\n }\n \n /**\n * Format a parameter value for SQL\n */\n private formatParamValue(value: any): string {\n if (value === null) {\n return 'NULL';\n }\n if (typeof value === 'string') {\n // Escape single quotes and wrap in quotes\n return `'${value.replace(/'/g, \"''\")}'`;\n }\n if (typeof value === 'boolean') {\n return value ? '1' : '0';\n }\n if (value instanceof Date) {\n return `'${value.toISOString()}'`;\n }\n return String(value);\n }\n}"]}
1
+ {"version":3,"file":"sql-logger.js","sourceRoot":"","sources":["../../src/lib/sql-logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AASxB,MAAM,OAAO,SAAS;IAKpB,YAAY,UAA6B;QAHjC,eAAU,GAAa,EAAE,CAAC;QAC1B,kBAAa,GAAG,KAAK,CAAC;QAG5B,IAAI,CAAC,OAAO,GAAG;YACb,OAAO,EAAE,UA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10
10
  import { EntityInfo, BaseEntity, UserInfo } from '@memberjunction/core';
11
- import { EntityConfig } from '../config';
11
+ import { EntityConfig } from '../config.js';
12
12
  /**
13
13
  * Custom error class for lookup failures that can be deferred.
14
14
  * When a lookup with `?allowDefer` flag fails, this error is thrown instead of a regular Error.
@@ -380,3 +380,4 @@ export declare class SyncEngine {
380
380
  */
381
381
  private processJsonFieldValues;
382
382
  }
383
+ //# sourceMappingURL=sync-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-engine.d.ts","sourceRoot":"","sources":["../../src/lib/sync-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAAE,UAAU,EAAqB,UAAU,EAAgB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzG,OAAO,EAAE,YAAY,EAAgB,MAAM,WAAW,CAAC;AAUvD;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,sCAAsC;IACtC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,+CAA+C;IAC/C,SAAgB,YAAY,EAAE,KAAK,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;IAC7E,uCAAuC;IACvC,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,gDAAgD;IAChD,SAAgB,eAAe,CAAC,EAAE,MAAM,CAAC;gBAGvC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,KAAK,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,CAAC,EAC5D,aAAa,EAAE,MAAM,EACrB,eAAe,CAAC,EAAE,MAAM;CAY3B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;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