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,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhabricatorConverter = exports.PhabricatorCommon = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const converter_1 = require("../converter");
|
|
7
|
+
/** Common functions shares across Phabricator converters */
|
|
8
|
+
class PhabricatorCommon {
|
|
9
|
+
static vcs_UserType(user) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
if ((0, lodash_1.toLower)(user.type) === 'user') {
|
|
12
|
+
const roles = Array.isArray((_a = user === null || user === void 0 ? void 0 : user.fields) === null || _a === void 0 ? void 0 : _a.roles)
|
|
13
|
+
? (_b = user === null || user === void 0 ? void 0 : user.fields) === null || _b === void 0 ? void 0 : _b.roles
|
|
14
|
+
: [];
|
|
15
|
+
if (roles.includes('bot')) {
|
|
16
|
+
return { category: 'Bot', detail: 'bot' };
|
|
17
|
+
}
|
|
18
|
+
if (roles.includes('list')) {
|
|
19
|
+
return { category: 'Custom', detail: 'list' };
|
|
20
|
+
}
|
|
21
|
+
return { category: 'User', detail: 'user' };
|
|
22
|
+
}
|
|
23
|
+
return { category: 'Custom', detail: 'unknown' };
|
|
24
|
+
}
|
|
25
|
+
static vcs_PullRequestState(revisionStatus) {
|
|
26
|
+
const detail = (0, lodash_1.toLower)(revisionStatus === null || revisionStatus === void 0 ? void 0 : revisionStatus.value);
|
|
27
|
+
if (!detail)
|
|
28
|
+
return { category: 'Custom', detail: 'unknown' };
|
|
29
|
+
switch (detail) {
|
|
30
|
+
case 'abandoned':
|
|
31
|
+
return { category: 'Closed', detail };
|
|
32
|
+
case 'published':
|
|
33
|
+
return { category: 'Merged', detail };
|
|
34
|
+
case 'needs-review':
|
|
35
|
+
case 'needs-revision':
|
|
36
|
+
case 'changes-planned':
|
|
37
|
+
case 'accepted':
|
|
38
|
+
case 'draft':
|
|
39
|
+
return { category: 'Open', detail };
|
|
40
|
+
default:
|
|
41
|
+
return { category: 'Custom', detail };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
static vcs_PullRequestReviewState(reviewStatus) {
|
|
45
|
+
const detail = (0, lodash_1.toLower)(reviewStatus);
|
|
46
|
+
if (!detail)
|
|
47
|
+
return { category: 'Custom', detail: 'unknown' };
|
|
48
|
+
switch (detail) {
|
|
49
|
+
case 'rejected':
|
|
50
|
+
return { category: 'ChangesRequested', detail };
|
|
51
|
+
case 'accepted':
|
|
52
|
+
return { category: 'Approved', detail };
|
|
53
|
+
default:
|
|
54
|
+
return { category: 'Custom', detail };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
static parseCommitMessage(message) {
|
|
58
|
+
if (!message)
|
|
59
|
+
return undefined;
|
|
60
|
+
const parts = message.split('\n\n');
|
|
61
|
+
const revision = parts.find((p) => p.startsWith('Differential Revision:'));
|
|
62
|
+
const revisionIdStr = revision
|
|
63
|
+
? revision.split('/D').reverse()[0].trim()
|
|
64
|
+
: undefined;
|
|
65
|
+
const revisionId = faros_feeds_sdk_1.Utils.parseIntegerWithDefault(revisionIdStr, -1);
|
|
66
|
+
return {
|
|
67
|
+
message: parts.length > 0 ? parts[0] : undefined,
|
|
68
|
+
revisionId: revisionId >= 0 ? revisionId : undefined,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
static repositoryURIs(repository) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const uris = (_b = (_a = repository === null || repository === void 0 ? void 0 : repository.attachments) === null || _a === void 0 ? void 0 : _a.uris) === null || _b === void 0 ? void 0 : _b.uris;
|
|
74
|
+
if (!uris || !Array.isArray(uris))
|
|
75
|
+
return [];
|
|
76
|
+
return uris;
|
|
77
|
+
}
|
|
78
|
+
static repositoryKey(repository, source) {
|
|
79
|
+
var _a;
|
|
80
|
+
const repoName = (_a = repository === null || repository === void 0 ? void 0 : repository.fields) === null || _a === void 0 ? void 0 : _a.shortName;
|
|
81
|
+
if (!repoName)
|
|
82
|
+
return undefined;
|
|
83
|
+
return {
|
|
84
|
+
name: (0, lodash_1.toLower)(repoName),
|
|
85
|
+
organization: PhabricatorCommon.orgKey(source),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
static orgKey(source) {
|
|
89
|
+
// Since Phabricator does not have a concept of organization,
|
|
90
|
+
// we are simply using the source name instead
|
|
91
|
+
return { uid: source, source };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.PhabricatorCommon = PhabricatorCommon;
|
|
95
|
+
/** Phabricator converter base */
|
|
96
|
+
class PhabricatorConverter extends converter_1.Converter {
|
|
97
|
+
constructor() {
|
|
98
|
+
super(...arguments);
|
|
99
|
+
this.source = 'Phabricator';
|
|
100
|
+
}
|
|
101
|
+
/** Most of Phabricator records should have phid property */
|
|
102
|
+
id(record) {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
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.phid;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.PhabricatorConverter = PhabricatorConverter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { PhabricatorConverter } from './common';
|
|
4
|
+
export declare class Repositories extends PhabricatorConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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.PhabricatorConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [
|
|
10
|
+
'vcs_Repository',
|
|
11
|
+
'vcs_Organization',
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
async convert(record, ctx) {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
16
|
+
const source = this.streamName.source;
|
|
17
|
+
const repo = record.record.data;
|
|
18
|
+
const res = [];
|
|
19
|
+
const repository = common_1.PhabricatorCommon.repositoryKey(repo, source);
|
|
20
|
+
if (!repository)
|
|
21
|
+
return res;
|
|
22
|
+
const uris = common_1.PhabricatorCommon.repositoryURIs(repo);
|
|
23
|
+
// Since there is no separate stream of organizations, we are writing
|
|
24
|
+
// an organization with each repository.
|
|
25
|
+
res.push({
|
|
26
|
+
model: 'vcs_Organization',
|
|
27
|
+
record: {
|
|
28
|
+
uid: repository.organization.uid,
|
|
29
|
+
name: repository.organization.uid,
|
|
30
|
+
type: 'Organization',
|
|
31
|
+
source,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
res.push({
|
|
35
|
+
model: 'vcs_Repository',
|
|
36
|
+
record: {
|
|
37
|
+
...repository,
|
|
38
|
+
fullName: (_a = repo.fields) === null || _a === void 0 ? void 0 : _a.name,
|
|
39
|
+
private: true,
|
|
40
|
+
description: (_c = (_b = repo.fields) === null || _b === void 0 ? void 0 : _b.description) === null || _c === void 0 ? void 0 : _c.raw,
|
|
41
|
+
language: null,
|
|
42
|
+
size: null,
|
|
43
|
+
mainBranch: (_d = repo.fields) === null || _d === void 0 ? void 0 : _d.defaultBranch,
|
|
44
|
+
htmlUrl: uris.length > 0 ? (_f = (_e = uris[0].fields) === null || _e === void 0 ? void 0 : _e.uri) === null || _f === void 0 ? void 0 : _f.effective : null,
|
|
45
|
+
createdAt: ((_g = repo.fields) === null || _g === void 0 ? void 0 : _g.dateCreated)
|
|
46
|
+
? faros_feeds_sdk_1.Utils.toDate(repo.fields.dateCreated * 1000)
|
|
47
|
+
: null,
|
|
48
|
+
updatedAt: ((_h = repo.fields) === null || _h === void 0 ? void 0 : _h.dateModified)
|
|
49
|
+
? faros_feeds_sdk_1.Utils.toDate(repo.fields.dateModified * 1000)
|
|
50
|
+
: null,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
return res;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.Repositories = Repositories;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { PhabricatorConverter } from './common';
|
|
4
|
+
export declare class Revisions extends PhabricatorConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Revisions = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Revisions extends common_1.PhabricatorConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [
|
|
10
|
+
'vcs_PullRequest',
|
|
11
|
+
'vcs_PullRequestReview',
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
async convert(record, ctx) {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
16
|
+
const source = this.streamName.source;
|
|
17
|
+
const revision = record.record.data;
|
|
18
|
+
const res = [];
|
|
19
|
+
const repository = common_1.PhabricatorCommon.repositoryKey(revision.repository, source);
|
|
20
|
+
if (!repository)
|
|
21
|
+
return res;
|
|
22
|
+
const state = common_1.PhabricatorCommon.vcs_PullRequestState((_a = revision.fields) === null || _a === void 0 ? void 0 : _a.status);
|
|
23
|
+
const createdAt = ((_b = revision.fields) === null || _b === void 0 ? void 0 : _b.dateCreated)
|
|
24
|
+
? faros_feeds_sdk_1.Utils.toDate(((_c = revision.fields) === null || _c === void 0 ? void 0 : _c.dateCreated) * 1000)
|
|
25
|
+
: null;
|
|
26
|
+
const updatedAt = ((_d = revision.fields) === null || _d === void 0 ? void 0 : _d.dateModified)
|
|
27
|
+
? faros_feeds_sdk_1.Utils.toDate(((_e = revision.fields) === null || _e === void 0 ? void 0 : _e.dateModified) * 1000)
|
|
28
|
+
: null;
|
|
29
|
+
// TODO: figure out how to get the actual mergedAt timestamp for each revision
|
|
30
|
+
const mergedAt = state.category === 'Merged' ? updatedAt : null;
|
|
31
|
+
const author = ((_f = revision.fields) === null || _f === void 0 ? void 0 : _f.authorPHID)
|
|
32
|
+
? { uid: (_g = revision.fields) === null || _g === void 0 ? void 0 : _g.authorPHID, source }
|
|
33
|
+
: null;
|
|
34
|
+
res.push({
|
|
35
|
+
// We are explicitly passing __Upsert command here with at := 0,
|
|
36
|
+
// to allow updating PR merge commit from commits stream
|
|
37
|
+
// in the same revision
|
|
38
|
+
model: 'vcs_PullRequest__Upsert',
|
|
39
|
+
record: {
|
|
40
|
+
at: 0,
|
|
41
|
+
data: {
|
|
42
|
+
number: revision.id,
|
|
43
|
+
uid: revision.id.toString(),
|
|
44
|
+
title: (_h = revision.fields) === null || _h === void 0 ? void 0 : _h.title,
|
|
45
|
+
state,
|
|
46
|
+
htmlUrl: (_j = revision.fields) === null || _j === void 0 ? void 0 : _j.uri,
|
|
47
|
+
createdAt,
|
|
48
|
+
updatedAt,
|
|
49
|
+
mergedAt,
|
|
50
|
+
author,
|
|
51
|
+
repository,
|
|
52
|
+
mergeCommit: null, // merge commit is set from commits stream
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const reviewers = Array.isArray((_l = (_k = revision.attachments) === null || _k === void 0 ? void 0 : _k.reviewers) === null || _l === void 0 ? void 0 : _l.reviewers)
|
|
57
|
+
? (_o = (_m = revision.attachments) === null || _m === void 0 ? void 0 : _m.reviewers) === null || _o === void 0 ? void 0 : _o.reviewers
|
|
58
|
+
: [];
|
|
59
|
+
const pullRequest = {
|
|
60
|
+
repository,
|
|
61
|
+
number: revision.id,
|
|
62
|
+
uid: revision.id.toString(),
|
|
63
|
+
};
|
|
64
|
+
let reviewId = 0;
|
|
65
|
+
for (const reviewer of reviewers) {
|
|
66
|
+
res.push({
|
|
67
|
+
model: 'vcs_PullRequestReview',
|
|
68
|
+
record: {
|
|
69
|
+
number: reviewId,
|
|
70
|
+
uid: reviewId.toString(),
|
|
71
|
+
pullRequest,
|
|
72
|
+
reviewer: { uid: reviewer.reviewerPHID, source },
|
|
73
|
+
state: common_1.PhabricatorCommon.vcs_PullRequestReviewState(reviewer === null || reviewer === void 0 ? void 0 : reviewer.status),
|
|
74
|
+
// TODO: figure out how to get the actual submittedAt timestamp for each revision
|
|
75
|
+
submittedAt: updatedAt,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
reviewId++;
|
|
79
|
+
}
|
|
80
|
+
return res;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.Revisions = Revisions;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { PhabricatorConverter } from './common';
|
|
4
|
+
export declare class Users extends PhabricatorConverter {
|
|
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.Users = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Users extends common_1.PhabricatorConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'vcs_Membership',
|
|
10
|
+
'vcs_User',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
async convert(record, ctx) {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
const source = this.streamName.source;
|
|
16
|
+
const user = record.record.data;
|
|
17
|
+
const res = [];
|
|
18
|
+
const uid = user.phid;
|
|
19
|
+
res.push({
|
|
20
|
+
model: 'vcs_User',
|
|
21
|
+
record: {
|
|
22
|
+
uid,
|
|
23
|
+
name: (_d = (_b = (_a = user.fields) === null || _a === void 0 ? void 0 : _a.username) !== null && _b !== void 0 ? _b : (_c = user.fields) === null || _c === void 0 ? void 0 : _c.realName) !== null && _d !== void 0 ? _d : null,
|
|
24
|
+
htmlUrl: null,
|
|
25
|
+
type: common_1.PhabricatorCommon.vcs_UserType(user),
|
|
26
|
+
source,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
res.push({
|
|
30
|
+
model: 'vcs_Membership',
|
|
31
|
+
record: {
|
|
32
|
+
user: { uid, source },
|
|
33
|
+
organization: common_1.PhabricatorCommon.orgKey(source),
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return res;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Users = Users;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Converter } from '../converter';
|
|
3
|
+
import { Iteration, Story, StoryType, TaskType } from './models';
|
|
4
|
+
export declare class ShortcutCommon {
|
|
5
|
+
static readonly MAX_DESCRIPTION_LENGTH = 1000;
|
|
6
|
+
static getEpicStatus(status: string): string;
|
|
7
|
+
static getSprintState(iteration: Iteration): string;
|
|
8
|
+
static getTaskType(storyType: StoryType): TaskType;
|
|
9
|
+
static getTaskStatus(story: Story): string;
|
|
10
|
+
}
|
|
11
|
+
/** Shortcut converter base */
|
|
12
|
+
export declare abstract class ShortcutConverter extends Converter {
|
|
13
|
+
source: string;
|
|
14
|
+
/** Almost every Shortcut record have id property */
|
|
15
|
+
id(record: AirbyteRecord): any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShortcutConverter = exports.ShortcutCommon = void 0;
|
|
4
|
+
const converter_1 = require("../converter");
|
|
5
|
+
const models_1 = require("./models");
|
|
6
|
+
class ShortcutCommon {
|
|
7
|
+
static getEpicStatus(status) {
|
|
8
|
+
switch (status) {
|
|
9
|
+
case 'done':
|
|
10
|
+
return models_1.EpicStatusCategory.Done;
|
|
11
|
+
case 'in progress':
|
|
12
|
+
return models_1.EpicStatusCategory.InProgress;
|
|
13
|
+
default:
|
|
14
|
+
return models_1.EpicStatusCategory.Todo;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
static getSprintState(iteration) {
|
|
18
|
+
switch (iteration.status) {
|
|
19
|
+
case 'done':
|
|
20
|
+
return models_1.SprintState.Closed;
|
|
21
|
+
case 'started':
|
|
22
|
+
return models_1.SprintState.Active;
|
|
23
|
+
case 'unstarted':
|
|
24
|
+
return models_1.SprintState.Future;
|
|
25
|
+
default:
|
|
26
|
+
return models_1.SprintState.Default;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
static getTaskType(storyType) {
|
|
30
|
+
const detail = storyType;
|
|
31
|
+
switch (storyType) {
|
|
32
|
+
case 'bug':
|
|
33
|
+
return { category: models_1.TaskCategory.Bug, detail };
|
|
34
|
+
case 'chore':
|
|
35
|
+
case 'feature':
|
|
36
|
+
return { category: models_1.TaskCategory.Story, detail };
|
|
37
|
+
default:
|
|
38
|
+
return { category: models_1.TaskCategory.Custom, detail };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
static getTaskStatus(story) {
|
|
42
|
+
if (story.completed) {
|
|
43
|
+
return models_1.TaskStatusCategory.Done;
|
|
44
|
+
}
|
|
45
|
+
else if (story.started) {
|
|
46
|
+
return models_1.TaskStatusCategory.InProgress;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return models_1.TaskStatusCategory.Todo;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ShortcutCommon = ShortcutCommon;
|
|
54
|
+
// Max length for free-form description text fields such as issue body
|
|
55
|
+
ShortcutCommon.MAX_DESCRIPTION_LENGTH = 1000;
|
|
56
|
+
/** Shortcut converter base */
|
|
57
|
+
class ShortcutConverter extends converter_1.Converter {
|
|
58
|
+
constructor() {
|
|
59
|
+
super(...arguments);
|
|
60
|
+
this.source = 'Shortcut';
|
|
61
|
+
}
|
|
62
|
+
/** Almost every Shortcut record have id property */
|
|
63
|
+
id(record) {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
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.id;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.ShortcutConverter = ShortcutConverter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ShortcutConverter } from './common';
|
|
4
|
+
export declare class Epics extends ShortcutConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Epics = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Epics extends common_1.ShortcutConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = ['tms_Epic'];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
const source = this.streamName.source;
|
|
12
|
+
const epic = record.record.data;
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
model: 'tms_Epic',
|
|
16
|
+
record: {
|
|
17
|
+
uid: String(epic.id),
|
|
18
|
+
name: epic.name,
|
|
19
|
+
description: epic.description,
|
|
20
|
+
status: {
|
|
21
|
+
category: common_1.ShortcutCommon.getEpicStatus(epic.state),
|
|
22
|
+
},
|
|
23
|
+
source,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Epics = Epics;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ShortcutConverter } from './common';
|
|
4
|
+
export declare class Iterations extends ShortcutConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Iterations = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Iterations extends common_1.ShortcutConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = ['tms_Sprint'];
|
|
10
|
+
}
|
|
11
|
+
async convert(record, ctx) {
|
|
12
|
+
const source = this.streamName.source;
|
|
13
|
+
const iteration = record.record.data;
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
model: 'tms_Sprint',
|
|
17
|
+
record: {
|
|
18
|
+
uid: String(iteration.id),
|
|
19
|
+
name: iteration.name,
|
|
20
|
+
state: common_1.ShortcutCommon.getSprintState(iteration),
|
|
21
|
+
startedAt: faros_feeds_sdk_1.Utils.toDate(iteration.start_date),
|
|
22
|
+
endedAt: faros_feeds_sdk_1.Utils.toDate(iteration.end_date),
|
|
23
|
+
source,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Iterations = Iterations;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ShortcutConverter } from './common';
|
|
4
|
+
export declare class Members extends ShortcutConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Members = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Members extends common_1.ShortcutConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = ['tms_User'];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
const source = this.streamName.source;
|
|
12
|
+
const user = record.record.data;
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
model: 'tms_User',
|
|
16
|
+
record: {
|
|
17
|
+
uid: String(user.id),
|
|
18
|
+
name: user.profile.name,
|
|
19
|
+
emailAddress: user.profile.email_address,
|
|
20
|
+
source,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.Members = Members;
|