airbyte-faros-destination 0.10.2 → 0.10.4
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/github/common.d.ts +1 -2
- package/lib/converters/github/faros_copilot_seats.d.ts +1 -0
- package/lib/converters/github/faros_copilot_seats.js +27 -8
- package/lib/converters/github/faros_copilot_seats.js.map +1 -1
- package/lib/converters/github/faros_outside_collaborators.d.ts +8 -0
- package/lib/converters/github/faros_outside_collaborators.js +20 -0
- package/lib/converters/github/faros_outside_collaborators.js.map +1 -0
- package/lib/converters/github/faros_pull_request_comments.d.ts +8 -0
- package/lib/converters/github/faros_pull_request_comments.js +17 -0
- package/lib/converters/github/faros_pull_request_comments.js.map +1 -0
- package/lib/converters/github/faros_pull_requests.d.ts +2 -0
- package/lib/converters/github/faros_pull_requests.js +56 -11
- package/lib/converters/github/faros_pull_requests.js.map +1 -1
- package/lib/converters/github/faros_team_memberships.d.ts +1 -0
- package/lib/converters/github/faros_team_memberships.js +5 -1
- package/lib/converters/github/faros_team_memberships.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ import { User } from 'faros-airbyte-common/github';
|
|
|
3
3
|
import { Dictionary } from 'ts-essentials';
|
|
4
4
|
import { RepoKey } from '../common/vcs';
|
|
5
5
|
import { Converter, DestinationRecord } from '../converter';
|
|
6
|
-
type PartialUser = Partial<Omit<User, 'type'> & {
|
|
6
|
+
export type PartialUser = Partial<Omit<User, 'type'> & {
|
|
7
7
|
type: string;
|
|
8
8
|
}>;
|
|
9
9
|
/** Common functions shares across GitHub converters */
|
|
@@ -42,4 +42,3 @@ export interface ProjectKey {
|
|
|
42
42
|
uid: string;
|
|
43
43
|
source: string;
|
|
44
44
|
}
|
|
45
|
-
export {};
|
|
@@ -3,6 +3,7 @@ import { DestinationModel, DestinationRecord, StreamContext } from '../converter
|
|
|
3
3
|
import { GitHubConverter } from './common';
|
|
4
4
|
export declare class FarosCopilotSeats extends GitHubConverter {
|
|
5
5
|
private readonly currentAssigneesByOrg;
|
|
6
|
+
private readonly endedSeatsByOrg;
|
|
6
7
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
7
8
|
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
9
|
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
@@ -9,6 +9,7 @@ class FarosCopilotSeats extends common_1.GitHubConverter {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.currentAssigneesByOrg = new Map();
|
|
12
|
+
this.endedSeatsByOrg = new Map();
|
|
12
13
|
this.destinationModels = [
|
|
13
14
|
'vcs_OrganizationTool',
|
|
14
15
|
'vcs_UserTool',
|
|
@@ -20,33 +21,48 @@ class FarosCopilotSeats extends common_1.GitHubConverter {
|
|
|
20
21
|
const org = (0, lodash_1.toLower)(data.org);
|
|
21
22
|
if (!this.currentAssigneesByOrg.has(org)) {
|
|
22
23
|
this.currentAssigneesByOrg.set(org, new Set());
|
|
24
|
+
this.endedSeatsByOrg.set(org, new Set());
|
|
23
25
|
}
|
|
24
26
|
if (data.empty) {
|
|
25
27
|
return [];
|
|
26
28
|
}
|
|
27
29
|
const seat = record.record.data;
|
|
28
|
-
this.currentAssigneesByOrg.get(org).add(seat.user);
|
|
29
30
|
const userTool = userToolKey(seat.user, seat.org, this.streamName.source);
|
|
31
|
+
if (seat.endedAt) {
|
|
32
|
+
this.endedSeatsByOrg.get(org).add(seat.user);
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
model: 'vcs_UserTool',
|
|
36
|
+
record: {
|
|
37
|
+
...userTool,
|
|
38
|
+
inactive: true,
|
|
39
|
+
endedAt: seat.endedAt,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
const activeSeat = record.record.data;
|
|
45
|
+
this.currentAssigneesByOrg.get(org).add(activeSeat.user);
|
|
30
46
|
const res = [];
|
|
31
47
|
res.push({
|
|
32
48
|
model: 'vcs_UserTool',
|
|
33
49
|
record: {
|
|
34
50
|
...userTool,
|
|
35
51
|
inactive: false,
|
|
36
|
-
...(
|
|
37
|
-
...(
|
|
38
|
-
endedAt:
|
|
39
|
-
? faros_js_client_1.Utils.toDate(
|
|
52
|
+
...(activeSeat.startedAt && { startedAt: activeSeat.startedAt }),
|
|
53
|
+
...(activeSeat.pending_cancellation_date !== undefined && {
|
|
54
|
+
endedAt: activeSeat.pending_cancellation_date
|
|
55
|
+
? faros_js_client_1.Utils.toDate(activeSeat.pending_cancellation_date)
|
|
40
56
|
: null,
|
|
41
57
|
}),
|
|
42
58
|
},
|
|
43
59
|
});
|
|
44
|
-
if (
|
|
60
|
+
if (activeSeat.last_activity_at) {
|
|
45
61
|
res.push({
|
|
46
62
|
model: 'vcs_UserToolUsage',
|
|
47
63
|
record: {
|
|
48
64
|
...userTool,
|
|
49
|
-
usedAt: faros_js_client_1.Utils.toDate(
|
|
65
|
+
usedAt: faros_js_client_1.Utils.toDate(activeSeat.last_activity_at),
|
|
50
66
|
},
|
|
51
67
|
});
|
|
52
68
|
}
|
|
@@ -79,7 +95,10 @@ class FarosCopilotSeats extends common_1.GitHubConverter {
|
|
|
79
95
|
['inactive', false],
|
|
80
96
|
]));
|
|
81
97
|
for await (const previousAssignee of previousAssigneesQuery) {
|
|
82
|
-
if (!this.currentAssigneesByOrg
|
|
98
|
+
if (!this.currentAssigneesByOrg
|
|
99
|
+
.get(org)
|
|
100
|
+
.has(previousAssignee.user.uid) &&
|
|
101
|
+
!this.endedSeatsByOrg.get(org).has(previousAssignee.user.uid)) {
|
|
83
102
|
res.push({
|
|
84
103
|
model: 'vcs_UserTool',
|
|
85
104
|
record: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faros_copilot_seats.js","sourceRoot":"","sources":["../../../src/converters/github/faros_copilot_seats.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"faros_copilot_seats.js","sourceRoot":"","sources":["../../../src/converters/github/faros_copilot_seats.ts"],"names":[],"mappings":";;;AACA,wDAKqC;AACrC,qDAAwD;AACxD,mCAA+B;AAG/B,qCAAyC;AAQzC,MAAa,iBAAkB,SAAQ,wBAAe;IAAtD;;QACmB,0BAAqB,GAAG,IAAI,GAAG,EAAuB,CAAC;QACvD,oBAAe,GAAG,IAAI,GAAG,EAAuB,CAAC;QAEzD,sBAAiB,GAAoC;YAC5D,sBAAsB;YACtB,cAAc;YACd,mBAAmB;SACpB,CAAC;IAwHJ,CAAC;IAtHC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAgC,CAAC;QAC5D,MAAM,GAAG,GAAG,IAAA,gBAAO,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACzC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;YAC/C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAsC,CAAC;QAClE,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CA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C,GAAG,CAAC,EAC7D,CAAC;wBACD,GAAG,CAAC,IAAI,CAAC;4BACP,KAAK,EAAE,cAAc;4BACrB,MAAM,EAAE;gCACN,GAAG,WAAW,CACZ,gBAAgB,CAAC,IAAI,CAAC,GAAG,EACzB,GAAG,EACH,IAAI,CAAC,UAAU,CAAC,MAAM,CACvB;gCACD,QAAQ,EAAE,IAAI;6BACf;yBACF,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAhID,8CAgIC;AAED,SAAS,WAAW,CAClB,SAAiB,EACjB,QAAgB,EAChB,MAAc;IAEd,OAAO;QACL,IAAI,EAAE,EAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAC;QAC9B,YAAY,EAAE,EAAC,GAAG,EAAE,IAAA,gBAAO,EAAC,QAAQ,CAAC,EAAE,MAAM,EAAC;QAC9C,IAAI,EAAE,EAAC,QAAQ,EAAE,mBAAU,CAAC,OAAO,EAAC;KACrC,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBvB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class FarosOutsideCollaborators extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FarosOutsideCollaborators = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class FarosOutsideCollaborators extends common_1.GitHubConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
const collaborator = record.record.data;
|
|
12
|
+
this.collectUser(collaborator);
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
async onProcessingComplete(ctx) {
|
|
16
|
+
return this.convertUsers();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.FarosOutsideCollaborators = FarosOutsideCollaborators;
|
|
20
|
+
//# sourceMappingURL=faros_outside_collaborators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faros_outside_collaborators.js","sourceRoot":"","sources":["../../../src/converters/github/faros_outside_collaborators.ts"],"names":[],"mappings":";;;AAIA,qCAAyC;AAEzC,MAAa,yBAA0B,SAAQ,wBAAe;IAA9D;;QACW,sBAAiB,GAAoC,EAAE,CAAC;IAgBnE,CAAC;IAdC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAA2B,CAAC;QAC/D,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,GAAkB;QAElB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;IAC7B,CAAC;CACF;AAjBD,8DAiBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class FarosPullRequestComments extends GitHubConverter {
|
|
5
|
+
private alias;
|
|
6
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
7
|
+
convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FarosPullRequestComments = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
const review_comments_1 = require("./review_comments");
|
|
6
|
+
class FarosPullRequestComments extends common_1.GitHubConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.alias = new review_comments_1.ReviewComments();
|
|
10
|
+
this.destinationModels = this.alias.destinationModels;
|
|
11
|
+
}
|
|
12
|
+
async convert(record) {
|
|
13
|
+
return this.alias.convert(record);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.FarosPullRequestComments = FarosPullRequestComments;
|
|
17
|
+
//# sourceMappingURL=faros_pull_request_comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faros_pull_request_comments.js","sourceRoot":"","sources":["../../../src/converters/github/faros_pull_request_comments.ts"],"names":[],"mappings":";;;AAGA,qCAAyC;AACzC,uDAAiF;AACjF,MAAa,wBAAyB,SAAQ,wBAAe;IAA7D;;QACU,UAAK,GAAG,IAAI,gCAA4B,EAAE,CAAC;QAE1C,sBAAiB,GACxB,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAOjC,CAAC;IALC,KAAK,CAAC,OAAO,CACX,MAAqB;QAErB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AAXD,4DAWC"}
|
|
@@ -6,6 +6,8 @@ export declare class FarosPullRequests extends GitHubConverter {
|
|
|
6
6
|
private collectedFiles;
|
|
7
7
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
8
8
|
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
9
|
+
private collectReviewRequestReviewers;
|
|
10
|
+
private addReviewer;
|
|
9
11
|
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
10
12
|
private collectBranch;
|
|
11
13
|
private convertBranches;
|
|
@@ -15,6 +15,7 @@ class FarosPullRequests extends common_1.GitHubConverter {
|
|
|
15
15
|
'vcs_PullRequestLabel',
|
|
16
16
|
'vcs_PullRequestFile',
|
|
17
17
|
'vcs_File',
|
|
18
|
+
'vcs_PullRequestReview',
|
|
18
19
|
];
|
|
19
20
|
}
|
|
20
21
|
async convert(record, ctx) {
|
|
@@ -44,6 +45,10 @@ class FarosPullRequests extends common_1.GitHubConverter {
|
|
|
44
45
|
pr.files.forEach((file) => {
|
|
45
46
|
this.collectFile(file.path, repoKey);
|
|
46
47
|
});
|
|
48
|
+
pr.reviews.forEach((review) => {
|
|
49
|
+
this.collectUser(review.author);
|
|
50
|
+
});
|
|
51
|
+
const requestedReviewers = this.collectReviewRequestReviewers(pr.reviewRequests);
|
|
47
52
|
const prKey = {
|
|
48
53
|
repository: repoKey,
|
|
49
54
|
number: pr.number,
|
|
@@ -84,19 +89,59 @@ class FarosPullRequests extends common_1.GitHubConverter {
|
|
|
84
89
|
label: { name: label.name },
|
|
85
90
|
},
|
|
86
91
|
})),
|
|
87
|
-
...pr.files.map((file) => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
...pr.files.map((file) => ({
|
|
93
|
+
model: 'vcs_PullRequestFile',
|
|
94
|
+
record: {
|
|
95
|
+
pullRequest: prKey,
|
|
96
|
+
file: { uid: file.path, repository: repoKey },
|
|
97
|
+
additions: file.additions,
|
|
98
|
+
deletions: file.deletions,
|
|
99
|
+
},
|
|
100
|
+
})),
|
|
101
|
+
...pr.reviews.map((review) => ({
|
|
102
|
+
model: 'vcs_PullRequestReview',
|
|
103
|
+
record: {
|
|
104
|
+
number: review.databaseId,
|
|
105
|
+
uid: review.databaseId.toString(),
|
|
106
|
+
htmlUrl: review.url,
|
|
107
|
+
pullRequest: prKey,
|
|
108
|
+
reviewer: review.author
|
|
109
|
+
? { uid: review.author.login, source: this.streamName.source }
|
|
110
|
+
: null,
|
|
111
|
+
state: review.state,
|
|
112
|
+
submittedAt: faros_js_client_1.Utils.toDate(review.submittedAt),
|
|
113
|
+
},
|
|
114
|
+
})),
|
|
115
|
+
...requestedReviewers.map((reviewer) => ({
|
|
116
|
+
model: 'vcs_PullRequestReviewRequest',
|
|
117
|
+
record: {
|
|
118
|
+
pullRequest: prKey,
|
|
119
|
+
requestedReviewer: { uid: reviewer, source: this.streamName.source },
|
|
120
|
+
},
|
|
121
|
+
})),
|
|
98
122
|
];
|
|
99
123
|
}
|
|
124
|
+
// Collects users and returns a list containing reviewers login
|
|
125
|
+
collectReviewRequestReviewers(reviewRequests) {
|
|
126
|
+
const reviewers = new Set();
|
|
127
|
+
reviewRequests.forEach((reviewRequest) => {
|
|
128
|
+
var _a;
|
|
129
|
+
const { requestedReviewer } = reviewRequest;
|
|
130
|
+
if (requestedReviewer.type === 'Team' &&
|
|
131
|
+
((_a = requestedReviewer.members) === null || _a === void 0 ? void 0 : _a.nodes)) {
|
|
132
|
+
requestedReviewer.members.nodes.forEach((member) => this.addReviewer(reviewers, member));
|
|
133
|
+
}
|
|
134
|
+
else if (requestedReviewer.type === 'User' ||
|
|
135
|
+
requestedReviewer.type === 'Mannequin') {
|
|
136
|
+
this.addReviewer(reviewers, requestedReviewer);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return Array.from(reviewers.values());
|
|
140
|
+
}
|
|
141
|
+
addReviewer(reviewers, reviewer) {
|
|
142
|
+
reviewers.add(reviewer.login);
|
|
143
|
+
this.collectUser(reviewer);
|
|
144
|
+
}
|
|
100
145
|
async onProcessingComplete(ctx) {
|
|
101
146
|
return [
|
|
102
147
|
...this.convertBranches(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faros_pull_requests.js","sourceRoot":"","sources":["../../../src/converters/github/faros_pull_requests.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"faros_pull_requests.js","sourceRoot":"","sources":["../../../src/converters/github/faros_pull_requests.ts"],"names":[],"mappings":";;;AAKA,qDAAsC;AACtC,mCAAkE;AAIlE,qCAAoE;AAapE,MAAa,iBAAkB,SAAQ,wBAAe;IAAtD;;QACU,sBAAiB,GAAG,IAAI,GAAG,EAAqB,CAAC;QACjD,mBAAc,GAAG,IAAI,GAAG,EAAmB,CAAC;QAE3C,sBAAiB,GAAoC;YAC5D,YAAY;YACZ,iBAAiB;YACjB,sBAAsB;YACtB,qBAAqB;YACrB,UAAU;YACV,uBAAuB;SACxB,CAAC;IA+MJ,CAAC;IA7MC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,IAAmB,CAAC;QAE7C,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;QAE5B,mBAAmB;QACnB,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE9C,MAAM,WAAW,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QACpD,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACrD,CAAC,CAAC,EAAC,QAAQ,EAAE,IAAA,mBAAU,EAAC,IAAA,kBAAS,EAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAC;YAClE,CAAC,CAAC,EAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAC,CAAC;QAE9C,M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EAAE,QAAQ;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,OAAO;SACpB,CAAC;QACF,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAEO,YAAY;QAClB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAChE,KAAK,EAAE,UAAU;YACjB,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AA1ND,8CA0NC;AAED,SAAS,SAAS,CAChB,UAAkB,EAClB,UAAyE,EACzE,MAAc;IAEd,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,qBAAY,CAAC,OAAO,CAC9B,UAAU,CAAC,KAAK,CAAC,KAAK,EACtB,UAAU,CAAC,IAAI,EACf,MAAM,CACP;KACF,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,SAAoB;IAC7C,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;AACnG,CAAC"}
|
|
@@ -4,4 +4,5 @@ import { GitHubConverter } from './common';
|
|
|
4
4
|
export declare class FarosTeamMemberships extends GitHubConverter {
|
|
5
5
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
6
|
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
8
|
}
|
|
@@ -11,16 +11,20 @@ class FarosTeamMemberships extends common_1.GitHubConverter {
|
|
|
11
11
|
}
|
|
12
12
|
async convert(record, ctx) {
|
|
13
13
|
const membership = record.record.data;
|
|
14
|
+
this.collectUser(membership.user);
|
|
14
15
|
return [
|
|
15
16
|
{
|
|
16
17
|
model: 'vcs_TeamMembership',
|
|
17
18
|
record: {
|
|
18
19
|
team: { uid: membership.team },
|
|
19
|
-
member: { uid: membership.user, source: this.streamName.source },
|
|
20
|
+
member: { uid: membership.user.login, source: this.streamName.source },
|
|
20
21
|
},
|
|
21
22
|
},
|
|
22
23
|
];
|
|
23
24
|
}
|
|
25
|
+
async onProcessingComplete(ctx) {
|
|
26
|
+
return [...this.convertUsers()];
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
exports.FarosTeamMemberships = FarosTeamMemberships;
|
|
26
30
|
//# sourceMappingURL=faros_team_memberships.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faros_team_memberships.js","sourceRoot":"","sources":["../../../src/converters/github/faros_team_memberships.ts"],"names":[],"mappings":";;;AAIA,qCAAyC;AAEzC,MAAa,oBAAqB,SAAQ,wBAAe;IAAzD;;QACW,sBAAiB,GAAoC;YAC5D,oBAAoB;SACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"faros_team_memberships.js","sourceRoot":"","sources":["../../../src/converters/github/faros_team_memberships.ts"],"names":[],"mappings":";;;AAIA,qCAAyC;AAEzC,MAAa,oBAAqB,SAAQ,wBAAe;IAAzD;;QACW,sBAAiB,GAAoC;YAC5D,oBAAoB;SACrB,CAAC;IAwBJ,CAAC;IAtBC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAsB,CAAC;QACxD,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,OAAO;YACL;gBACE,KAAK,EAAE,oBAAoB;gBAC3B,MAAM,EAAE;oBACN,IAAI,EAAE,EAAC,GAAG,EAAE,UAAU,CAAC,IAAI,EAAC;oBAC5B,MAAM,EAAE,EAAC,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAC;iBACrE;aACF;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,GAAkB;QAElB,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAClC,CAAC;CACF;AA3BD,oDA2BC"}
|