airbyte-faros-destination 0.16.15 → 0.16.17
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/lib/converters/faros-org-import/common.d.ts +6 -0
- package/lib/converters/faros-org-import/common.js +17 -0
- package/lib/converters/faros-org-import/common.js.map +1 -0
- package/lib/converters/faros-org-import/employees.d.ts +22 -0
- package/lib/converters/faros-org-import/employees.js +203 -0
- package/lib/converters/faros-org-import/employees.js.map +1 -0
- package/lib/converters/faros-org-import/teams.d.ts +17 -0
- package/lib/converters/faros-org-import/teams.js +276 -0
- package/lib/converters/faros-org-import/teams.js.map +1 -0
- package/lib/converters/faros-org-import/tools.d.ts +9 -0
- package/lib/converters/faros-org-import/tools.js +52 -0
- package/lib/converters/faros-org-import/tools.js.map +1 -0
- package/lib/converters/faros-org-import/types.d.ts +57 -0
- package/lib/converters/faros-org-import/types.js +14 -0
- package/lib/converters/faros-org-import/types.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/resources/source-specific-configs/faros-org-import.json +47 -0
- package/resources/source-specific-configs/spec.json +3 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Converter } from '../converter';
|
|
2
|
+
export declare const DEFAULT_ROOT_TEAM_ID = "all_teams";
|
|
3
|
+
export declare abstract class FarosOrgImportConverter extends Converter {
|
|
4
|
+
source: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function lift<T, R>(val: T | undefined, fn: (t: T) => R): R | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FarosOrgImportConverter = exports.DEFAULT_ROOT_TEAM_ID = void 0;
|
|
4
|
+
exports.lift = lift;
|
|
5
|
+
const converter_1 = require("../converter");
|
|
6
|
+
exports.DEFAULT_ROOT_TEAM_ID = 'all_teams';
|
|
7
|
+
class FarosOrgImportConverter extends converter_1.Converter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.source = 'faros-org-import';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.FarosOrgImportConverter = FarosOrgImportConverter;
|
|
14
|
+
function lift(val, fn) {
|
|
15
|
+
return val ? fn(val) : undefined;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/faros-org-import/common.ts"],"names":[],"mappings":";;;AAQA,oBAEC;AAVD,4CAAuC;AAE1B,QAAA,oBAAoB,GAAG,WAAW,CAAC;AAEhD,MAAsB,uBAAwB,SAAQ,qBAAS;IAA/D;;QACE,WAAM,GAAG,kBAAkB,CAAC;IAC9B,CAAC;CAAA;AAFD,0DAEC;AAED,SAAgB,IAAI,CAAO,GAAkB,EAAE,EAAe;IAC5D,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { FarosOrgImportConverter } from './common';
|
|
4
|
+
export declare class Employees extends FarosOrgImportConverter {
|
|
5
|
+
private locationCollector;
|
|
6
|
+
private collectedTmsUsers;
|
|
7
|
+
private collectedVcsUsers;
|
|
8
|
+
private collectedImsUsers;
|
|
9
|
+
private collectedCalUsers;
|
|
10
|
+
private collectedAmsUsers;
|
|
11
|
+
private collectedSurveyUsers;
|
|
12
|
+
private seenEmployees;
|
|
13
|
+
id(record: AirbyteRecord): any;
|
|
14
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
15
|
+
private initialize;
|
|
16
|
+
convert(record: AirbyteRecord, ctx?: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
17
|
+
private addEmpToMap;
|
|
18
|
+
private getIdentityModels;
|
|
19
|
+
private formatEmployeeType;
|
|
20
|
+
private toBoolean;
|
|
21
|
+
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Employees = void 0;
|
|
4
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
+
const geo_1 = require("../common/geo");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
class Employees extends common_1.FarosOrgImportConverter {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.locationCollector = undefined;
|
|
12
|
+
this.collectedTmsUsers = new Map();
|
|
13
|
+
this.collectedVcsUsers = new Map();
|
|
14
|
+
this.collectedImsUsers = new Map();
|
|
15
|
+
this.collectedCalUsers = new Map();
|
|
16
|
+
this.collectedAmsUsers = new Map();
|
|
17
|
+
this.collectedSurveyUsers = new Map();
|
|
18
|
+
this.seenEmployees = new Set();
|
|
19
|
+
this.destinationModels = [
|
|
20
|
+
'identity_Identity',
|
|
21
|
+
'ams_UserIdentity',
|
|
22
|
+
'cal_UserIdentity',
|
|
23
|
+
'ims_UserIdentity',
|
|
24
|
+
'survey_UserIdentity',
|
|
25
|
+
'tms_UserIdentity',
|
|
26
|
+
'vcs_UserIdentity',
|
|
27
|
+
'org_Employee',
|
|
28
|
+
'org_TeamMembership',
|
|
29
|
+
'geo_Location',
|
|
30
|
+
'geo_Address',
|
|
31
|
+
'geo_Coordinates',
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
id(record) {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
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.employeeId;
|
|
37
|
+
}
|
|
38
|
+
initialize(ctx) {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
if (this.locationCollector) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.locationCollector = new geo_1.LocationCollector((_c = (_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.config) === null || _a === void 0 ? void 0 : _a.source_specific_configs) === null || _b === void 0 ? void 0 : _b.faros_org_import) === null || _c === void 0 ? void 0 : _c.resolve_locations, ctx.farosClient);
|
|
44
|
+
}
|
|
45
|
+
async convert(record, ctx) {
|
|
46
|
+
var _a, _b, _c, _d, _e;
|
|
47
|
+
this.initialize(ctx);
|
|
48
|
+
const models = [];
|
|
49
|
+
const row = record.record.data;
|
|
50
|
+
const source = (_d = (_c = (_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.config) === null || _a === void 0 ? void 0 : _a.source_specific_configs) === null || _b === void 0 ? void 0 : _b.faros_org_import) === null || _c === void 0 ? void 0 : _c.source) !== null && _d !== void 0 ? _d : {};
|
|
51
|
+
const empId = row.employeeId;
|
|
52
|
+
if (!empId || this.seenEmployees.has(empId)) {
|
|
53
|
+
(_e = ctx.logger) === null || _e === void 0 ? void 0 : _e.warn('Duplicate employeeId: ' + empId);
|
|
54
|
+
return models;
|
|
55
|
+
}
|
|
56
|
+
this.seenEmployees.add(empId);
|
|
57
|
+
const amsIds = row.amsId;
|
|
58
|
+
if (amsIds && (source === null || source === void 0 ? void 0 : source.ams)) {
|
|
59
|
+
this.addEmpToMap(empId, amsIds, source === null || source === void 0 ? void 0 : source.ams, this.collectedAmsUsers);
|
|
60
|
+
}
|
|
61
|
+
const calIds = row.calId;
|
|
62
|
+
if (calIds && (source === null || source === void 0 ? void 0 : source.cal)) {
|
|
63
|
+
this.addEmpToMap(empId, calIds, source === null || source === void 0 ? void 0 : source.cal, this.collectedCalUsers);
|
|
64
|
+
}
|
|
65
|
+
const imsIds = row.imsId;
|
|
66
|
+
if (imsIds && (source === null || source === void 0 ? void 0 : source.ims)) {
|
|
67
|
+
this.addEmpToMap(empId, imsIds, source === null || source === void 0 ? void 0 : source.ims, this.collectedImsUsers);
|
|
68
|
+
}
|
|
69
|
+
const surveyIds = row.surveyId;
|
|
70
|
+
if (surveyIds && (source === null || source === void 0 ? void 0 : source.survey)) {
|
|
71
|
+
this.addEmpToMap(empId, surveyIds, source === null || source === void 0 ? void 0 : source.survey, this.collectedSurveyUsers);
|
|
72
|
+
}
|
|
73
|
+
// Aggregate all TMS identity columns in a single map
|
|
74
|
+
const tmsIds = row.tmsId;
|
|
75
|
+
if (tmsIds && (source === null || source === void 0 ? void 0 : source.tms)) {
|
|
76
|
+
this.addEmpToMap(empId, tmsIds, source === null || source === void 0 ? void 0 : source.tms, this.collectedTmsUsers);
|
|
77
|
+
}
|
|
78
|
+
const jiraIds = row.tmsId_Jira;
|
|
79
|
+
if (jiraIds) {
|
|
80
|
+
this.addEmpToMap(empId, jiraIds, 'Jira', this.collectedTmsUsers);
|
|
81
|
+
}
|
|
82
|
+
// Aggregate all VCS identity columns in a single map
|
|
83
|
+
const vcsIds = row.vcsId;
|
|
84
|
+
if (vcsIds && (source === null || source === void 0 ? void 0 : source.vcs)) {
|
|
85
|
+
this.addEmpToMap(empId, vcsIds, source === null || source === void 0 ? void 0 : source.vcs, this.collectedVcsUsers);
|
|
86
|
+
}
|
|
87
|
+
const githubIds = row.vcsId_GitHub;
|
|
88
|
+
if (githubIds) {
|
|
89
|
+
this.addEmpToMap(empId, githubIds, 'GitHub', this.collectedVcsUsers);
|
|
90
|
+
}
|
|
91
|
+
const bitbucketIds = row.vcsId_BitBucket;
|
|
92
|
+
if (bitbucketIds) {
|
|
93
|
+
this.addEmpToMap(empId, bitbucketIds, 'Bitbucket', this.collectedVcsUsers);
|
|
94
|
+
}
|
|
95
|
+
const teamIds = row.teamId;
|
|
96
|
+
if (teamIds) {
|
|
97
|
+
for (const untrimmed of teamIds.split(',')) {
|
|
98
|
+
const teamId = untrimmed.trim();
|
|
99
|
+
models.push({
|
|
100
|
+
model: 'org_TeamMembership',
|
|
101
|
+
record: {
|
|
102
|
+
team: { uid: teamId },
|
|
103
|
+
member: { uid: empId },
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
models.push({
|
|
109
|
+
model: 'identity_Identity',
|
|
110
|
+
record: {
|
|
111
|
+
uid: empId,
|
|
112
|
+
fullName: row.fullName,
|
|
113
|
+
primaryEmail: row.email,
|
|
114
|
+
emails: row.email ? [row.email] : [],
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
models.push({
|
|
118
|
+
model: 'org_Employee',
|
|
119
|
+
record: {
|
|
120
|
+
uid: empId,
|
|
121
|
+
identity: { uid: empId },
|
|
122
|
+
level: (0, common_1.lift)(row.level, faros_js_client_1.Utils.parseInteger),
|
|
123
|
+
employmentType: this.formatEmployeeType(row.type),
|
|
124
|
+
location: await this.locationCollector.collect(row.location),
|
|
125
|
+
joinedAt: faros_js_client_1.Utils.toDate(row.joinedAt),
|
|
126
|
+
terminatedAt: faros_js_client_1.Utils.toDate(row.terminatedAt),
|
|
127
|
+
inactive: this.toBoolean(row.inactive),
|
|
128
|
+
ignored: this.toBoolean(row.ignored),
|
|
129
|
+
title: row.title,
|
|
130
|
+
role: row.role,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
return models;
|
|
134
|
+
}
|
|
135
|
+
addEmpToMap(employeeId, ids, source, map) {
|
|
136
|
+
for (const untrimmedId of ids.split(',')) {
|
|
137
|
+
const id = untrimmedId.trim();
|
|
138
|
+
if (id === '')
|
|
139
|
+
continue;
|
|
140
|
+
const key = [id, source];
|
|
141
|
+
let employeeIds;
|
|
142
|
+
if (map.has(key)) {
|
|
143
|
+
employeeIds = map.get(key);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
employeeIds = new Set();
|
|
147
|
+
map.set(key, employeeIds);
|
|
148
|
+
}
|
|
149
|
+
employeeIds.add(employeeId);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
getIdentityModels(userMap, namespace, logger) {
|
|
153
|
+
logger === null || logger === void 0 ? void 0 : logger.info(`Syncing ${namespace} user identities...`);
|
|
154
|
+
const models = [];
|
|
155
|
+
for (const [[uid, source], employeeIdsSet] of userMap) {
|
|
156
|
+
if (employeeIdsSet.size === 0)
|
|
157
|
+
continue;
|
|
158
|
+
const employeeIds = Array.from(employeeIdsSet.values());
|
|
159
|
+
if (employeeIds.length > 1) {
|
|
160
|
+
logger === null || logger === void 0 ? void 0 : logger.warn(`Duplicate employeeIds found for ${namespace} user [${uid}]: ${employeeIds.join(', ')}`);
|
|
161
|
+
}
|
|
162
|
+
// Always write the association even if duplicate employeeIds detected
|
|
163
|
+
models.push({
|
|
164
|
+
model: `${namespace}_UserIdentity`,
|
|
165
|
+
record: {
|
|
166
|
+
[`${namespace}User`]: { uid, source },
|
|
167
|
+
identity: { uid: employeeIds[0] },
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return models;
|
|
172
|
+
}
|
|
173
|
+
formatEmployeeType(type) {
|
|
174
|
+
if (!type)
|
|
175
|
+
return undefined;
|
|
176
|
+
const employeeType = type.toLowerCase();
|
|
177
|
+
if (employeeType in types_1.EmployeeTypeMap) {
|
|
178
|
+
return { category: types_1.EmployeeTypeMap[employeeType], detail: type };
|
|
179
|
+
}
|
|
180
|
+
return { category: 'Custom', detail: type };
|
|
181
|
+
}
|
|
182
|
+
toBoolean(v) {
|
|
183
|
+
if (!v)
|
|
184
|
+
return false;
|
|
185
|
+
if (typeof v === 'boolean')
|
|
186
|
+
return v;
|
|
187
|
+
const vv = v.toLowerCase();
|
|
188
|
+
return vv === 'true' || vv === '1';
|
|
189
|
+
}
|
|
190
|
+
async onProcessingComplete(ctx) {
|
|
191
|
+
const models = [];
|
|
192
|
+
models.push(...this.getIdentityModels(this.collectedAmsUsers, 'ams', ctx.logger));
|
|
193
|
+
models.push(...this.getIdentityModels(this.collectedCalUsers, 'cal', ctx.logger));
|
|
194
|
+
models.push(...this.getIdentityModels(this.collectedImsUsers, 'ims', ctx.logger));
|
|
195
|
+
models.push(...this.getIdentityModels(this.collectedSurveyUsers, 'survey', ctx.logger));
|
|
196
|
+
models.push(...this.getIdentityModels(this.collectedTmsUsers, 'tms', ctx.logger));
|
|
197
|
+
models.push(...this.getIdentityModels(this.collectedVcsUsers, 'vcs', ctx.logger));
|
|
198
|
+
models.push(...this.locationCollector.convertLocations());
|
|
199
|
+
return models;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
exports.Employees = Employees;
|
|
203
|
+
//# sourceMappingURL=employees.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"employees.js","sourceRoot":"","sources":["../../../src/converters/faros-org-import/employees.ts"],"names":[],"mappings":";;;AACA,qDAAsC;AAEtC,uCAAgD;AAEhD,qCAAuD;AACvD,mCAAgF;AAEhF,MAAa,SAAU,SAAQ,gCAAuB;IAAtD;;QACU,sBAAiB,GAAsB,SAAS,CAAC;QACjD,sBAAiB,GAAG,IAAI,GAAG,EAAiC,CAAC;QAC7D,sBAAiB,GAAG,IAAI,GAAG,EAAiC,CAAC;QAC7D,sBAAiB,GAAG,IAAI,GAAG,EAAiC,CAAC;QAC7D,sBAAiB,GAAG,IAAI,GAAG,EAAiC,CAAC;QAC7D,sBAAiB,GAAG,IAAI,GAAG,EAAiC,CAAC;QAC7D,yBAAoB,GAAG,IAAI,GAAG,EAAiC,CAAC;QAChE,kBAAa,GAAG,IAAI,GAAG,EAAU,CAAC;QAMjC,sBAAiB,GAAoC;YAC5D,mBAAmB;YACnB,kBAAkB;YAClB,kBAAkB;YAClB,kBAAkB;YAClB,qBAAqB;YACrB,kBAAkB;YAClB,kBAAkB;YAClB,cAAc;YACd,oBAAoB;YACpB,cAAc;YACd,aAAa;YACb,iBAAiB;SAClB,CAAC;IAgOJ,CAAC;IAj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IAAI,CACT,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CACrE,CAAC;QACF,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CACrE,CAAC;QACF,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,oBAAoB,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAC3E,CAAC;QACF,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CACrE,CAAC;QACF,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CACrE,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC1D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3PD,8BA2PC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { FarosOrgImportConverter } from './common';
|
|
4
|
+
export declare class Teams extends FarosOrgImportConverter {
|
|
5
|
+
private teamsToSync;
|
|
6
|
+
private teamToParentMapping;
|
|
7
|
+
private surveyTeamMap;
|
|
8
|
+
private teamsMissingTeamName;
|
|
9
|
+
private teamsMissingParentTeamId;
|
|
10
|
+
private teamsMissingTeamLeadId;
|
|
11
|
+
id(record: AirbyteRecord): any;
|
|
12
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
13
|
+
convert(record: AirbyteRecord, ctx?: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
14
|
+
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
15
|
+
private getTeamCommunicationChannel;
|
|
16
|
+
private checkTeamsCycle;
|
|
17
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Teams = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
const TEAM_OWNERSHIP_QUERY = `
|
|
6
|
+
query teamOwnerships($origin: String!) {
|
|
7
|
+
org_Team(where: {origin: {_eq: $origin}}) {
|
|
8
|
+
uid
|
|
9
|
+
name
|
|
10
|
+
origin
|
|
11
|
+
applications: applicationOwnerships {
|
|
12
|
+
application {
|
|
13
|
+
name
|
|
14
|
+
platform
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
boards: boardOwnerships {
|
|
18
|
+
board {
|
|
19
|
+
uid
|
|
20
|
+
source
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
pipelines: pipelineOwnerships {
|
|
24
|
+
pipeline {
|
|
25
|
+
uid
|
|
26
|
+
organization {
|
|
27
|
+
uid
|
|
28
|
+
source
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
projects: projectOwnerships {
|
|
33
|
+
project {
|
|
34
|
+
uid
|
|
35
|
+
source
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
repositories: repositoryOwnerships {
|
|
39
|
+
repository {
|
|
40
|
+
name
|
|
41
|
+
organization {
|
|
42
|
+
uid
|
|
43
|
+
source
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
class Teams extends common_1.FarosOrgImportConverter {
|
|
51
|
+
constructor() {
|
|
52
|
+
super(...arguments);
|
|
53
|
+
this.teamsToSync = [];
|
|
54
|
+
this.teamToParentMapping = new Map();
|
|
55
|
+
this.surveyTeamMap = new Map();
|
|
56
|
+
this.teamsMissingTeamName = [];
|
|
57
|
+
this.teamsMissingParentTeamId = [];
|
|
58
|
+
this.teamsMissingTeamLeadId = [];
|
|
59
|
+
this.destinationModels = [
|
|
60
|
+
'org_Team',
|
|
61
|
+
'survey_OrgTeam',
|
|
62
|
+
'org_CommunicationChannel',
|
|
63
|
+
'org_TeamMembership',
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
id(record) {
|
|
67
|
+
var _a, _b;
|
|
68
|
+
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.teamId;
|
|
69
|
+
}
|
|
70
|
+
async convert(record, ctx) {
|
|
71
|
+
var _a, _b, _c, _d, _e, _f;
|
|
72
|
+
const team = record.record.data;
|
|
73
|
+
const source = (_d = (_c = (_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.config) === null || _a === void 0 ? void 0 : _a.source_specific_configs) === null || _b === void 0 ? void 0 : _b.faros_org_import) === null || _c === void 0 ? void 0 : _c.source) !== null && _d !== void 0 ? _d : {};
|
|
74
|
+
if (!team.teamId) {
|
|
75
|
+
(_e = ctx.logger) === null || _e === void 0 ? void 0 : _e.error('Missing teamId: ' + JSON.stringify(team));
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
// Skip team if teamId is DEFAULT_ROOT_TEAM_ID
|
|
79
|
+
if (team.teamId === common_1.DEFAULT_ROOT_TEAM_ID) {
|
|
80
|
+
(_f = ctx.logger) === null || _f === void 0 ? void 0 : _f.warn(`Skipping team with id ${common_1.DEFAULT_ROOT_TEAM_ID} as it is reserved.`);
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
// Missing teamName
|
|
84
|
+
if (!team.teamName) {
|
|
85
|
+
this.teamsMissingTeamName.push(team.teamId);
|
|
86
|
+
}
|
|
87
|
+
// Missing teamLeadId
|
|
88
|
+
if (!team.teamLeadId) {
|
|
89
|
+
this.teamsMissingTeamLeadId.push(team.teamId);
|
|
90
|
+
}
|
|
91
|
+
// Missing parentTeamId
|
|
92
|
+
if (!team.parentTeamId && team.teamId !== common_1.DEFAULT_ROOT_TEAM_ID) {
|
|
93
|
+
this.teamsMissingParentTeamId.push(team.teamId);
|
|
94
|
+
this.teamsToSync.push({ ...team, parentTeamId: common_1.DEFAULT_ROOT_TEAM_ID });
|
|
95
|
+
this.teamToParentMapping.set(team.teamId, common_1.DEFAULT_ROOT_TEAM_ID);
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.teamToParentMapping.set(team.teamId, team.parentTeamId);
|
|
100
|
+
}
|
|
101
|
+
// Collect all survey teams
|
|
102
|
+
if (team.surveyTeamId && source.survey) {
|
|
103
|
+
if (!this.surveyTeamMap.has(team.surveyTeamId)) {
|
|
104
|
+
this.surveyTeamMap.set(team.surveyTeamId, []);
|
|
105
|
+
}
|
|
106
|
+
this.surveyTeamMap.get(team.surveyTeamId).push(team.teamId);
|
|
107
|
+
}
|
|
108
|
+
this.teamsToSync.push(team);
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
async onProcessingComplete(ctx) {
|
|
112
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
113
|
+
const models = [];
|
|
114
|
+
const syncedTeams = new Set();
|
|
115
|
+
const source = (_d = (_c = (_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.config) === null || _a === void 0 ? void 0 : _a.source_specific_configs) === null || _b === void 0 ? void 0 : _b.faros_org_import) === null || _c === void 0 ? void 0 : _c.source) !== null && _d !== void 0 ? _d : {};
|
|
116
|
+
// Log aggregated warnings
|
|
117
|
+
const teamsWithCycle = this.checkTeamsCycle();
|
|
118
|
+
if (this.teamsMissingTeamName.length) {
|
|
119
|
+
(_e = ctx.logger) === null || _e === void 0 ? void 0 : _e.warn(`The following teams are missing teamName: ${this.teamsMissingTeamName.join(', ')}`);
|
|
120
|
+
}
|
|
121
|
+
if (this.teamsMissingParentTeamId.length) {
|
|
122
|
+
(_f = ctx.logger) === null || _f === void 0 ? void 0 : _f.warn(`The following teams are missing parentTeamId: ${this.teamsMissingParentTeamId.join(', ')}`);
|
|
123
|
+
}
|
|
124
|
+
if (this.teamsMissingTeamLeadId.length) {
|
|
125
|
+
(_g = ctx.logger) === null || _g === void 0 ? void 0 : _g.warn(`The following teams are missing teamLeadId: ${this.teamsMissingTeamLeadId.join(', ')}`);
|
|
126
|
+
}
|
|
127
|
+
if (teamsWithCycle.length) {
|
|
128
|
+
(_h = ctx.logger) === null || _h === void 0 ? void 0 : _h.warn(`The following teams have a cycle in their parent-child relationship: ${Array.from(teamsWithCycle).join(', ')}`);
|
|
129
|
+
}
|
|
130
|
+
// Sync teams
|
|
131
|
+
for (const team of this.teamsToSync) {
|
|
132
|
+
if (syncedTeams.has(team.teamId)) {
|
|
133
|
+
(_j = ctx.logger) === null || _j === void 0 ? void 0 : _j.warn(`Duplicate teamId: ${team.teamId}`);
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
models.push({
|
|
137
|
+
model: 'org_Team',
|
|
138
|
+
record: {
|
|
139
|
+
uid: team.teamId,
|
|
140
|
+
name: team.teamName,
|
|
141
|
+
parentTeamId: team.parentTeamId,
|
|
142
|
+
description: team.teamDescription,
|
|
143
|
+
leader: (0, common_1.lift)(team.teamLeadId, (leadId) => ({ uid: leadId })),
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
syncedTeams.add(team.teamId);
|
|
147
|
+
// Sync team lead membership
|
|
148
|
+
if (team.teamLeadId) {
|
|
149
|
+
models.push({
|
|
150
|
+
model: 'org_TeamMembership',
|
|
151
|
+
record: {
|
|
152
|
+
team: { uid: team.teamId },
|
|
153
|
+
member: { uid: team.teamLeadId },
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
// Sync team communication channels
|
|
158
|
+
if (team.communicationChannel_Discord) {
|
|
159
|
+
models.push(this.getTeamCommunicationChannel(team.teamId, 'Discord', team.communicationChannel_Discord));
|
|
160
|
+
}
|
|
161
|
+
if (team.communicationChannel_Email) {
|
|
162
|
+
models.push(this.getTeamCommunicationChannel(team.teamId, 'Email', team.communicationChannel_Email));
|
|
163
|
+
}
|
|
164
|
+
if (team.communicationChannel_Slack) {
|
|
165
|
+
models.push(this.getTeamCommunicationChannel(team.teamId, 'Slack', team.communicationChannel_Slack));
|
|
166
|
+
}
|
|
167
|
+
if (team.communicationChannel_Teams) {
|
|
168
|
+
models.push(this.getTeamCommunicationChannel(team.teamId, 'Teams', team.communicationChannel_Teams));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Sync survey teams
|
|
172
|
+
for (const [surveyTeamId, teams] of this.surveyTeamMap.entries()) {
|
|
173
|
+
if (teams.length > 1) {
|
|
174
|
+
ctx.logger.warn(`Survey team (${surveyTeamId}) was assigned to more than one team: ${teams.join(', ')}`);
|
|
175
|
+
}
|
|
176
|
+
// Always write first association even if duplicate teams detected
|
|
177
|
+
models.push({
|
|
178
|
+
model: 'survey_OrgTeam',
|
|
179
|
+
record: {
|
|
180
|
+
surveyTeam: { uid: surveyTeamId, source: source.survey },
|
|
181
|
+
orgTeam: { uid: teams[0] },
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
// Clean up ownership for teams that no longer exist
|
|
186
|
+
const teamsIter = ctx.farosClient.nodeIterable(ctx.graph, TEAM_OWNERSHIP_QUERY, undefined, undefined, new Map([['origin', ctx.config.origin]]));
|
|
187
|
+
for await (const team of teamsIter) {
|
|
188
|
+
if (syncedTeams.has(team.uid)) {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
for (const { application } of team.applications) {
|
|
192
|
+
models.push({
|
|
193
|
+
model: 'org_ApplicationOwnership__Deletion',
|
|
194
|
+
record: {
|
|
195
|
+
where: { application, team },
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
for (const { board } of team.boards) {
|
|
200
|
+
models.push({
|
|
201
|
+
model: 'org_BoardOwnership__Deletion',
|
|
202
|
+
record: {
|
|
203
|
+
where: { board, team },
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
for (const { project } of team.projects) {
|
|
208
|
+
models.push({
|
|
209
|
+
model: 'org_ProjectOwnership__Deletion',
|
|
210
|
+
record: {
|
|
211
|
+
where: { project, team },
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
for (const { repository } of team.repositories) {
|
|
216
|
+
models.push({
|
|
217
|
+
model: 'org_RepositoryOwnership__Deletion',
|
|
218
|
+
record: {
|
|
219
|
+
where: { repository, team },
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
for (const { pipeline } of team.pipelines) {
|
|
224
|
+
models.push({
|
|
225
|
+
model: 'org_PipelineOwnership_Deletion',
|
|
226
|
+
record: {
|
|
227
|
+
where: { pipeline, team },
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
(_k = ctx.logger) === null || _k === void 0 ? void 0 : _k.info(`Deleted ownership for ${team.applications.length} apps, ` +
|
|
232
|
+
`${team.boards.length} boards, ` +
|
|
233
|
+
`${team.projects.length} projects, ` +
|
|
234
|
+
`${team.repositories.length} repos, ` +
|
|
235
|
+
`${team.pipelines.length} pipelines ` +
|
|
236
|
+
`for team ${team.name} (uid: ${team.uid})`);
|
|
237
|
+
}
|
|
238
|
+
return models;
|
|
239
|
+
}
|
|
240
|
+
getTeamCommunicationChannel(teamId, type, channel) {
|
|
241
|
+
return {
|
|
242
|
+
model: 'org_CommunicationChannel',
|
|
243
|
+
record: {
|
|
244
|
+
uid: `${type}__${channel}`,
|
|
245
|
+
team: { uid: teamId },
|
|
246
|
+
type,
|
|
247
|
+
name: `${teamId} : ${type} communication channel`,
|
|
248
|
+
value: channel,
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
checkTeamsCycle() {
|
|
253
|
+
const teamsWithCycle = new Set();
|
|
254
|
+
for (const teamId of this.teamToParentMapping.keys()) {
|
|
255
|
+
let team = teamId;
|
|
256
|
+
if (team === common_1.DEFAULT_ROOT_TEAM_ID) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
let parent;
|
|
260
|
+
while (parent !== common_1.DEFAULT_ROOT_TEAM_ID) {
|
|
261
|
+
parent = this.teamToParentMapping.get(team);
|
|
262
|
+
if (!parent) {
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
if (parent === teamId) {
|
|
266
|
+
teamsWithCycle.add(teamId);
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
team = parent;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return Array.from(teamsWithCycle);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
exports.Teams = Teams;
|
|
276
|
+
//# sourceMappingURL=teams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams.js","sourceRoot":"","sources":["../../../src/converters/faros-org-import/teams.ts"],"names":[],"mappings":";;;AAGA,qCAA6E;AA4C7E,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4C5B,CAAC;AAEF,MAAa,KAAM,SAAQ,gCAAuB;IAAlD;;QACU,gBAAW,GAAc,EAAE,CAAC;QAC5B,wBAAmB,GAAG,IAAI,GAAG,EAAkB,CAAC;QAChD,kBAAa,GAAG,IAAI,GAAG,EAAoB,CAAC;QAE5C,yBAAoB,GAAa,EAAE,CAAC;QACpC,6BAAwB,GAAa,EAAE,CAAC;QACxC,2BAAsB,GAAa,EAAE,CAAC;QAMrC,sBAAiB,GAAoC;YAC5D,UAAU;YAC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pC,CAAC;CACF;AAjTD,sBAiTC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { FarosOrgImportConverter } from './common';
|
|
4
|
+
export declare class Tools extends FarosOrgImportConverter {
|
|
5
|
+
id(record: AirbyteRecord): any;
|
|
6
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
private formatTool;
|
|
9
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tools = void 0;
|
|
4
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
class Tools extends common_1.FarosOrgImportConverter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.destinationModels = [
|
|
11
|
+
'org_EmployeeTool',
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
id(record) {
|
|
15
|
+
var _a;
|
|
16
|
+
const tool = (_a = record === null || record === void 0 ? void 0 : record.record) === null || _a === void 0 ? void 0 : _a.data;
|
|
17
|
+
return `${tool.tool}__${tool.employeeId}`;
|
|
18
|
+
}
|
|
19
|
+
async convert(record, ctx) {
|
|
20
|
+
const models = [];
|
|
21
|
+
const tool = record.record.data;
|
|
22
|
+
const formattedTool = this.formatTool(tool.tool);
|
|
23
|
+
if (tool.employeeId && formattedTool) {
|
|
24
|
+
models.push({
|
|
25
|
+
model: 'org_EmployeeTool',
|
|
26
|
+
record: {
|
|
27
|
+
employee: { uid: tool.employeeId },
|
|
28
|
+
tool: formattedTool,
|
|
29
|
+
activatedAt: faros_js_client_1.Utils.toDate(tool.activatedAt),
|
|
30
|
+
deactivatedAt: faros_js_client_1.Utils.toDate(tool.deactivatedAt),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return models;
|
|
35
|
+
}
|
|
36
|
+
formatTool(tool) {
|
|
37
|
+
if (!tool)
|
|
38
|
+
return undefined;
|
|
39
|
+
const normalizedTool = tool.replace(/\s/g, '').toLowerCase();
|
|
40
|
+
if (normalizedTool in types_1.ToolMap) {
|
|
41
|
+
return {
|
|
42
|
+
category: types_1.ToolMap[normalizedTool],
|
|
43
|
+
detail: tool,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return { category: 'Custom', detail: tool };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.Tools = Tools;
|
|
52
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/converters/faros-org-import/tools.ts"],"names":[],"mappings":";;;AACA,qDAAsC;AAGtC,qCAAiD;AACjD,mCAAyC;AAEzC,MAAa,KAAM,SAAQ,gCAAuB;IAAlD;;QAMW,sBAAiB,GAAoC;YAC5D,kBAAkB;SACnB,CAAC;IAyCJ,CAAC;IAhDC,EAAE,CAAC,MAAqB;;QACtB,MAAM,IAAI,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,IAAI,CAAC;QAClC,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;IAC5C,CAAC;IAMD,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAe,CAAC;QAE3C,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CA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