airbyte-faros-destination 0.19.53-rc0 → 0.19.53
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.
|
@@ -8,9 +8,5 @@ export declare class Changesets extends AzureTfvcConverter {
|
|
|
8
8
|
id(record: AirbyteRecord): number;
|
|
9
9
|
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
10
10
|
private getDiffStats;
|
|
11
|
-
private processChanges;
|
|
12
|
-
private collectMergedChangesetIds;
|
|
13
|
-
private createBranchAssociations;
|
|
14
|
-
private createTaskAssociations;
|
|
15
11
|
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
16
12
|
}
|
|
@@ -23,23 +23,24 @@ class Changesets extends common_1.AzureTfvcConverter {
|
|
|
23
23
|
return (_b = (_a = record === null || record === void 0 ? void 0 : record.record) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.changesetId;
|
|
24
24
|
}
|
|
25
25
|
async convert(record, ctx) {
|
|
26
|
-
var _a, _b;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
27
27
|
const changeset = record.record.data;
|
|
28
|
+
const res = [];
|
|
28
29
|
if (!changeset.changesetId) {
|
|
29
30
|
ctx.logger.warn(`Changeset ID not found: ${JSON.stringify(changeset)}`);
|
|
30
|
-
return
|
|
31
|
+
return res;
|
|
31
32
|
}
|
|
32
33
|
const repository = (0, vcs_1.repoKey)(changeset.organization, (_a = changeset.project) === null || _a === void 0 ? void 0 : _a.name, this.source);
|
|
33
34
|
if (!repository) {
|
|
34
35
|
ctx.logger.warn(`Organization or project name not found: ${JSON.stringify(changeset)}`);
|
|
35
|
-
return
|
|
36
|
+
return res;
|
|
36
37
|
}
|
|
37
38
|
const sha = String(changeset.changesetId);
|
|
38
39
|
const commit = { sha, repository };
|
|
39
40
|
const author = ((_b = changeset.author) === null || _b === void 0 ? void 0 : _b.uniqueName)
|
|
40
41
|
? { uid: changeset.author.uniqueName.toLowerCase(), source: this.source }
|
|
41
42
|
: undefined;
|
|
42
|
-
|
|
43
|
+
res.push({
|
|
43
44
|
model: 'vcs_Commit',
|
|
44
45
|
record: {
|
|
45
46
|
...commit,
|
|
@@ -50,96 +51,99 @@ class Changesets extends common_1.AzureTfvcConverter {
|
|
|
50
51
|
author,
|
|
51
52
|
diffStats: this.getDiffStats(changeset),
|
|
52
53
|
},
|
|
53
|
-
};
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
});
|
|
55
|
+
const branch = this.branchCollector.collectBranch(changeset.branch, repository);
|
|
56
|
+
if (branch) {
|
|
57
|
+
res.push({
|
|
58
|
+
model: 'vcs_BranchCommitAssociation',
|
|
59
|
+
record: {
|
|
60
|
+
commit,
|
|
61
|
+
branch,
|
|
62
|
+
committedAt: faros_js_client_1.Utils.toDate(changeset.createdDate),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
63
65
|
}
|
|
64
|
-
|
|
65
|
-
filesChanged: changeset.changes.length,
|
|
66
|
-
// Line counts not available from TFVC API
|
|
67
|
-
linesAdded: null,
|
|
68
|
-
linesDeleted: null,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
processChanges(changes, commit, repository) {
|
|
72
|
-
var _a;
|
|
73
|
-
const commitFiles = [];
|
|
66
|
+
// Track merged changeset IDs to avoid duplicate associations
|
|
74
67
|
const mergedChangesetIds = new Set();
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
// Create vcs_CommitFile records and collect files from changes
|
|
69
|
+
for (const change of (_c = changeset.changes) !== null && _c !== void 0 ? _c : []) {
|
|
70
|
+
if ((_d = change.item) === null || _d === void 0 ? void 0 : _d.path) {
|
|
77
71
|
const filePath = change.item.path;
|
|
78
72
|
this.fileCollector.collectFile(filePath, repository);
|
|
79
|
-
|
|
73
|
+
res.push({
|
|
80
74
|
model: 'vcs_CommitFile',
|
|
81
75
|
record: {
|
|
82
76
|
commit,
|
|
83
|
-
file: {
|
|
77
|
+
file: {
|
|
78
|
+
uid: filePath,
|
|
79
|
+
repository,
|
|
80
|
+
},
|
|
81
|
+
// TFVC API doesn't provide line-level diff stats
|
|
84
82
|
additions: null,
|
|
85
83
|
deletions: null,
|
|
86
84
|
},
|
|
87
85
|
});
|
|
88
86
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
// Collect merged changeset IDs from merge sources
|
|
88
|
+
// These are changesets that were merged into this changeset
|
|
89
|
+
for (const mergeSource of (_e = change.mergeSources) !== null && _e !== void 0 ? _e : []) {
|
|
90
|
+
if (mergeSource.isRename) {
|
|
91
|
+
continue; // Skip renames, only process actual merges
|
|
92
|
+
}
|
|
93
|
+
// versionFrom and versionTo represent an inclusive range of changesets merged
|
|
94
|
+
const from = mergeSource.versionFrom;
|
|
95
|
+
const to = (_f = mergeSource.versionTo) !== null && _f !== void 0 ? _f : from;
|
|
96
|
+
if (from && to) {
|
|
97
|
+
Array.from({ length: to - from + 1 }, (_, i) => from + i).forEach((id) => mergedChangesetIds.add(id));
|
|
98
|
+
}
|
|
98
99
|
}
|
|
99
|
-
const from = mergeSource.versionFrom;
|
|
100
|
-
const to = (_b = mergeSource.versionTo) !== null && _b !== void 0 ? _b : from;
|
|
101
|
-
if (from && to) {
|
|
102
|
-
Array.from({ length: to - from + 1 }, (_, i) => from + i).forEach((id) => mergedChangesetIds.add(id));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
createBranchAssociations(branchName, commit, mergedChangesetIds, repository, committedAt) {
|
|
107
|
-
const branch = this.branchCollector.collectBranch(branchName, repository);
|
|
108
|
-
if (!branch) {
|
|
109
|
-
return [];
|
|
110
100
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
101
|
+
// Create vcs_BranchCommitAssociation for merged changesets
|
|
102
|
+
// This associates the merged commits with the target branch
|
|
103
|
+
if (branch) {
|
|
104
|
+
for (const mergedChangesetId of mergedChangesetIds) {
|
|
105
|
+
const mergedCommit = {
|
|
106
|
+
sha: String(mergedChangesetId),
|
|
107
|
+
repository,
|
|
108
|
+
};
|
|
109
|
+
res.push({
|
|
110
|
+
model: 'vcs_BranchCommitAssociation',
|
|
111
|
+
record: {
|
|
112
|
+
commit: mergedCommit,
|
|
113
|
+
branch,
|
|
114
|
+
committedAt: faros_js_client_1.Utils.toDate(changeset.createdDate),
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
126
118
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
createTaskAssociations(commit, workItems) {
|
|
130
|
-
const records = [];
|
|
131
|
-
for (const workItem of workItems !== null && workItems !== void 0 ? workItems : []) {
|
|
119
|
+
// Create tms_TaskCommitAssociation records for linked work items
|
|
120
|
+
for (const workItem of (_g = changeset.workItems) !== null && _g !== void 0 ? _g : []) {
|
|
132
121
|
if (workItem.id) {
|
|
133
|
-
|
|
122
|
+
res.push({
|
|
134
123
|
model: 'tms_TaskCommitAssociation',
|
|
135
124
|
record: {
|
|
136
125
|
commit,
|
|
137
|
-
task: {
|
|
126
|
+
task: {
|
|
127
|
+
uid: String(workItem.id),
|
|
128
|
+
source: 'Azure-Workitems',
|
|
129
|
+
},
|
|
138
130
|
},
|
|
139
131
|
});
|
|
140
132
|
}
|
|
141
133
|
}
|
|
142
|
-
return
|
|
134
|
+
return res;
|
|
135
|
+
}
|
|
136
|
+
getDiffStats(changeset) {
|
|
137
|
+
var _a;
|
|
138
|
+
if (!((_a = changeset.changes) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
filesChanged: changeset.changes.length,
|
|
143
|
+
// Line counts not available from TFVC API
|
|
144
|
+
linesAdded: null,
|
|
145
|
+
linesDeleted: null,
|
|
146
|
+
};
|
|
143
147
|
}
|
|
144
148
|
async onProcessingComplete(ctx) {
|
|
145
149
|
return [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changesets.js","sourceRoot":"","sources":["../../../src/converters/azure-tfvc/changesets.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"changesets.js","sourceRoot":"","sources":["../../../src/converters/azure-tfvc/changesets.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;AAEtC,uCAMuB;AAEvB,qCAAoE;AAEpE,MAAa,UAAW,SAAQ,2BAAkB;IAAlD;;QACmB,oBAAe,GAAG,IAAI,qBAAe,EAAE,CAAC;QACxC,kBAAa,GAAG,IAAI,mBAAa,EAAE,CAAC;QAE5C,sBAAiB,GAAoC;YAC5D,2BAA2B;YAC3B,YAAY;YACZ,6BAA6B;YAC7B,YAAY;YACZ,gBAAgB;YAChB,UAAU;SACX,CAAC;IAsKJ,CAAC;IApKC,EAAE,CAAC,MAAqB;;QACtB,OAAO,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,IAAI,0CAAE,WAAW,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAiB,CAAC;QAClD,MAAM,GAAG,GAAwB,EAAE,CAAC;QAEpC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;YAC3B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CA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