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,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class Commits extends GitlabConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Commits = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Commits extends common_1.GitlabConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = ['vcs_Commit'];
|
|
10
|
+
}
|
|
11
|
+
async convert(record, ctx) {
|
|
12
|
+
const source = this.streamName.source;
|
|
13
|
+
const commit = record.record.data;
|
|
14
|
+
const repository = common_1.GitlabCommon.parseRepositoryKey(commit.web_url, source);
|
|
15
|
+
if (!repository)
|
|
16
|
+
return [];
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
model: 'vcs_Commit',
|
|
20
|
+
record: {
|
|
21
|
+
sha: commit.id,
|
|
22
|
+
uid: commit.id,
|
|
23
|
+
message: commit.message,
|
|
24
|
+
author: commit.author_name ? { uid: commit.author_name, source } : null,
|
|
25
|
+
htmlUrl: commit.web_url,
|
|
26
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(commit.created_at),
|
|
27
|
+
repository,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Commits = Commits;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Converter } from '../converter';
|
|
3
|
+
export interface CategoryRef {
|
|
4
|
+
readonly category: string;
|
|
5
|
+
readonly detail: string;
|
|
6
|
+
}
|
|
7
|
+
interface OrgKey {
|
|
8
|
+
uid: string;
|
|
9
|
+
source: string;
|
|
10
|
+
}
|
|
11
|
+
interface RepositoryKey {
|
|
12
|
+
name: string;
|
|
13
|
+
uid: string;
|
|
14
|
+
organization: OrgKey;
|
|
15
|
+
}
|
|
16
|
+
/** Common functions shares across GitLab converters */
|
|
17
|
+
export declare class GitlabCommon {
|
|
18
|
+
static readonly MAX_DESCRIPTION_LENGTH = 1000;
|
|
19
|
+
static parseRepositoryKey(webUrl: string | undefined, source: string, startIndex?: number): undefined | RepositoryKey;
|
|
20
|
+
static convertBuildStatus(status?: string): CategoryRef;
|
|
21
|
+
}
|
|
22
|
+
/** GitLab converter base */
|
|
23
|
+
export declare abstract class GitlabConverter extends Converter {
|
|
24
|
+
source: string;
|
|
25
|
+
/** Almost every GitLab record have id property. Function will be
|
|
26
|
+
* override if record doesn't have id property.
|
|
27
|
+
*/
|
|
28
|
+
id(record: AirbyteRecord): any;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitlabConverter = exports.GitlabCommon = void 0;
|
|
4
|
+
const converter_1 = require("../converter");
|
|
5
|
+
/** Common functions shares across GitLab converters */
|
|
6
|
+
class GitlabCommon {
|
|
7
|
+
static parseRepositoryKey(webUrl, source, startIndex = 3) {
|
|
8
|
+
if (!webUrl)
|
|
9
|
+
return undefined;
|
|
10
|
+
const repositoryIndex = startIndex + 1;
|
|
11
|
+
const orgRepo = webUrl.split('/');
|
|
12
|
+
if (orgRepo.length < repositoryIndex)
|
|
13
|
+
return undefined;
|
|
14
|
+
const organization = orgRepo[startIndex];
|
|
15
|
+
const repositoryName = orgRepo[repositoryIndex];
|
|
16
|
+
return {
|
|
17
|
+
name: repositoryName === null || repositoryName === void 0 ? void 0 : repositoryName.toLowerCase(),
|
|
18
|
+
uid: repositoryName === null || repositoryName === void 0 ? void 0 : repositoryName.toLowerCase(),
|
|
19
|
+
organization: { uid: organization === null || organization === void 0 ? void 0 : organization.toLowerCase(), source },
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
// GitLab defined status for:
|
|
23
|
+
// >> pipelines (aka builds): created, waiting_for_resource, preparing, pending,
|
|
24
|
+
// running, success, failed, canceled, skipped, manual, scheduled
|
|
25
|
+
// >> jobs: created, pending, running, failed, success, canceled, skipped, or manual.
|
|
26
|
+
static convertBuildStatus(status) {
|
|
27
|
+
if (!status) {
|
|
28
|
+
return { category: 'Unknown', detail: 'undefined' };
|
|
29
|
+
}
|
|
30
|
+
const detail = status === null || status === void 0 ? void 0 : status.toLowerCase();
|
|
31
|
+
switch (detail) {
|
|
32
|
+
case 'canceled':
|
|
33
|
+
return { category: 'Canceled', detail };
|
|
34
|
+
case 'failed':
|
|
35
|
+
return { category: 'Failed', detail };
|
|
36
|
+
case 'running':
|
|
37
|
+
return { category: 'Running', detail };
|
|
38
|
+
case 'success':
|
|
39
|
+
return { category: 'Success', detail };
|
|
40
|
+
case 'created':
|
|
41
|
+
case 'manual':
|
|
42
|
+
case 'pending':
|
|
43
|
+
case 'preparing':
|
|
44
|
+
case 'scheduled':
|
|
45
|
+
case 'waiting_for_resource':
|
|
46
|
+
return { category: 'Queued', detail };
|
|
47
|
+
case 'skipped':
|
|
48
|
+
default:
|
|
49
|
+
return { category: 'Custom', detail };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.GitlabCommon = GitlabCommon;
|
|
54
|
+
// Max length for free-form description text fields such as issue body
|
|
55
|
+
GitlabCommon.MAX_DESCRIPTION_LENGTH = 1000;
|
|
56
|
+
/** GitLab converter base */
|
|
57
|
+
class GitlabConverter extends converter_1.Converter {
|
|
58
|
+
constructor() {
|
|
59
|
+
super(...arguments);
|
|
60
|
+
this.source = 'GitLab';
|
|
61
|
+
}
|
|
62
|
+
/** Almost every GitLab record have id property. Function will be
|
|
63
|
+
* override if record doesn't have id property.
|
|
64
|
+
*/
|
|
65
|
+
id(record) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
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;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.GitlabConverter = GitlabConverter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class GroupLabels extends GitlabConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupLabels = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class GroupLabels extends common_1.GitlabConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = ['tms_Label'];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
const label = record.record.data;
|
|
12
|
+
return [{ model: 'tms_Label', record: { name: label.name } }];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.GroupLabels = GroupLabels;
|
|
@@ -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 GroupMilestones extends GitlabConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
private epicStatus;
|
|
8
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupMilestones = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class GroupMilestones extends common_1.GitlabConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = ['tms_Epic'];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
var _a;
|
|
12
|
+
const source = this.streamName.source;
|
|
13
|
+
const milestone = record.record.data;
|
|
14
|
+
const repository = common_1.GitlabCommon.parseRepositoryKey(milestone.web_url, source, 4);
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
model: 'tms_Epic',
|
|
18
|
+
record: {
|
|
19
|
+
uid: String(milestone.id),
|
|
20
|
+
name: milestone.title,
|
|
21
|
+
description: (_a = milestone.description) === null || _a === void 0 ? void 0 : _a.substring(0, common_1.GitlabCommon.MAX_DESCRIPTION_LENGTH),
|
|
22
|
+
project: repository ? { uid: repository.name, source } : null,
|
|
23
|
+
status: this.epicStatus(milestone.state),
|
|
24
|
+
source,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
epicStatus(state) {
|
|
30
|
+
const detail = state === null || state === void 0 ? void 0 : state.toLowerCase();
|
|
31
|
+
switch (detail) {
|
|
32
|
+
case 'active':
|
|
33
|
+
return { category: 'InProgress', detail };
|
|
34
|
+
case 'closed':
|
|
35
|
+
return { category: 'Done', detail };
|
|
36
|
+
default:
|
|
37
|
+
return { category: 'Custom', detail };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.GroupMilestones = GroupMilestones;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class Groups extends GitlabConverter {
|
|
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.Groups = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Groups extends common_1.GitlabConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [
|
|
10
|
+
'cicd_Organization',
|
|
11
|
+
'vcs_Organization',
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
async convert(record, ctx) {
|
|
15
|
+
var _a;
|
|
16
|
+
const source = this.streamName.source;
|
|
17
|
+
const group = record.record.data;
|
|
18
|
+
const res = [];
|
|
19
|
+
res.push({
|
|
20
|
+
model: 'cicd_Organization',
|
|
21
|
+
record: {
|
|
22
|
+
uid: group.path,
|
|
23
|
+
description: (_a = group.description) === null || _a === void 0 ? void 0 : _a.substring(0, common_1.GitlabCommon.MAX_DESCRIPTION_LENGTH),
|
|
24
|
+
name: group.name,
|
|
25
|
+
url: group.web_url,
|
|
26
|
+
source,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
res.push({
|
|
30
|
+
model: 'vcs_Organization',
|
|
31
|
+
record: {
|
|
32
|
+
uid: group.path,
|
|
33
|
+
name: group.name,
|
|
34
|
+
htmlUrl: group.web_url,
|
|
35
|
+
type: { category: 'Group', detail: '' },
|
|
36
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(group.created_at),
|
|
37
|
+
source,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
return res;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.Groups = Groups;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class Issues extends GitlabConverter {
|
|
5
|
+
private readonly logger;
|
|
6
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
7
|
+
private readonly usersStream;
|
|
8
|
+
get dependencies(): ReadonlyArray<StreamName>;
|
|
9
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Issues = void 0;
|
|
4
|
+
const faros_airbyte_cdk_1 = require("faros-airbyte-cdk");
|
|
5
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
6
|
+
const converter_1 = require("../converter");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
class Issues extends common_1.GitlabConverter {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.logger = new faros_airbyte_cdk_1.AirbyteLogger();
|
|
12
|
+
this.destinationModels = [
|
|
13
|
+
'tms_Label',
|
|
14
|
+
'tms_Task',
|
|
15
|
+
'tms_TaskAssignment',
|
|
16
|
+
'tms_TaskTag',
|
|
17
|
+
];
|
|
18
|
+
this.usersStream = new converter_1.StreamName('gitlab', 'users');
|
|
19
|
+
}
|
|
20
|
+
get dependencies() {
|
|
21
|
+
return [this.usersStream];
|
|
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 usersStream = this.usersStream.asString;
|
|
29
|
+
const uid = String(issue.id);
|
|
30
|
+
(_a = issue.assignees) === null || _a === void 0 ? void 0 : _a.forEach((assignee) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if (assignee) {
|
|
33
|
+
const assigneeUser = ctx.get(usersStream, String(assignee));
|
|
34
|
+
const assigneeUsername = (_b = (_a = assigneeUser === null || assigneeUser === void 0 ? void 0 : assigneeUser.record) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.username;
|
|
35
|
+
if (assigneeUsername) {
|
|
36
|
+
res.push({
|
|
37
|
+
model: 'tms_TaskAssignment',
|
|
38
|
+
record: {
|
|
39
|
+
task: { uid, source },
|
|
40
|
+
assignee: { uid: assigneeUsername, source },
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.logger.warn(`Could not find assigneeUser from StreamContext for this record: ${this.id}:${assignee}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
issue.labels.forEach((label) => {
|
|
50
|
+
res.push({ model: 'tms_Label', record: { name: label } });
|
|
51
|
+
res.push({
|
|
52
|
+
model: 'tms_TaskTag',
|
|
53
|
+
record: {
|
|
54
|
+
task: { uid, source },
|
|
55
|
+
label: { name: label },
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
const user = ctx.get(usersStream, String(issue.author_id));
|
|
60
|
+
const username = (_c = (_b = user === null || user === void 0 ? void 0 : user.record) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.username;
|
|
61
|
+
const category = issue.state === 'opened' ? 'Todo' : 'Done';
|
|
62
|
+
res.push({
|
|
63
|
+
model: 'tms_Task',
|
|
64
|
+
record: {
|
|
65
|
+
uid,
|
|
66
|
+
name: issue.title,
|
|
67
|
+
description: (_d = issue.description) === null || _d === void 0 ? void 0 : _d.substring(0, common_1.GitlabCommon.MAX_DESCRIPTION_LENGTH),
|
|
68
|
+
status: { category, detail: issue.state },
|
|
69
|
+
creator: username ? { uid: username, source } : null,
|
|
70
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(issue.created_at),
|
|
71
|
+
updatedAt: faros_feeds_sdk_1.Utils.toDate(issue.updated_at),
|
|
72
|
+
url: issue.web_url,
|
|
73
|
+
source,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
return res;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.Issues = Issues;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class Jobs extends GitlabConverter {
|
|
5
|
+
private readonly logger;
|
|
6
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
7
|
+
private readonly pipelinesStream;
|
|
8
|
+
get dependencies(): ReadonlyArray<StreamName>;
|
|
9
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
10
|
+
private convertBuildStepType;
|
|
11
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Jobs = void 0;
|
|
4
|
+
const faros_airbyte_cdk_1 = require("faros-airbyte-cdk");
|
|
5
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
6
|
+
const converter_1 = require("../converter");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
class Jobs extends common_1.GitlabConverter {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.logger = new faros_airbyte_cdk_1.AirbyteLogger();
|
|
12
|
+
this.destinationModels = [
|
|
13
|
+
'cicd_BuildStep',
|
|
14
|
+
];
|
|
15
|
+
this.pipelinesStream = new converter_1.StreamName('gitlab', 'pipelines');
|
|
16
|
+
}
|
|
17
|
+
get dependencies() {
|
|
18
|
+
return [this.pipelinesStream];
|
|
19
|
+
}
|
|
20
|
+
async convert(record, ctx) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const source = this.streamName.source;
|
|
23
|
+
const job = record.record.data;
|
|
24
|
+
const repository = common_1.GitlabCommon.parseRepositoryKey(job.web_url, source);
|
|
25
|
+
const pipelinesStream = this.pipelinesStream.asString;
|
|
26
|
+
const pipeline = ctx.get(pipelinesStream, String(job.pipeline_id));
|
|
27
|
+
const pipelineId = (_b = (_a = pipeline === null || pipeline === void 0 ? void 0 : pipeline.record) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.id;
|
|
28
|
+
if (!repository || !pipelineId) {
|
|
29
|
+
const message = !pipelineId
|
|
30
|
+
? `Could not find pipelineId from StreamContext for this record:
|
|
31
|
+
${this.id}:${job.pipeline_id}`
|
|
32
|
+
: `Could not find repository from web_url: ${this.id}:${job.web_url}`;
|
|
33
|
+
this.logger.warn(message);
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
const buildKey = {
|
|
37
|
+
uid: String(pipelineId),
|
|
38
|
+
pipeline: {
|
|
39
|
+
organization: repository.organization,
|
|
40
|
+
uid: repository.name,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
model: 'cicd_BuildStep',
|
|
46
|
+
record: {
|
|
47
|
+
uid: String(job.id),
|
|
48
|
+
name: job.name,
|
|
49
|
+
type: this.convertBuildStepType(job.stage),
|
|
50
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(job.created_at),
|
|
51
|
+
startedAt: faros_feeds_sdk_1.Utils.toDate(job.started_at),
|
|
52
|
+
endedAt: faros_feeds_sdk_1.Utils.toDate(job.finished_at),
|
|
53
|
+
status: common_1.GitlabCommon.convertBuildStatus(job.status),
|
|
54
|
+
url: job.web_url,
|
|
55
|
+
build: buildKey,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
convertBuildStepType(stage) {
|
|
61
|
+
if (!stage) {
|
|
62
|
+
return { category: 'Custom', detail: 'undefined' };
|
|
63
|
+
}
|
|
64
|
+
const detail = stage === null || stage === void 0 ? void 0 : stage.toLowerCase();
|
|
65
|
+
switch (detail) {
|
|
66
|
+
case 'script':
|
|
67
|
+
return { category: 'Script', detail };
|
|
68
|
+
case 'manual':
|
|
69
|
+
return { category: 'Manual', detail };
|
|
70
|
+
default:
|
|
71
|
+
return { category: 'Custom', detail };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.Jobs = Jobs;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class MergeRequestCommits extends GitlabConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MergeRequestCommits = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class MergeRequestCommits extends common_1.GitlabConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = ['vcs_Commit'];
|
|
10
|
+
}
|
|
11
|
+
async convert(record, ctx) {
|
|
12
|
+
var _a;
|
|
13
|
+
const source = this.streamName.source;
|
|
14
|
+
const commit = record.record.data;
|
|
15
|
+
const repository = common_1.GitlabCommon.parseRepositoryKey(commit.web_url, source);
|
|
16
|
+
if (!repository)
|
|
17
|
+
return [];
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
model: 'vcs_Commit',
|
|
21
|
+
record: {
|
|
22
|
+
sha: commit.sha,
|
|
23
|
+
uid: commit.sha,
|
|
24
|
+
message: (_a = commit.description) === null || _a === void 0 ? void 0 : _a.substring(0, common_1.GitlabCommon.MAX_DESCRIPTION_LENGTH),
|
|
25
|
+
author: commit.author ? { uid: commit.author.username, source } : null,
|
|
26
|
+
htmlUrl: commit.web_url,
|
|
27
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(commit.created_at),
|
|
28
|
+
repository,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.MergeRequestCommits = MergeRequestCommits;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class MergeRequests extends GitlabConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
private readonly usersStream;
|
|
7
|
+
get dependencies(): ReadonlyArray<StreamName>;
|
|
8
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
9
|
+
private pullRequestState;
|
|
10
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MergeRequests = 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 MergeRequests extends common_1.GitlabConverter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.destinationModels = [
|
|
11
|
+
'vcs_PullRequest',
|
|
12
|
+
];
|
|
13
|
+
this.usersStream = new converter_1.StreamName('gitlab', 'users');
|
|
14
|
+
}
|
|
15
|
+
get dependencies() {
|
|
16
|
+
return [this.usersStream];
|
|
17
|
+
}
|
|
18
|
+
async convert(record, ctx) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const source = this.streamName.source;
|
|
21
|
+
const mr = record.record.data;
|
|
22
|
+
const repository = common_1.GitlabCommon.parseRepositoryKey(mr.web_url, source);
|
|
23
|
+
if (!repository)
|
|
24
|
+
return [];
|
|
25
|
+
const usersStream = this.usersStream.asString;
|
|
26
|
+
const user = ctx.get(usersStream, String(mr.author_id));
|
|
27
|
+
const username = (_b = (_a = user === null || user === void 0 ? void 0 : user.record) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.username;
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
model: 'vcs_PullRequest',
|
|
31
|
+
record: {
|
|
32
|
+
number: mr.id,
|
|
33
|
+
uid: mr.id.toString(),
|
|
34
|
+
title: mr.title,
|
|
35
|
+
state: this.pullRequestState(mr.state),
|
|
36
|
+
htmlUrl: mr.web_url,
|
|
37
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(mr.created_at),
|
|
38
|
+
updatedAt: faros_feeds_sdk_1.Utils.toDate(mr.updated_at),
|
|
39
|
+
mergedAt: faros_feeds_sdk_1.Utils.toDate(mr.merged_at),
|
|
40
|
+
commentCount: faros_feeds_sdk_1.Utils.parseInteger(mr.user_notes_count),
|
|
41
|
+
author: username ? { uid: username, source } : null,
|
|
42
|
+
mergeCommit: mr.merge_commit_sha
|
|
43
|
+
? { repository, sha: mr.merge_commit_sha }
|
|
44
|
+
: null,
|
|
45
|
+
repository,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
pullRequestState(state) {
|
|
51
|
+
const detail = state === null || state === void 0 ? void 0 : state.toLowerCase();
|
|
52
|
+
switch (detail) {
|
|
53
|
+
case 'closed':
|
|
54
|
+
case 'locked':
|
|
55
|
+
return { category: 'Closed', detail };
|
|
56
|
+
case 'merged':
|
|
57
|
+
return { category: 'Merged', detail };
|
|
58
|
+
case 'opened':
|
|
59
|
+
return { category: 'Open', detail };
|
|
60
|
+
default:
|
|
61
|
+
return { category: 'Custom', detail };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.MergeRequests = MergeRequests;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class Pipelines extends GitlabConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pipelines = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Pipelines extends common_1.GitlabConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = ['cicd_Build'];
|
|
10
|
+
}
|
|
11
|
+
async convert(record, ctx) {
|
|
12
|
+
const source = this.streamName.source;
|
|
13
|
+
const pipeline = record.record.data;
|
|
14
|
+
const repository = common_1.GitlabCommon.parseRepositoryKey(pipeline.web_url, source);
|
|
15
|
+
if (!repository)
|
|
16
|
+
return [];
|
|
17
|
+
const status = common_1.GitlabCommon.convertBuildStatus(pipeline.status);
|
|
18
|
+
const endedAt = status.category == 'Running' || status.category == 'Queued'
|
|
19
|
+
? null
|
|
20
|
+
: faros_feeds_sdk_1.Utils.toDate(pipeline.updated_at);
|
|
21
|
+
const pipelineKey = {
|
|
22
|
+
organization: repository.organization,
|
|
23
|
+
uid: repository.name,
|
|
24
|
+
};
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
model: 'cicd_Build',
|
|
28
|
+
record: {
|
|
29
|
+
uid: String(pipeline.id),
|
|
30
|
+
number: pipeline.id,
|
|
31
|
+
pipeline: pipelineKey,
|
|
32
|
+
status,
|
|
33
|
+
url: pipeline.web_url,
|
|
34
|
+
startedAt: faros_feeds_sdk_1.Utils.toDate(pipeline.created_at),
|
|
35
|
+
endedAt,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.Pipelines = Pipelines;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitlabConverter } from './common';
|
|
4
|
+
export declare class ProjectLabels extends GitlabConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectLabels = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class ProjectLabels extends common_1.GitlabConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = ['tms_Label'];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
const label = record.record.data;
|
|
12
|
+
return [{ model: 'tms_Label', record: { name: label.name } }];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ProjectLabels = ProjectLabels;
|
|
@@ -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 ProjectMilestones extends GitlabConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
private epicStatus;
|
|
8
|
+
}
|