airbyte-faros-destination 0.10.28 → 0.10.30
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/bitbucket/commits.d.ts +1 -2
- package/lib/converters/bitbucket/commits.js +7 -18
- package/lib/converters/bitbucket/commits.js.map +1 -1
- package/lib/converters/bitbucket/common.d.ts +9 -4
- package/lib/converters/bitbucket/common.js +7 -73
- package/lib/converters/bitbucket/common.js.map +1 -1
- package/lib/converters/bitbucket/{pull_request_activities.d.ts → pull_requests_with_activities.d.ts} +4 -1
- package/lib/converters/bitbucket/{pull_request_activities.js → pull_requests_with_activities.js} +78 -14
- package/lib/converters/bitbucket/pull_requests_with_activities.js.map +1 -0
- package/lib/converters/bitbucket/tags.d.ts +7 -0
- package/lib/converters/bitbucket/tags.js +37 -0
- package/lib/converters/bitbucket/tags.js.map +1 -0
- package/lib/converters/bitbucket/workspace_users.d.ts +1 -2
- package/lib/converters/bitbucket/workspace_users.js +32 -6
- package/lib/converters/bitbucket/workspace_users.js.map +1 -1
- package/lib/converters/notion/common.d.ts +88 -88
- package/lib/destination.d.ts +1 -2
- package/lib/destination.js +1 -46
- package/lib/destination.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/lib/converters/bitbucket/issues.d.ts +0 -12
- package/lib/converters/bitbucket/issues.js +0 -129
- package/lib/converters/bitbucket/issues.js.map +0 -1
- package/lib/converters/bitbucket/pull_request_activities.js.map +0 -1
- package/lib/converters/bitbucket/pull_requests.d.ts +0 -10
- package/lib/converters/bitbucket/pull_requests.js +0 -98
- package/lib/converters/bitbucket/pull_requests.js.map +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
-
import { DestinationModel, DestinationRecord
|
|
2
|
+
import { DestinationModel, DestinationRecord } from '../converter';
|
|
3
3
|
import { BitbucketConverter } from './common';
|
|
4
4
|
export declare class Commits extends BitbucketConverter {
|
|
5
5
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
6
|
id(record: AirbyteRecord): any;
|
|
7
7
|
convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
-
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
9
8
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Commits = void 0;
|
|
4
4
|
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
5
|
const common_1 = require("./common");
|
|
7
6
|
class Commits extends common_1.BitbucketConverter {
|
|
8
7
|
constructor() {
|
|
@@ -14,7 +13,7 @@ class Commits extends common_1.BitbucketConverter {
|
|
|
14
13
|
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.hash;
|
|
15
14
|
}
|
|
16
15
|
async convert(record) {
|
|
17
|
-
var _a, _b
|
|
16
|
+
var _a, _b;
|
|
18
17
|
const source = this.streamName.source;
|
|
19
18
|
const commit = record.record.data;
|
|
20
19
|
const res = [];
|
|
@@ -22,33 +21,23 @@ class Commits extends common_1.BitbucketConverter {
|
|
|
22
21
|
if (!workspace || !repo) {
|
|
23
22
|
return res;
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
if ((_b = (_a = commit === null || commit === void 0 ? void 0 : commit.author) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.accountId) {
|
|
27
|
-
const commitUser = commit.author.user;
|
|
28
|
-
this.collectUser(commitUser, workspace);
|
|
29
|
-
author = { uid: commitUser.accountId, source };
|
|
30
|
-
}
|
|
24
|
+
const commitUser = (_a = commit === null || commit === void 0 ? void 0 : commit.author) === null || _a === void 0 ? void 0 : _a.user;
|
|
31
25
|
res.push({
|
|
32
26
|
model: 'vcs_Commit',
|
|
33
27
|
record: {
|
|
34
28
|
sha: commit.hash,
|
|
35
29
|
uid: commit.hash,
|
|
36
30
|
message: commit.message,
|
|
37
|
-
htmlUrl: (
|
|
31
|
+
htmlUrl: (_b = commit.links) === null || _b === void 0 ? void 0 : _b.htmlUrl,
|
|
38
32
|
createdAt: faros_js_client_1.Utils.toDate(commit.date),
|
|
39
|
-
author
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
name: (0, lodash_1.toLower)(repo),
|
|
44
|
-
},
|
|
33
|
+
author: (commitUser === null || commitUser === void 0 ? void 0 : commitUser.accountId)
|
|
34
|
+
? { uid: commitUser.accountId, source }
|
|
35
|
+
: null,
|
|
36
|
+
repository: common_1.BitbucketCommon.vcs_Repository(workspace, repo, source),
|
|
45
37
|
},
|
|
46
38
|
});
|
|
47
39
|
return res;
|
|
48
40
|
}
|
|
49
|
-
async onProcessingComplete(ctx) {
|
|
50
|
-
return this.convertUsers();
|
|
51
|
-
}
|
|
52
41
|
}
|
|
53
42
|
exports.Commits = Commits;
|
|
54
43
|
//# sourceMappingURL=commits.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commits.js","sourceRoot":"","sources":["../../../src/converters/bitbucket/commits.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;
|
|
1
|
+
{"version":3,"file":"commits.js","sourceRoot":"","sources":["../../../src/converters/bitbucket/commits.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;AAGtC,qCAA6D;AAE7D,MAAa,OAAQ,SAAQ,2BAAkB;IAA/C;;QACW,sBAAiB,GAAoC,CAAC,YAAY,CAAC,CAAC;IAsC/E,CAAC;IApCC,EAAE,CAAC,MAAqB;;QACtB,OAAO,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,IAAI,0CAAE,IAAI,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAqB;;QAErB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAc,CAAC;QAC5C,MAAM,GAAG,GAAwB,EAAE,CAAC;QAEpC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEhE,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,EAAE,CAAC;YACxB,OAAO,GAAG,CAAC;QACb,CAAC;QAED,MAAM,UAAU,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,IAAI,CAAC;QAExC,GAAG,CAAC,IAAI,CAAC;YACP,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE;gBACN,GAAG,EAAE,MAAM,CAAC,IAAI;gBAChB,GAAG,EAAE,MAAM,CAAC,IAAI;gBAChB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,OAAO,EAAE,MAAA,MAAM,CAAC,KAAK,0CAAE,OAAO;gBAC9B,SAAS,EAAE,uBAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;gBACpC,MAAM,EAAE,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS;oBAC3B,CAAC,CAAC,EAAC,GAAG,EAAE,UAAU,CAAC,SAAS,EAAE,MAAM,EAAC;oBACrC,CAAC,CAAC,IAAI;gBACR,UAAU,EAAE,wBAAe,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC;aACpE;SACF,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAvCD,0BAuCC"}
|
|
@@ -24,11 +24,19 @@ export interface ProjectKey {
|
|
|
24
24
|
uid: string;
|
|
25
25
|
source: string;
|
|
26
26
|
}
|
|
27
|
+
export interface RepositoryRecord {
|
|
28
|
+
uid: string;
|
|
29
|
+
name: string;
|
|
30
|
+
organization: {
|
|
31
|
+
uid: string;
|
|
32
|
+
source: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
27
35
|
/** Common functions shares across Bitbucket converters */
|
|
28
36
|
export declare class BitbucketCommon {
|
|
29
37
|
static MAX_DESCRIPTION_LENGTH: number;
|
|
30
|
-
static vcsUser(user: PartialUser, source: string): DestinationRecord | undefined;
|
|
31
38
|
static tms_ProjectBoard_with_TaskBoard(projectKey: ProjectKey, name: string, description: string | null, createdAt: string | null | undefined, updatedAt: string | null | undefined): DestinationRecord[];
|
|
39
|
+
static vcs_Repository(workspace: string, repo: string, source: string): RepositoryRecord;
|
|
32
40
|
}
|
|
33
41
|
/** Bitbucket converter base */
|
|
34
42
|
export declare abstract class BitbucketConverter extends Converter {
|
|
@@ -39,8 +47,5 @@ export declare abstract class BitbucketConverter extends Converter {
|
|
|
39
47
|
protected bitbucketConfig(ctx: StreamContext): BitbucketConfig;
|
|
40
48
|
protected applicationMapping(ctx: StreamContext): ApplicationMapping;
|
|
41
49
|
protected maxDescriptionLength(ctx: StreamContext): number;
|
|
42
|
-
protected collectUser(user: PartialUser, workspace: string): void;
|
|
43
|
-
protected convertUsers(): DestinationRecord[];
|
|
44
|
-
private getFinalUser;
|
|
45
50
|
}
|
|
46
51
|
export {};
|
|
@@ -13,25 +13,6 @@ var UserTypeCategory;
|
|
|
13
13
|
})(UserTypeCategory || (exports.UserTypeCategory = UserTypeCategory = {}));
|
|
14
14
|
/** Common functions shares across Bitbucket converters */
|
|
15
15
|
class BitbucketCommon {
|
|
16
|
-
static vcsUser(user, source) {
|
|
17
|
-
var _a;
|
|
18
|
-
if (!user.accountId)
|
|
19
|
-
return undefined;
|
|
20
|
-
const userType = user.type === 'user'
|
|
21
|
-
? { category: UserTypeCategory.USER, detail: 'user' }
|
|
22
|
-
: { category: UserTypeCategory.CUSTOM, detail: user.type };
|
|
23
|
-
return {
|
|
24
|
-
model: 'vcs_User',
|
|
25
|
-
record: {
|
|
26
|
-
uid: user.accountId,
|
|
27
|
-
name: user.displayName,
|
|
28
|
-
email: user.emailAddress,
|
|
29
|
-
type: userType,
|
|
30
|
-
htmlUrl: (_a = user.links) === null || _a === void 0 ? void 0 : _a.htmlUrl,
|
|
31
|
-
source,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
16
|
static tms_ProjectBoard_with_TaskBoard(projectKey, name, description, createdAt, updatedAt) {
|
|
36
17
|
return [
|
|
37
18
|
{
|
|
@@ -60,6 +41,13 @@ class BitbucketCommon {
|
|
|
60
41
|
},
|
|
61
42
|
];
|
|
62
43
|
}
|
|
44
|
+
static vcs_Repository(workspace, repo, source) {
|
|
45
|
+
return {
|
|
46
|
+
name: (0, lodash_1.toLower)(repo),
|
|
47
|
+
uid: (0, lodash_1.toLower)(repo),
|
|
48
|
+
organization: { uid: (0, lodash_1.toLower)(workspace), source },
|
|
49
|
+
};
|
|
50
|
+
}
|
|
63
51
|
}
|
|
64
52
|
exports.BitbucketCommon = BitbucketCommon;
|
|
65
53
|
// max length for free-form description text field
|
|
@@ -88,60 +76,6 @@ class BitbucketConverter extends converter_1.Converter {
|
|
|
88
76
|
var _a, _b;
|
|
89
77
|
return ((_b = (_a = this.bitbucketConfig(ctx)) === null || _a === void 0 ? void 0 : _a.max_description_length) !== null && _b !== void 0 ? _b : BitbucketCommon.MAX_DESCRIPTION_LENGTH);
|
|
90
78
|
}
|
|
91
|
-
collectUser(user, workspace) {
|
|
92
|
-
var _a;
|
|
93
|
-
if (!(user === null || user === void 0 ? void 0 : user.accountId))
|
|
94
|
-
return;
|
|
95
|
-
if (!this.collectedUsers.has(user.accountId)) {
|
|
96
|
-
this.collectedUsers.set(user.accountId, []);
|
|
97
|
-
}
|
|
98
|
-
(_a = this.collectedUsers.get(user.accountId)) === null || _a === void 0 ? void 0 : _a.push({
|
|
99
|
-
...user,
|
|
100
|
-
workspace,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
convertUsers() {
|
|
104
|
-
const records = [];
|
|
105
|
-
const source = this.streamName.source;
|
|
106
|
-
for (const [accountId, users] of this.collectedUsers.entries()) {
|
|
107
|
-
const emails = new Set(users.map((user) => user.emailAddress).filter((email) => !!email));
|
|
108
|
-
for (const email of emails) {
|
|
109
|
-
records.push({
|
|
110
|
-
model: 'vcs_UserEmail',
|
|
111
|
-
record: {
|
|
112
|
-
user: { uid: accountId, source },
|
|
113
|
-
email,
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
const workspaces = new Set(users.map((user) => user.workspace).filter((org) => !(0, lodash_1.isEmpty)(org)));
|
|
118
|
-
for (const workspace of workspaces) {
|
|
119
|
-
records.push({
|
|
120
|
-
model: 'vcs_Membership',
|
|
121
|
-
record: {
|
|
122
|
-
user: { uid: accountId, source },
|
|
123
|
-
organization: { uid: (0, lodash_1.toLower)(workspace), source },
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
const finalUser = this.getFinalUser(users);
|
|
128
|
-
records.push(BitbucketCommon.vcsUser(finalUser, source));
|
|
129
|
-
}
|
|
130
|
-
return records;
|
|
131
|
-
}
|
|
132
|
-
// Replace non-null user attributes to our copy of the user
|
|
133
|
-
// e.g. accountId, displayName, emailAddress, type, links.
|
|
134
|
-
getFinalUser(users) {
|
|
135
|
-
const finalUser = {};
|
|
136
|
-
for (const user of users) {
|
|
137
|
-
for (const key in user) {
|
|
138
|
-
if (!finalUser[key] && user[key]) {
|
|
139
|
-
finalUser[key] = user[key];
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return finalUser;
|
|
144
|
-
}
|
|
145
79
|
}
|
|
146
80
|
exports.BitbucketConverter = BitbucketConverter;
|
|
147
81
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/bitbucket/common.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/bitbucket/common.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;AACtC,mCAA+B;AAE/B,4CAKsB;AActB,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,iDAA6B,CAAA;IAC7B,iCAAa,CAAA;IACb,qCAAiB,CAAA;AACnB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAeD,0DAA0D;AAC1D,MAAa,eAAe;IAI1B,MAAM,CAAC,+BAA+B,CACpC,UAAsB,EACtB,IAAY,EACZ,WAA0B,EAC1B,SAAoC,EACpC,SAAoC;QAEpC,OAAO;YACL;gBACE,KAAK,EAAE,aAAa;gBACpB,MAAM,EAAE;oBACN,GAAG,UAAU;oBACb,IAAI,EAAE,IAAI;oBACV,WAAW,EAAE,uBAAK,CAAC,gBAAgB,CACjC,WAAW,EACX,eAAe,CAAC,sBAAsB,CACvC;oBACD,SAAS,EAAE,uBAAK,CAAC,MAAM,CAAC,SAAS,CAAC;oBAClC,SAAS,EAAE,uBAAK,CAAC,MAAM,CAAC,SAAS,CAAC;iBACnC;aACF;YACD;gBACE,KAAK,EAAE,eAAe;gBACtB,MAAM,EAAE;oBACN,GAAG,UAAU;oBACb,IAAI;iBACL;aACF;YACD;gBACE,KAAK,EAAE,kCAAkC;gBACzC,MAAM,EAAE;oBACN,KAAK,EAAE,UAAU;oBACjB,OAAO,EAAE,UAAU;iBACpB;aACF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,cAAc,CACnB,SAAiB,EACjB,IAAY,EACZ,MAAc;QAEd,OAAO;YACL,IAAI,EAAE,IAAA,gBAAO,EAAC,IAAI,CAAC;YACnB,GAAG,EAAE,IAAA,gBAAO,EAAC,IAAI,CAAC;YAClB,YAAY,EAAE,EAAC,GAAG,EAAE,IAAA,gBAAO,EAAC,SAAS,CAAC,EAAE,MAAM,EAAC;SAChD,CAAC;IACJ,CAAC;;AApDH,0CAqDC;AApDC,kDAAkD;AAC3C,sCAAsB,GAAG,IAAI,CAAC;AAqDvC,+BAA+B;AAC/B,MAAsB,kBAAmB,SAAQ,qBAAS;IAA1D;;QACE,WAAM,GAAG,WAAW,CAAC;QAEX,mBAAc,GAAG,IAAI,GAAG,EAA8B,CAAC;IA0BnE,CAAC;IAxBC,2DAA2D;IAC3D,EAAE,CAAC,MAAqB;;QACtB,OAAO,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,IAAI,0CAAE,EAAE,CAAC;IAClC,CAAC;IAES,eAAe,CAAC,GAAkB;;QAC1C,OAAO,MAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,uBAAuB,0CAAE,SAAS,CAAC;IACxD,CAAC;IAES,kBAAkB,CAAC,GAAkB;;QAC7C,OAAO,CACL,MAAA,IAAA,6BAAiB,EACf,MAAA,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,0CAAE,mBAAmB,EAC9C,qBAAqB,CACtB,mCAAI,EAAE,CACR,CAAC;IACJ,CAAC;IAES,oBAAoB,CAAC,GAAkB;;QAC/C,OAAO,CACL,MAAA,MAAA,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,0CAAE,sBAAsB,mCACjD,eAAe,CAAC,sBAAsB,CACvC,CAAC;IACJ,CAAC;CACF;AA7BD,gDA6BC"}
|
package/lib/converters/bitbucket/{pull_request_activities.d.ts → pull_requests_with_activities.d.ts}
RENAMED
|
@@ -2,9 +2,12 @@ import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
|
2
2
|
import { PRActivity } from 'faros-airbyte-common/bitbucket';
|
|
3
3
|
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
4
4
|
import { BitbucketConverter } from './common';
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class PullRequestsWithActivities extends BitbucketConverter {
|
|
6
6
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
7
7
|
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
private processPullRequest;
|
|
9
|
+
private toPrState;
|
|
10
|
+
private processActivity;
|
|
8
11
|
reviewState(prActivity: PRActivity): {
|
|
9
12
|
category: string;
|
|
10
13
|
detail: string | null;
|
package/lib/converters/bitbucket/{pull_request_activities.js → pull_requests_with_activities.js}
RENAMED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PullRequestsWithActivities = void 0;
|
|
4
4
|
const faros_js_client_1 = require("faros-js-client");
|
|
5
5
|
const common_1 = require("./common");
|
|
6
|
+
var PullRequestStateCategory;
|
|
7
|
+
(function (PullRequestStateCategory) {
|
|
8
|
+
PullRequestStateCategory["CLOSED"] = "Closed";
|
|
9
|
+
PullRequestStateCategory["MERGED"] = "Merged";
|
|
10
|
+
PullRequestStateCategory["OPEN"] = "Open";
|
|
11
|
+
PullRequestStateCategory["CUSTOM"] = "Custom";
|
|
12
|
+
})(PullRequestStateCategory || (PullRequestStateCategory = {}));
|
|
6
13
|
var PullRequestReviewStateCategory;
|
|
7
14
|
(function (PullRequestReviewStateCategory) {
|
|
8
15
|
PullRequestReviewStateCategory["APPROVED"] = "Approved";
|
|
@@ -11,19 +18,83 @@ var PullRequestReviewStateCategory;
|
|
|
11
18
|
PullRequestReviewStateCategory["DISMISSED"] = "Dismissed";
|
|
12
19
|
PullRequestReviewStateCategory["CUSTOM"] = "Custom";
|
|
13
20
|
})(PullRequestReviewStateCategory || (PullRequestReviewStateCategory = {}));
|
|
14
|
-
class
|
|
21
|
+
class PullRequestsWithActivities extends common_1.BitbucketConverter {
|
|
15
22
|
constructor() {
|
|
16
23
|
super(...arguments);
|
|
17
24
|
this.destinationModels = [
|
|
18
|
-
'
|
|
25
|
+
'vcs_PullRequest',
|
|
19
26
|
'vcs_PullRequestComment',
|
|
20
27
|
'vcs_PullRequestReview',
|
|
21
28
|
];
|
|
22
29
|
}
|
|
23
30
|
async convert(record, ctx) {
|
|
31
|
+
const { type, pullRequest, activity } = record.record
|
|
32
|
+
.data;
|
|
33
|
+
if (type === 'PullRequest') {
|
|
34
|
+
return this.processPullRequest(pullRequest, ctx);
|
|
35
|
+
}
|
|
36
|
+
else if (type === 'PullRequestActivity') {
|
|
37
|
+
return this.processActivity(activity, ctx);
|
|
38
|
+
}
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
processPullRequest(pullRequest, ctx) {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
43
|
+
const source = this.streamName.source;
|
|
44
|
+
const res = [];
|
|
45
|
+
const [workspace, repo] = (((_b = (_a = pullRequest === null || pullRequest === void 0 ? void 0 : pullRequest.source) === null || _a === void 0 ? void 0 : _a.repository) === null || _b === void 0 ? void 0 : _b.fullName) ||
|
|
46
|
+
((_d = (_c = pullRequest === null || pullRequest === void 0 ? void 0 : pullRequest.destination) === null || _c === void 0 ? void 0 : _c.repository) === null || _d === void 0 ? void 0 : _d.fullName) ||
|
|
47
|
+
'').split('/');
|
|
48
|
+
if (!workspace || !repo)
|
|
49
|
+
return res;
|
|
50
|
+
const repoRef = common_1.BitbucketCommon.vcs_Repository(workspace, repo, source);
|
|
51
|
+
const commitHash = (_e = pullRequest === null || pullRequest === void 0 ? void 0 : pullRequest.mergeCommit) === null || _e === void 0 ? void 0 : _e.hash;
|
|
52
|
+
const mergeCommit = commitHash
|
|
53
|
+
? { repository: repoRef, sha: commitHash, uid: commitHash }
|
|
54
|
+
: null;
|
|
55
|
+
let author = null;
|
|
56
|
+
if ((_f = pullRequest === null || pullRequest === void 0 ? void 0 : pullRequest.author) === null || _f === void 0 ? void 0 : _f.accountId) {
|
|
57
|
+
author = { uid: pullRequest.author.accountId, source };
|
|
58
|
+
}
|
|
59
|
+
res.push({
|
|
60
|
+
model: 'vcs_PullRequest',
|
|
61
|
+
record: {
|
|
62
|
+
number: pullRequest.id,
|
|
63
|
+
uid: pullRequest.id.toString(),
|
|
64
|
+
title: pullRequest.title,
|
|
65
|
+
description: faros_js_client_1.Utils.cleanAndTruncate(pullRequest.description, this.maxDescriptionLength(ctx)),
|
|
66
|
+
state: this.toPrState(pullRequest.state),
|
|
67
|
+
htmlUrl: (_g = pullRequest === null || pullRequest === void 0 ? void 0 : pullRequest.links) === null || _g === void 0 ? void 0 : _g.htmlUrl,
|
|
68
|
+
createdAt: faros_js_client_1.Utils.toDate(pullRequest.createdOn),
|
|
69
|
+
updatedAt: faros_js_client_1.Utils.toDate(pullRequest.updatedOn),
|
|
70
|
+
mergedAt: faros_js_client_1.Utils.toDate((_h = pullRequest.calculatedActivity) === null || _h === void 0 ? void 0 : _h.mergedAt),
|
|
71
|
+
commentCount: pullRequest.commentCount,
|
|
72
|
+
commitCount: (_j = pullRequest.calculatedActivity) === null || _j === void 0 ? void 0 : _j.commitCount,
|
|
73
|
+
diffStats: pullRequest.diffStat,
|
|
74
|
+
author,
|
|
75
|
+
mergeCommit,
|
|
76
|
+
repository: repoRef,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
return res;
|
|
80
|
+
}
|
|
81
|
+
toPrState(state) {
|
|
82
|
+
const stateLower = state === null || state === void 0 ? void 0 : state.toLowerCase();
|
|
83
|
+
switch (stateLower) {
|
|
84
|
+
case 'open':
|
|
85
|
+
return { category: PullRequestStateCategory.OPEN, detail: stateLower };
|
|
86
|
+
case 'merged':
|
|
87
|
+
return { category: PullRequestStateCategory.MERGED, detail: stateLower };
|
|
88
|
+
case 'superseded':
|
|
89
|
+
case 'declined':
|
|
90
|
+
return { category: PullRequestStateCategory.CLOSED, detail: stateLower };
|
|
91
|
+
default:
|
|
92
|
+
return { category: PullRequestStateCategory.CUSTOM, detail: stateLower };
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
processActivity(prActivity, ctx) {
|
|
24
96
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
25
97
|
const source = this.streamName.source;
|
|
26
|
-
const prActivity = record.record.data;
|
|
27
98
|
const res = [];
|
|
28
99
|
const change = (_c = (_b = (_a = prActivity === null || prActivity === void 0 ? void 0 : prActivity.comment) !== null && _a !== void 0 ? _a : prActivity === null || prActivity === void 0 ? void 0 : prActivity.approval) !== null && _b !== void 0 ? _b : prActivity === null || prActivity === void 0 ? void 0 : prActivity.changes_requested) !== null && _c !== void 0 ? _c : prActivity === null || prActivity === void 0 ? void 0 : prActivity.update;
|
|
29
100
|
const date = faros_js_client_1.Utils.toDate((_e = (_d = change === null || change === void 0 ? void 0 : change.date) !== null && _d !== void 0 ? _d : change === null || change === void 0 ? void 0 : change.updated_on) !== null && _e !== void 0 ? _e : change === null || change === void 0 ? void 0 : change.created_on);
|
|
@@ -35,15 +106,8 @@ class PullRequestActivities extends common_1.BitbucketConverter {
|
|
|
35
106
|
ctx.logger.info(`Ignored activity for pull request ${prActivity.pullRequest.id} in repo ${prActivity.pullRequest.repositorySlug}, since it has no id: ${JSON.stringify(change)}`);
|
|
36
107
|
return res;
|
|
37
108
|
}
|
|
38
|
-
let reviewer = null;
|
|
39
109
|
const user = (_g = change === null || change === void 0 ? void 0 : change.author) !== null && _g !== void 0 ? _g : change === null || change === void 0 ? void 0 : change.user;
|
|
40
|
-
|
|
41
|
-
const userRecord = common_1.BitbucketCommon.vcsUser(user, source);
|
|
42
|
-
if (userRecord) {
|
|
43
|
-
res.push(userRecord);
|
|
44
|
-
reviewer = { uid: user.accountId, source };
|
|
45
|
-
}
|
|
46
|
-
}
|
|
110
|
+
const reviewer = (user === null || user === void 0 ? void 0 : user.accountId) ? { uid: user.accountId, source } : null;
|
|
47
111
|
const orgRef = {
|
|
48
112
|
uid: (_j = (_h = prActivity === null || prActivity === void 0 ? void 0 : prActivity.pullRequest) === null || _h === void 0 ? void 0 : _h.workspace) === null || _j === void 0 ? void 0 : _j.toLowerCase(),
|
|
49
113
|
source,
|
|
@@ -109,5 +173,5 @@ class PullRequestActivities extends common_1.BitbucketConverter {
|
|
|
109
173
|
return undefined;
|
|
110
174
|
}
|
|
111
175
|
}
|
|
112
|
-
exports.
|
|
113
|
-
//# sourceMappingURL=
|
|
176
|
+
exports.PullRequestsWithActivities = PullRequestsWithActivities;
|
|
177
|
+
//# sourceMappingURL=pull_requests_with_activities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull_requests_with_activities.js","sourceRoot":"","sources":["../../../src/converters/bitbucket/pull_requests_with_activities.ts"],"names":[],"mappings":";;;AAOA,qDAAsC;AAGtC,qCAA0E;AAE1E,IAAK,wBAKJ;AALD,WAAK,wBAAwB;IAC3B,6CAAiB,CAAA;IACjB,6CAAiB,CAAA;IACjB,yCAAa,CAAA;IACb,6CAAiB,CAAA;AACnB,CAAC,EALI,wBAAwB,KAAxB,wBAAwB,QAK5B;AAED,IAAK,8BAMJ;AAND,WAAK,8BAA8B;IACjC,uDAAqB,CAAA;IACrB,yDAAuB,CAAA;IACvB,wEAAsC,CAAA;IACtC,yDAAuB,CAAA;IACvB,mDAAiB,CAAA;AACnB,CAAC,EANI,8BAA8B,KAA9B,8BAA8B,QAMlC;AAED,MAAa,0BAA2B,SAAQ,2BAAkB;IAAlE;;QACW,sBAAiB,GAAoC;YAC5D,iBAAiB;YACjB,wBAAwB;YACxB,uBAAuB;SACxB,CAAC;IA2LJ,CAAC;IAzLC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,EAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAC,GAAG,MAAM,CAAC,MAAM;aAChD,IAA6B,CAAC;QACjC,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC;aAAM,IAAI,IAAI,KAAK,qBAAqB,EAAE,CAAC;YAC1C,OAAO,IAA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AAI,EAAC,CAAC;QAC5E,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ;YACtB,OAAO,EAAC,QAAQ,EAAE,8BAA8B,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;QAC3E,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,iBAAiB;YAC/B,OAAO;gBACL,QAAQ,EAAE,8BAA8B,CAAC,iBAAiB;gBAC1D,MAAM,EAAE,IAAI;aACb,CAAC;QACJ,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,KAAI,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,0CAAE,KAAK,MAAK,UAAU;YAChE,OAAO,EAAC,QAAQ,EAAE,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;QAC5E,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAhMD,gEAgMC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { BitbucketConverter } from './common';
|
|
4
|
+
export declare class Tags extends BitbucketConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tags = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Tags extends common_1.BitbucketConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = ['vcs_Tag'];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
var _a;
|
|
12
|
+
const source = this.streamName.source;
|
|
13
|
+
const tag = record.record.data;
|
|
14
|
+
const sha = (_a = tag.target) === null || _a === void 0 ? void 0 : _a.hash;
|
|
15
|
+
if (!sha) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const [workspace, repo] = tag.repository.fullName.split('/');
|
|
19
|
+
if (!workspace || !repo) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
const repository = common_1.BitbucketCommon.vcs_Repository(workspace, repo, source);
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
model: 'vcs_Tag',
|
|
26
|
+
record: {
|
|
27
|
+
name: tag.name,
|
|
28
|
+
message: tag.message,
|
|
29
|
+
commit: { sha, uid: sha, repository },
|
|
30
|
+
repository,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.Tags = Tags;
|
|
37
|
+
//# sourceMappingURL=tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../src/converters/bitbucket/tags.ts"],"names":[],"mappings":";;;AAIA,qCAA6D;AAE7D,MAAa,IAAK,SAAQ,2BAAkB;IAA5C;;QACW,sBAAiB,GAAoC,CAAC,SAAS,CAAC,CAAC;IAiC5E,CAAC;IA/BC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAW,CAAC;QAEtC,MAAM,GAAG,GAAG,MAAA,GAAG,CAAC,MAAM,0CAAE,IAAI,CAAC;QAC7B,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE7D,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,EAAE,CAAC;YACxB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,UAAU,GAAG,wBAAe,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3E,OAAO;YACL;gBACE,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE;oBACN,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,OAAO,EAAE,GAAG,CAAC,OAAO;oBACpB,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAC;oBACnC,UAAU;iBACX;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAlCD,oBAkCC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
-
import { DestinationModel, DestinationRecord
|
|
2
|
+
import { DestinationModel, DestinationRecord } from '../converter';
|
|
3
3
|
import { BitbucketConverter } from './common';
|
|
4
4
|
export declare class WorkspaceUsers extends BitbucketConverter {
|
|
5
5
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
6
|
convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
-
onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WorkspaceUsers = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
4
5
|
const common_1 = require("./common");
|
|
5
6
|
class WorkspaceUsers extends common_1.BitbucketConverter {
|
|
6
7
|
constructor() {
|
|
@@ -11,12 +12,37 @@ class WorkspaceUsers extends common_1.BitbucketConverter {
|
|
|
11
12
|
];
|
|
12
13
|
}
|
|
13
14
|
async convert(record) {
|
|
14
|
-
|
|
15
|
-
this.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
var _a;
|
|
16
|
+
const source = this.streamName.source;
|
|
17
|
+
const { user, workspace } = record.record.data;
|
|
18
|
+
if (!(user === null || user === void 0 ? void 0 : user.accountId))
|
|
19
|
+
return [];
|
|
20
|
+
const userType = user.type === 'user'
|
|
21
|
+
? { category: common_1.UserTypeCategory.USER, detail: 'user' }
|
|
22
|
+
: { category: common_1.UserTypeCategory.CUSTOM, detail: user.type };
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
model: 'vcs_User',
|
|
26
|
+
record: {
|
|
27
|
+
uid: user.accountId,
|
|
28
|
+
name: user.displayName,
|
|
29
|
+
email: user.emailAddress,
|
|
30
|
+
type: userType,
|
|
31
|
+
htmlUrl: (_a = user.links) === null || _a === void 0 ? void 0 : _a.htmlUrl,
|
|
32
|
+
source,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
model: 'vcs_Membership',
|
|
37
|
+
record: {
|
|
38
|
+
user: { uid: user.accountId, source },
|
|
39
|
+
organization: {
|
|
40
|
+
uid: (0, lodash_1.toLower)(workspace.slug),
|
|
41
|
+
source,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
];
|
|
20
46
|
}
|
|
21
47
|
}
|
|
22
48
|
exports.WorkspaceUsers = WorkspaceUsers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace_users.js","sourceRoot":"","sources":["../../../src/converters/bitbucket/workspace_users.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"workspace_users.js","sourceRoot":"","sources":["../../../src/converters/bitbucket/workspace_users.ts"],"names":[],"mappings":";;;AAEA,mCAA+B;AAG/B,qCAA8D;AAE9D,MAAa,cAAe,SAAQ,2BAAkB;IAAtD;;QACW,sBAAiB,GAAoC;YAC5D,U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