airbyte-faros-destination 0.1.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.
- package/README.md +161 -0
- package/lib/common/write-stats.d.ts +16 -0
- package/lib/common/write-stats.js +48 -0
- package/lib/community/hasura-client.d.ts +27 -0
- package/lib/community/hasura-client.js +278 -0
- package/lib/community/hasura-writer.d.ts +12 -0
- package/lib/community/hasura-writer.js +44 -0
- package/lib/community/types.d.ts +26 -0
- package/lib/community/types.js +9 -0
- package/lib/converters/agileaccelerator/agileaccelerator_types.d.ts +315 -0
- package/lib/converters/agileaccelerator/agileaccelerator_types.js +81 -0
- package/lib/converters/agileaccelerator/common.d.ts +64 -0
- package/lib/converters/agileaccelerator/common.js +167 -0
- package/lib/converters/agileaccelerator/works.d.ts +7 -0
- package/lib/converters/agileaccelerator/works.js +105 -0
- package/lib/converters/asana/common.d.ts +39 -0
- package/lib/converters/asana/common.js +64 -0
- package/lib/converters/asana/projects.d.ts +7 -0
- package/lib/converters/asana/projects.js +29 -0
- package/lib/converters/asana/sections.d.ts +7 -0
- package/lib/converters/asana/sections.js +28 -0
- package/lib/converters/asana/stories.d.ts +7 -0
- package/lib/converters/asana/stories.js +32 -0
- package/lib/converters/asana/tags.d.ts +7 -0
- package/lib/converters/asana/tags.js +22 -0
- package/lib/converters/asana/tasks.d.ts +11 -0
- package/lib/converters/asana/tasks.js +160 -0
- package/lib/converters/asana/users.d.ts +7 -0
- package/lib/converters/asana/users.js +16 -0
- package/lib/converters/backlog/common.d.ts +20 -0
- package/lib/converters/backlog/common.js +59 -0
- package/lib/converters/backlog/issues.d.ts +7 -0
- package/lib/converters/backlog/issues.js +119 -0
- package/lib/converters/backlog/models.d.ts +156 -0
- package/lib/converters/backlog/models.js +23 -0
- package/lib/converters/backlog/projects.d.ts +7 -0
- package/lib/converters/backlog/projects.js +78 -0
- package/lib/converters/backlog/users.d.ts +7 -0
- package/lib/converters/backlog/users.js +26 -0
- package/lib/converters/bitbucket/branches.d.ts +7 -0
- package/lib/converters/bitbucket/branches.js +31 -0
- package/lib/converters/bitbucket/commits.d.ts +7 -0
- package/lib/converters/bitbucket/commits.js +50 -0
- package/lib/converters/bitbucket/common.d.ts +28 -0
- package/lib/converters/bitbucket/common.js +56 -0
- package/lib/converters/bitbucket/deployments.d.ts +11 -0
- package/lib/converters/bitbucket/deployments.js +100 -0
- package/lib/converters/bitbucket/issues.d.ts +12 -0
- package/lib/converters/bitbucket/issues.js +111 -0
- package/lib/converters/bitbucket/pipeline_steps.d.ts +10 -0
- package/lib/converters/bitbucket/pipeline_steps.js +83 -0
- package/lib/converters/bitbucket/pipelines.d.ts +8 -0
- package/lib/converters/bitbucket/pipelines.js +90 -0
- package/lib/converters/bitbucket/pull_request_activities.d.ts +13 -0
- package/lib/converters/bitbucket/pull_request_activities.js +112 -0
- package/lib/converters/bitbucket/pull_requests.d.ts +10 -0
- package/lib/converters/bitbucket/pull_requests.js +95 -0
- package/lib/converters/bitbucket/repositories.d.ts +9 -0
- package/lib/converters/bitbucket/repositories.js +41 -0
- package/lib/converters/bitbucket/types.d.ts +667 -0
- package/lib/converters/bitbucket/types.js +2 -0
- package/lib/converters/bitbucket/workspace_users.d.ts +7 -0
- package/lib/converters/bitbucket/workspace_users.js +31 -0
- package/lib/converters/bitbucket/workspaces.d.ts +8 -0
- package/lib/converters/bitbucket/workspaces.js +61 -0
- package/lib/converters/converter-registry.d.ts +25 -0
- package/lib/converters/converter-registry.js +64 -0
- package/lib/converters/converter.d.ts +63 -0
- package/lib/converters/converter.js +122 -0
- package/lib/converters/datadog/common.d.ts +27 -0
- package/lib/converters/datadog/common.js +34 -0
- package/lib/converters/datadog/incidents.d.ts +9 -0
- package/lib/converters/datadog/incidents.js +128 -0
- package/lib/converters/datadog/users.d.ts +7 -0
- package/lib/converters/datadog/users.js +27 -0
- package/lib/converters/docker/common.d.ts +87 -0
- package/lib/converters/docker/common.js +76 -0
- package/lib/converters/docker/tags.d.ts +8 -0
- package/lib/converters/docker/tags.js +98 -0
- package/lib/converters/github/assignees.d.ts +7 -0
- package/lib/converters/github/assignees.js +16 -0
- package/lib/converters/github/branches.d.ts +7 -0
- package/lib/converters/github/branches.js +28 -0
- package/lib/converters/github/collaborators.d.ts +7 -0
- package/lib/converters/github/collaborators.js +19 -0
- package/lib/converters/github/commits.d.ts +7 -0
- package/lib/converters/github/commits.js +48 -0
- package/lib/converters/github/common.d.ts +37 -0
- package/lib/converters/github/common.js +130 -0
- package/lib/converters/github/issue_labels.d.ts +7 -0
- package/lib/converters/github/issue_labels.js +20 -0
- package/lib/converters/github/issue_milestones.d.ts +8 -0
- package/lib/converters/github/issue_milestones.js +42 -0
- package/lib/converters/github/issues.d.ts +9 -0
- package/lib/converters/github/issues.js +90 -0
- package/lib/converters/github/organizations.d.ts +7 -0
- package/lib/converters/github/organizations.js +37 -0
- package/lib/converters/github/projects.d.ts +7 -0
- package/lib/converters/github/projects.js +21 -0
- package/lib/converters/github/pull_request_stats.d.ts +7 -0
- package/lib/converters/github/pull_request_stats.js +43 -0
- package/lib/converters/github/pull_requests.d.ts +7 -0
- package/lib/converters/github/pull_requests.js +63 -0
- package/lib/converters/github/releases.d.ts +7 -0
- package/lib/converters/github/releases.js +51 -0
- package/lib/converters/github/repositories.d.ts +7 -0
- package/lib/converters/github/repositories.js +44 -0
- package/lib/converters/github/review_comments.d.ts +7 -0
- package/lib/converters/github/review_comments.js +39 -0
- package/lib/converters/github/reviews.d.ts +7 -0
- package/lib/converters/github/reviews.js +58 -0
- package/lib/converters/github/tags.d.ts +7 -0
- package/lib/converters/github/tags.js +31 -0
- package/lib/converters/github/users.d.ts +7 -0
- package/lib/converters/github/users.js +19 -0
- package/lib/converters/gitlab/branches.d.ts +8 -0
- package/lib/converters/gitlab/branches.js +44 -0
- package/lib/converters/gitlab/commits.d.ts +7 -0
- package/lib/converters/gitlab/commits.js +33 -0
- package/lib/converters/gitlab/common.d.ts +30 -0
- package/lib/converters/gitlab/common.js +70 -0
- package/lib/converters/gitlab/group_labels.d.ts +7 -0
- package/lib/converters/gitlab/group_labels.js +15 -0
- package/lib/converters/gitlab/group_milestones.d.ts +8 -0
- package/lib/converters/gitlab/group_milestones.js +41 -0
- package/lib/converters/gitlab/groups.d.ts +7 -0
- package/lib/converters/gitlab/groups.js +43 -0
- package/lib/converters/gitlab/issues.d.ts +10 -0
- package/lib/converters/gitlab/issues.js +79 -0
- package/lib/converters/gitlab/jobs.d.ts +11 -0
- package/lib/converters/gitlab/jobs.js +75 -0
- package/lib/converters/gitlab/merge_request_commits.d.ts +7 -0
- package/lib/converters/gitlab/merge_request_commits.js +34 -0
- package/lib/converters/gitlab/merge_requests.d.ts +10 -0
- package/lib/converters/gitlab/merge_requests.js +65 -0
- package/lib/converters/gitlab/pipelines.d.ts +7 -0
- package/lib/converters/gitlab/pipelines.js +41 -0
- package/lib/converters/gitlab/project_labels.d.ts +7 -0
- package/lib/converters/gitlab/project_labels.js +15 -0
- package/lib/converters/gitlab/project_milestones.d.ts +8 -0
- package/lib/converters/gitlab/project_milestones.js +41 -0
- package/lib/converters/gitlab/projects.d.ts +7 -0
- package/lib/converters/gitlab/projects.js +51 -0
- package/lib/converters/gitlab/releases.d.ts +10 -0
- package/lib/converters/gitlab/releases.js +68 -0
- package/lib/converters/gitlab/tags.d.ts +10 -0
- package/lib/converters/gitlab/tags.js +41 -0
- package/lib/converters/gitlab/users.d.ts +7 -0
- package/lib/converters/gitlab/users.js +33 -0
- package/lib/converters/googlecalendar/calendar_models.d.ts +618 -0
- package/lib/converters/googlecalendar/calendar_models.js +2 -0
- package/lib/converters/googlecalendar/calendars.d.ts +7 -0
- package/lib/converters/googlecalendar/calendars.js +29 -0
- package/lib/converters/googlecalendar/common.d.ts +52 -0
- package/lib/converters/googlecalendar/common.js +130 -0
- package/lib/converters/googlecalendar/events.d.ts +8 -0
- package/lib/converters/googlecalendar/events.js +117 -0
- package/lib/converters/harness/common.d.ts +105 -0
- package/lib/converters/harness/common.js +16 -0
- package/lib/converters/harness/executions.d.ts +15 -0
- package/lib/converters/harness/executions.js +245 -0
- package/lib/converters/jenkins/builds.d.ts +9 -0
- package/lib/converters/jenkins/builds.js +74 -0
- package/lib/converters/jenkins/common.d.ts +25 -0
- package/lib/converters/jenkins/common.js +54 -0
- package/lib/converters/jenkins/jobs.d.ts +8 -0
- package/lib/converters/jenkins/jobs.js +29 -0
- package/lib/converters/jira/board_issues.d.ts +7 -0
- package/lib/converters/jira/board_issues.js +28 -0
- package/lib/converters/jira/boards.d.ts +7 -0
- package/lib/converters/jira/boards.js +34 -0
- package/lib/converters/jira/common.d.ts +61 -0
- package/lib/converters/jira/common.js +64 -0
- package/lib/converters/jira/epics.d.ts +8 -0
- package/lib/converters/jira/epics.js +45 -0
- package/lib/converters/jira/issue_fields.d.ts +7 -0
- package/lib/converters/jira/issue_fields.js +15 -0
- package/lib/converters/jira/issues.d.ts +52 -0
- package/lib/converters/jira/issues.js +545 -0
- package/lib/converters/jira/project_versions.d.ts +9 -0
- package/lib/converters/jira/project_versions.js +48 -0
- package/lib/converters/jira/projects.d.ts +7 -0
- package/lib/converters/jira/projects.js +40 -0
- package/lib/converters/jira/pull_requests.d.ts +7 -0
- package/lib/converters/jira/pull_requests.js +15 -0
- package/lib/converters/jira/sprint_issues.d.ts +7 -0
- package/lib/converters/jira/sprint_issues.js +15 -0
- package/lib/converters/jira/sprints.d.ts +16 -0
- package/lib/converters/jira/sprints.js +80 -0
- package/lib/converters/jira/users.d.ts +8 -0
- package/lib/converters/jira/users.js +33 -0
- package/lib/converters/jira/workflow_statuses.d.ts +7 -0
- package/lib/converters/jira/workflow_statuses.js +15 -0
- package/lib/converters/jsonata.d.ts +17 -0
- package/lib/converters/jsonata.js +47 -0
- package/lib/converters/okta/common.d.ts +8 -0
- package/lib/converters/okta/common.js +17 -0
- package/lib/converters/okta/groups.d.ts +7 -0
- package/lib/converters/okta/groups.js +47 -0
- package/lib/converters/okta/models.d.ts +102 -0
- package/lib/converters/okta/models.js +2 -0
- package/lib/converters/okta/users.d.ts +8 -0
- package/lib/converters/okta/users.js +73 -0
- package/lib/converters/okta_faros/common.d.ts +4 -0
- package/lib/converters/okta_faros/common.js +11 -0
- package/lib/converters/okta_faros/groups.d.ts +13 -0
- package/lib/converters/okta_faros/groups.js +23 -0
- package/lib/converters/okta_faros/users.d.ts +13 -0
- package/lib/converters/okta_faros/users.js +23 -0
- package/lib/converters/pagerduty/common.d.ts +37 -0
- package/lib/converters/pagerduty/common.js +40 -0
- package/lib/converters/pagerduty/incident_log_entries.d.ts +8 -0
- package/lib/converters/pagerduty/incident_log_entries.js +56 -0
- package/lib/converters/pagerduty/incidents.d.ts +10 -0
- package/lib/converters/pagerduty/incidents.js +127 -0
- package/lib/converters/pagerduty/priorities_resource.d.ts +11 -0
- package/lib/converters/pagerduty/priorities_resource.js +64 -0
- package/lib/converters/pagerduty/users.d.ts +7 -0
- package/lib/converters/pagerduty/users.js +26 -0
- package/lib/converters/phabricator/commits.d.ts +8 -0
- package/lib/converters/phabricator/commits.js +75 -0
- package/lib/converters/phabricator/common.d.ts +40 -0
- package/lib/converters/phabricator/common.js +107 -0
- package/lib/converters/phabricator/repositories.d.ts +7 -0
- package/lib/converters/phabricator/repositories.js +56 -0
- package/lib/converters/phabricator/revisions.d.ts +7 -0
- package/lib/converters/phabricator/revisions.js +83 -0
- package/lib/converters/phabricator/users.d.ts +7 -0
- package/lib/converters/phabricator/users.js +39 -0
- package/lib/converters/shortcut/common.d.ts +16 -0
- package/lib/converters/shortcut/common.js +68 -0
- package/lib/converters/shortcut/epics.d.ts +7 -0
- package/lib/converters/shortcut/epics.js +29 -0
- package/lib/converters/shortcut/iterations.d.ts +7 -0
- package/lib/converters/shortcut/iterations.js +29 -0
- package/lib/converters/shortcut/members.d.ts +7 -0
- package/lib/converters/shortcut/members.js +26 -0
- package/lib/converters/shortcut/models.d.ts +392 -0
- package/lib/converters/shortcut/models.js +30 -0
- package/lib/converters/shortcut/projects.d.ts +7 -0
- package/lib/converters/shortcut/projects.js +46 -0
- package/lib/converters/shortcut/stories.d.ts +7 -0
- package/lib/converters/shortcut/stories.js +127 -0
- package/lib/converters/squadcast/common.d.ts +169 -0
- package/lib/converters/squadcast/common.js +62 -0
- package/lib/converters/squadcast/events.d.ts +9 -0
- package/lib/converters/squadcast/events.js +53 -0
- package/lib/converters/squadcast/incidents.d.ts +10 -0
- package/lib/converters/squadcast/incidents.js +141 -0
- package/lib/converters/squadcast/services.d.ts +7 -0
- package/lib/converters/squadcast/services.js +28 -0
- package/lib/converters/squadcast/users.d.ts +7 -0
- package/lib/converters/squadcast/users.js +27 -0
- package/lib/converters/statuspage/common.d.ts +93 -0
- package/lib/converters/statuspage/common.js +80 -0
- package/lib/converters/statuspage/incident_updates.d.ts +8 -0
- package/lib/converters/statuspage/incident_updates.js +45 -0
- package/lib/converters/statuspage/incidents.d.ts +10 -0
- package/lib/converters/statuspage/incidents.js +128 -0
- package/lib/converters/statuspage/users.d.ts +7 -0
- package/lib/converters/statuspage/users.js +26 -0
- package/lib/converters/victorops/common.d.ts +16 -0
- package/lib/converters/victorops/common.js +24 -0
- package/lib/converters/victorops/incidents.d.ts +12 -0
- package/lib/converters/victorops/incidents.js +209 -0
- package/lib/converters/victorops/teams.d.ts +8 -0
- package/lib/converters/victorops/teams.js +30 -0
- package/lib/converters/victorops/users.d.ts +8 -0
- package/lib/converters/victorops/users.js +33 -0
- package/lib/destination-runner.d.ts +12 -0
- package/lib/destination-runner.js +22 -0
- package/lib/destination.d.ts +42 -0
- package/lib/destination.js +508 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +39 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +71 -0
- package/resources/fetch-primary-keys.sql +16 -0
- package/resources/introspection-query.gql +61 -0
- package/resources/spec.json +468 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Issues extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
private readonly issueLabelsStream;
|
|
7
|
+
get dependencies(): ReadonlyArray<StreamName>;
|
|
8
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Issues = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const converter_1 = require("../converter");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
class Issues extends common_1.GitHubConverter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.destinationModels = [
|
|
11
|
+
'tms_Label',
|
|
12
|
+
'tms_Task',
|
|
13
|
+
'tms_TaskAssignment',
|
|
14
|
+
'tms_TaskBoardRelationship',
|
|
15
|
+
'tms_TaskTag',
|
|
16
|
+
'tms_User',
|
|
17
|
+
];
|
|
18
|
+
this.issueLabelsStream = new converter_1.StreamName('github', 'issue_labels');
|
|
19
|
+
}
|
|
20
|
+
get dependencies() {
|
|
21
|
+
return [this.issueLabelsStream];
|
|
22
|
+
}
|
|
23
|
+
async convert(record, ctx) {
|
|
24
|
+
var _a, _b, _c, _d;
|
|
25
|
+
const source = this.streamName.source;
|
|
26
|
+
const issue = record.record.data;
|
|
27
|
+
const res = [];
|
|
28
|
+
const uid = `${issue.id}`;
|
|
29
|
+
// GitHub's REST API v3 considers every pull request an issue,
|
|
30
|
+
// but not every issue is a pull request. Will skip pull requests
|
|
31
|
+
// since we pull them separately
|
|
32
|
+
if (issue.pull_request) {
|
|
33
|
+
return res;
|
|
34
|
+
}
|
|
35
|
+
let user;
|
|
36
|
+
if (issue.user) {
|
|
37
|
+
user = common_1.GitHubCommon.tms_User(issue.user, source);
|
|
38
|
+
res.push(user);
|
|
39
|
+
}
|
|
40
|
+
(_a = issue.assignees) === null || _a === void 0 ? void 0 : _a.forEach((a) => {
|
|
41
|
+
const assignee = common_1.GitHubCommon.tms_User(a, source);
|
|
42
|
+
res.push(assignee);
|
|
43
|
+
res.push({
|
|
44
|
+
model: 'tms_TaskAssignment',
|
|
45
|
+
record: {
|
|
46
|
+
task: { uid, source },
|
|
47
|
+
assignee: { uid: assignee.record.uid, source },
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
const issueLabelsStream = this.issueLabelsStream.asString;
|
|
52
|
+
for (const id of issue.labels) {
|
|
53
|
+
const label = ctx.get(issueLabelsStream, String(id));
|
|
54
|
+
const name = (_c = (_b = label === null || label === void 0 ? void 0 : label.record) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.name;
|
|
55
|
+
if (!name)
|
|
56
|
+
continue;
|
|
57
|
+
res.push({
|
|
58
|
+
model: 'tms_TaskTag',
|
|
59
|
+
record: { task: { uid, source }, label: { name } },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// Github issues only have state either open or closed
|
|
63
|
+
const category = issue.state === 'open' ? 'Todo' : 'Done';
|
|
64
|
+
res.push({
|
|
65
|
+
model: 'tms_Task',
|
|
66
|
+
record: {
|
|
67
|
+
uid,
|
|
68
|
+
name: issue.title,
|
|
69
|
+
description: (_d = issue.body) === null || _d === void 0 ? void 0 : _d.substring(0, common_1.GitHubCommon.MAX_DESCRIPTION_LENGTH),
|
|
70
|
+
status: { category, detail: issue.state },
|
|
71
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(issue.created_at),
|
|
72
|
+
updatedAt: faros_feeds_sdk_1.Utils.toDate(issue.updated_at),
|
|
73
|
+
creator: user ? { uid: user.record.uid, source } : undefined,
|
|
74
|
+
source,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
const repository = common_1.GitHubCommon.parseRepositoryKey(issue.repository, source);
|
|
78
|
+
// TODO: If tasks get transferred between repos or projects, delete previous relationship
|
|
79
|
+
// (this should probably be done in here and in issue-events)
|
|
80
|
+
res.push({
|
|
81
|
+
model: 'tms_TaskBoardRelationship',
|
|
82
|
+
record: {
|
|
83
|
+
task: { uid, source },
|
|
84
|
+
board: repository ? { uid: repository.name, source } : null,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
return res;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.Issues = Issues;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Organizations extends GitHubConverter {
|
|
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.Organizations = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
// Github org types
|
|
8
|
+
const orgTypes = ['organization', 'workspace', 'group'];
|
|
9
|
+
class Organizations extends common_1.GitHubConverter {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.destinationModels = [
|
|
13
|
+
'vcs_Organization',
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
async convert(record, ctx) {
|
|
17
|
+
const source = this.streamName.source;
|
|
18
|
+
const org = record.record.data;
|
|
19
|
+
const type = orgTypes.includes(org.type.toLowerCase())
|
|
20
|
+
? { category: (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(org.type)), detail: org.type }
|
|
21
|
+
: { category: 'Custom', detail: org.type };
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
model: 'vcs_Organization',
|
|
25
|
+
record: {
|
|
26
|
+
uid: (0, lodash_1.toLower)(org.login),
|
|
27
|
+
name: org.name,
|
|
28
|
+
htmlUrl: org.html_url,
|
|
29
|
+
type,
|
|
30
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(org.created_at),
|
|
31
|
+
source,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Organizations = Organizations;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Projects extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Projects = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Projects extends common_1.GitHubConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'tms_Project',
|
|
10
|
+
'tms_TaskBoard',
|
|
11
|
+
'tms_TaskBoardProjectRelationship',
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
async convert(record, ctx) {
|
|
15
|
+
const source = this.streamName.source;
|
|
16
|
+
const project = record.record.data;
|
|
17
|
+
const res = common_1.GitHubCommon.tms_ProjectBoard_with_TaskBoard({ uid: `${project.id}`, source }, project.name, project.body, project.created_at, project.updated_at);
|
|
18
|
+
return res;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Projects = Projects;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class PullRequestStats extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PullRequestStats = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class PullRequestStats extends common_1.GitHubConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'vcs_PullRequest',
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
async convert(record, ctx) {
|
|
13
|
+
const source = this.streamName.source;
|
|
14
|
+
const prStats = record.record.data;
|
|
15
|
+
const repository = common_1.GitHubCommon.parseRepositoryKey(prStats.repository, source);
|
|
16
|
+
if (!repository)
|
|
17
|
+
return [];
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
model: 'vcs_PullRequest__Update',
|
|
21
|
+
record: {
|
|
22
|
+
at: record.record.emitted_at,
|
|
23
|
+
where: {
|
|
24
|
+
number: prStats.number,
|
|
25
|
+
uid: prStats.number.toString(),
|
|
26
|
+
repository,
|
|
27
|
+
},
|
|
28
|
+
mask: ['commitCount', 'commentCount', 'diffStats'],
|
|
29
|
+
patch: {
|
|
30
|
+
commitCount: prStats.commits,
|
|
31
|
+
commentCount: prStats.comments + prStats.review_comments,
|
|
32
|
+
diffStats: {
|
|
33
|
+
linesAdded: prStats.additions,
|
|
34
|
+
linesDeleted: prStats.deletions,
|
|
35
|
+
filesChanged: prStats.changed_files,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.PullRequestStats = PullRequestStats;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class PullRequests extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PullRequests = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const common_2 = require("./common");
|
|
8
|
+
// Github PR states
|
|
9
|
+
const prStates = ['closed', 'merged', 'open'];
|
|
10
|
+
class PullRequests extends common_2.GitHubConverter {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.destinationModels = [
|
|
14
|
+
'vcs_PullRequest',
|
|
15
|
+
'vcs_User',
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
async convert(record, ctx) {
|
|
19
|
+
const source = this.streamName.source;
|
|
20
|
+
const pr = record.record.data;
|
|
21
|
+
const res = [];
|
|
22
|
+
const repository = {
|
|
23
|
+
name: (0, lodash_1.toLower)(pr.base.repo.name),
|
|
24
|
+
uid: (0, lodash_1.toLower)(pr.base.repo.name),
|
|
25
|
+
organization: { uid: (0, lodash_1.toLower)(pr.base.repo.owner.login), source },
|
|
26
|
+
};
|
|
27
|
+
const mergeCommit = pr.merge_commit_sha
|
|
28
|
+
? { repository, sha: pr.merge_commit_sha, uid: pr.merge_commit_sha }
|
|
29
|
+
: null;
|
|
30
|
+
let author = undefined;
|
|
31
|
+
if (pr.user) {
|
|
32
|
+
author = common_1.GitHubCommon.vcs_User(pr.user, source);
|
|
33
|
+
res.push(author);
|
|
34
|
+
}
|
|
35
|
+
const state = prStates.includes(pr.state.toLowerCase())
|
|
36
|
+
? { category: (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(pr.state)), detail: pr.state }
|
|
37
|
+
: { category: 'Custom', detail: pr.state };
|
|
38
|
+
res.push({
|
|
39
|
+
// We are explicitly passing __Upsert command here with at := 0,
|
|
40
|
+
// to allow updating PR stats from pull_request_stats stream
|
|
41
|
+
// in the same revision
|
|
42
|
+
model: 'vcs_PullRequest__Upsert',
|
|
43
|
+
record: {
|
|
44
|
+
at: 0,
|
|
45
|
+
data: {
|
|
46
|
+
number: pr.number,
|
|
47
|
+
uid: pr.number.toString(),
|
|
48
|
+
title: pr.title,
|
|
49
|
+
state,
|
|
50
|
+
htmlUrl: pr.url,
|
|
51
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(pr.created_at),
|
|
52
|
+
updatedAt: faros_feeds_sdk_1.Utils.toDate(pr.updated_at),
|
|
53
|
+
mergedAt: faros_feeds_sdk_1.Utils.toDate(pr.merged_at),
|
|
54
|
+
author: author ? { uid: author.record.uid, source } : null,
|
|
55
|
+
mergeCommit,
|
|
56
|
+
repository,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
return res;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.PullRequests = PullRequests;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Releases extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Releases = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Releases extends common_1.GitHubConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [
|
|
10
|
+
'cicd_Release',
|
|
11
|
+
'cicd_ReleaseTagAssociation',
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
async convert(record, ctx) {
|
|
15
|
+
const source = this.streamName.source;
|
|
16
|
+
const release = record.record.data;
|
|
17
|
+
const res = [];
|
|
18
|
+
const uid = `${release.id}`;
|
|
19
|
+
const repository = common_1.GitHubCommon.parseRepositoryKey(release.repository, source);
|
|
20
|
+
if (!repository)
|
|
21
|
+
return res;
|
|
22
|
+
const author = release.author ? { uid: release.author.login, source } : null;
|
|
23
|
+
res.push({
|
|
24
|
+
model: 'cicd_Release',
|
|
25
|
+
record: {
|
|
26
|
+
uid,
|
|
27
|
+
name: release.name,
|
|
28
|
+
htmlUrl: release.html_url,
|
|
29
|
+
notes: release.body,
|
|
30
|
+
draft: release.draft,
|
|
31
|
+
prerelease: release.prerelease,
|
|
32
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(release.created_at),
|
|
33
|
+
publishedAt: faros_feeds_sdk_1.Utils.toDate(release.published_at),
|
|
34
|
+
author,
|
|
35
|
+
source,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
res.push({
|
|
39
|
+
model: 'cicd_ReleaseTagAssociation',
|
|
40
|
+
record: {
|
|
41
|
+
release: { uid, source },
|
|
42
|
+
tag: {
|
|
43
|
+
repository,
|
|
44
|
+
name: release.tag_name,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
return res;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.Releases = Releases;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Repositories extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Repositories = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Repositories extends common_1.GitHubConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [
|
|
10
|
+
'tms_Project',
|
|
11
|
+
'tms_TaskBoard',
|
|
12
|
+
'tms_TaskBoardProjectRelationship',
|
|
13
|
+
'vcs_Repository',
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
async convert(record, ctx) {
|
|
17
|
+
var _a;
|
|
18
|
+
const source = this.streamName.source;
|
|
19
|
+
const repo = record.record.data;
|
|
20
|
+
const res = [];
|
|
21
|
+
const repository = common_1.GitHubCommon.parseRepositoryKey(repo.full_name, source);
|
|
22
|
+
if (!repository)
|
|
23
|
+
return res;
|
|
24
|
+
// Create a TMS Project/Board per repo that we sync
|
|
25
|
+
res.push(...common_1.GitHubCommon.tms_ProjectBoard_with_TaskBoard({ uid: repo.name, source }, repo.name, repo.description, repo.created_at, repo.updated_at));
|
|
26
|
+
res.push({
|
|
27
|
+
model: 'vcs_Repository',
|
|
28
|
+
record: {
|
|
29
|
+
...repository,
|
|
30
|
+
fullName: repo.full_name,
|
|
31
|
+
private: repo.private,
|
|
32
|
+
description: repo.description,
|
|
33
|
+
language: (_a = repo.language) !== null && _a !== void 0 ? _a : null,
|
|
34
|
+
size: repo.size,
|
|
35
|
+
mainBranch: repo.default_branch,
|
|
36
|
+
htmlUrl: repo.html_url,
|
|
37
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(repo === null || repo === void 0 ? void 0 : repo.created_at),
|
|
38
|
+
updatedAt: faros_feeds_sdk_1.Utils.toDate(repo === null || repo === void 0 ? void 0 : repo.updated_at),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
return res;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Repositories = Repositories;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class ReviewComments extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReviewComments = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class ReviewComments extends common_1.GitHubConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [
|
|
10
|
+
'vcs_PullRequestComment',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
async convert(record, ctx) {
|
|
14
|
+
const source = this.streamName.source;
|
|
15
|
+
const comment = record.record.data;
|
|
16
|
+
const repository = common_1.GitHubCommon.parseRepositoryKey(comment.repository, source);
|
|
17
|
+
if (!repository)
|
|
18
|
+
return [];
|
|
19
|
+
// Parse the PR number from the pull request url
|
|
20
|
+
const prNum = common_1.GitHubCommon.parsePRnumber(comment.pull_request_url);
|
|
21
|
+
const pullRequest = { repository, number: prNum, uid: prNum.toString() };
|
|
22
|
+
const author = comment.user ? { uid: comment.user.login, source } : null;
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
model: 'vcs_PullRequestComment',
|
|
26
|
+
record: {
|
|
27
|
+
number: comment.id,
|
|
28
|
+
uid: comment.id.toString(),
|
|
29
|
+
comment: comment.body,
|
|
30
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(comment.created_at),
|
|
31
|
+
updatedAt: faros_feeds_sdk_1.Utils.toDate(comment.updated_at),
|
|
32
|
+
author,
|
|
33
|
+
pullRequest,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ReviewComments = ReviewComments;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Reviews extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Reviews = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
// GitHub Review States
|
|
8
|
+
const ReviewStates = [
|
|
9
|
+
'approved',
|
|
10
|
+
'commented',
|
|
11
|
+
'changes_requested',
|
|
12
|
+
'dismissed',
|
|
13
|
+
];
|
|
14
|
+
class Reviews extends common_1.GitHubConverter {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.destinationModels = [
|
|
18
|
+
'vcs_PullRequestReview',
|
|
19
|
+
'vcs_User',
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
async convert(record, ctx) {
|
|
23
|
+
const source = this.streamName.source;
|
|
24
|
+
const review = record.record.data;
|
|
25
|
+
const res = [];
|
|
26
|
+
const repository = common_1.GitHubCommon.parseRepositoryKey(review.repository, source);
|
|
27
|
+
if (!repository)
|
|
28
|
+
return [];
|
|
29
|
+
let author = undefined;
|
|
30
|
+
if (review.user) {
|
|
31
|
+
author = common_1.GitHubCommon.vcs_User(review.user, source);
|
|
32
|
+
res.push(author);
|
|
33
|
+
}
|
|
34
|
+
// Parse the PR number from the pull request url
|
|
35
|
+
const prNum = common_1.GitHubCommon.parsePRnumber(review.pull_request_url);
|
|
36
|
+
const pullRequest = { repository, number: prNum, uid: prNum.toString() };
|
|
37
|
+
const state = ReviewStates.includes(review.state.toLowerCase())
|
|
38
|
+
? {
|
|
39
|
+
category: (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(review.state)),
|
|
40
|
+
detail: review.state,
|
|
41
|
+
}
|
|
42
|
+
: { category: 'Custom', detail: review.state };
|
|
43
|
+
res.push({
|
|
44
|
+
model: 'vcs_PullRequestReview',
|
|
45
|
+
record: {
|
|
46
|
+
number: review.id,
|
|
47
|
+
uid: review.id.toString(),
|
|
48
|
+
htmlUrl: review.html_url,
|
|
49
|
+
pullRequest,
|
|
50
|
+
reviewer: author ? { uid: author.record.uid, source } : null,
|
|
51
|
+
state,
|
|
52
|
+
submittedAt: faros_feeds_sdk_1.Utils.toDate(review.submitted_at),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
return res;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.Reviews = Reviews;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Tags extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.GitHubConverter {
|
|
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 repository = common_1.GitHubCommon.parseRepositoryKey(tag.repository, source);
|
|
15
|
+
if (!repository)
|
|
16
|
+
return [];
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
model: 'vcs_Tag',
|
|
20
|
+
record: {
|
|
21
|
+
name: tag.name,
|
|
22
|
+
commit: ((_a = tag === null || tag === void 0 ? void 0 : tag.commit) === null || _a === void 0 ? void 0 : _a.sha)
|
|
23
|
+
? { repository, sha: tag.commit.sha, uid: tag.commit.sha }
|
|
24
|
+
: null,
|
|
25
|
+
repository,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.Tags = Tags;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Users extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Users = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Users extends common_1.GitHubConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'vcs_Membership',
|
|
10
|
+
'vcs_User',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
async convert(record, ctx) {
|
|
14
|
+
const source = this.streamName.source;
|
|
15
|
+
const user = record.record.data;
|
|
16
|
+
return common_1.GitHubCommon.vcs_User_with_Membership(user, source);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Users = Users;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class Branches extends GitlabConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
id(record: AirbyteRecord): any;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Branches = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Branches extends common_1.GitlabConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'vcs_Branch',
|
|
10
|
+
'vcs_BranchCommitAssociation',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
id(record) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
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.name;
|
|
16
|
+
}
|
|
17
|
+
async convert(record, ctx) {
|
|
18
|
+
const source = this.streamName.source;
|
|
19
|
+
const branch = record.record.data;
|
|
20
|
+
const res = [];
|
|
21
|
+
const repository = common_1.GitlabCommon.parseRepositoryKey(branch.web_url, source);
|
|
22
|
+
if (!repository)
|
|
23
|
+
return [];
|
|
24
|
+
res.push({
|
|
25
|
+
model: 'vcs_Branch',
|
|
26
|
+
record: {
|
|
27
|
+
name: branch.name,
|
|
28
|
+
uid: branch.name,
|
|
29
|
+
repository,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
if (branch.commit_id) {
|
|
33
|
+
res.push({
|
|
34
|
+
model: 'vcs_BranchCommitAssociation',
|
|
35
|
+
record: {
|
|
36
|
+
commit: { sha: branch.commit_id, uid: branch.commit_id, repository },
|
|
37
|
+
branch: { name: branch.name, uid: branch.name, repository },
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return res;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Branches = Branches;
|