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,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Executions = void 0;
|
|
4
|
+
const faros_airbyte_cdk_1 = require("faros-airbyte-cdk");
|
|
5
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const DEFAULT_CICD_ORGANIZATION_UID = 'default';
|
|
8
|
+
const DEFAULT_EXECUTION_TAG_APPLICATION_PLATFORM = 'faros_app_platform';
|
|
9
|
+
const DEFAULT_EXECUTION_TAG_ARTIFACT_ORG = 'faros_artifact_org';
|
|
10
|
+
const DEFAULT_EXECUTION_TAG_ARTIFACT_SOURCE = 'faros_artifact_source';
|
|
11
|
+
const DEFAULT_EXECUTION_TAG_ARTIFACT_REPO = 'faros_artifact_repo';
|
|
12
|
+
class Executions extends common_1.HarnessConverter {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.logger = new faros_airbyte_cdk_1.AirbyteLogger();
|
|
16
|
+
this.destinationModels = [
|
|
17
|
+
'cicd_ArtifactDeployment',
|
|
18
|
+
'cicd_Build',
|
|
19
|
+
'cicd_Deployment',
|
|
20
|
+
'compute_Application',
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
async convert(record, ctx) {
|
|
24
|
+
var _a;
|
|
25
|
+
const executionRaw = record.record.data;
|
|
26
|
+
const source = this.streamName.source;
|
|
27
|
+
const res = [];
|
|
28
|
+
const execution = this.toExecution(executionRaw, source);
|
|
29
|
+
const application = {
|
|
30
|
+
name: execution.application.name,
|
|
31
|
+
platform: (_a = execution.application.platform) !== null && _a !== void 0 ? _a : '',
|
|
32
|
+
};
|
|
33
|
+
res.push({ model: 'compute_Application', record: application });
|
|
34
|
+
const deploymentStatus = this.toDeploymentStatus(execution.status);
|
|
35
|
+
const buildStatus = this.toBuildStatus(execution.status);
|
|
36
|
+
const deployment = {
|
|
37
|
+
uid: execution.uid,
|
|
38
|
+
source,
|
|
39
|
+
};
|
|
40
|
+
res.push({
|
|
41
|
+
model: 'cicd_Deployment',
|
|
42
|
+
record: {
|
|
43
|
+
...deployment,
|
|
44
|
+
application,
|
|
45
|
+
build: execution.build,
|
|
46
|
+
startedAt: faros_feeds_sdk_1.Utils.toDate(execution.startedAt),
|
|
47
|
+
endedAt: faros_feeds_sdk_1.Utils.toDate(execution.endedAt),
|
|
48
|
+
env: this.toEnvironmentStatus(execution.env),
|
|
49
|
+
status: deploymentStatus,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
if (execution.build) {
|
|
53
|
+
res.push({
|
|
54
|
+
model: 'cicd_Build',
|
|
55
|
+
record: {
|
|
56
|
+
...execution.build,
|
|
57
|
+
startedAt: faros_feeds_sdk_1.Utils.toDate(execution.startedAt),
|
|
58
|
+
endedAt: faros_feeds_sdk_1.Utils.toDate(execution.endedAt),
|
|
59
|
+
status: buildStatus,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (execution.artifact) {
|
|
64
|
+
this.logger.debug(`Writing Artifact ${execution.artifact.uid} deployment association`);
|
|
65
|
+
res.push({
|
|
66
|
+
model: 'cicd_ArtifactDeployment',
|
|
67
|
+
record: {
|
|
68
|
+
artifact: execution.artifact,
|
|
69
|
+
deployment,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return res;
|
|
74
|
+
}
|
|
75
|
+
parseArtifactFromTags(execution) {
|
|
76
|
+
var _a, _b, _c, _d;
|
|
77
|
+
if (!execution.artifacts || !execution.artifacts.length) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const executionArtifact = execution.artifacts[0];
|
|
81
|
+
// artifact repo organization pulled from application tags
|
|
82
|
+
const organization = {
|
|
83
|
+
uid: (_a = execution.application.tags.find((t) => t.name === DEFAULT_EXECUTION_TAG_ARTIFACT_ORG)) === null || _a === void 0 ? void 0 : _a.value,
|
|
84
|
+
source: (_c = (_b = execution.application.tags.find((t) => t.name === DEFAULT_EXECUTION_TAG_ARTIFACT_SOURCE)) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : executionArtifact === null || executionArtifact === void 0 ? void 0 : executionArtifact.artifactSource.name,
|
|
85
|
+
};
|
|
86
|
+
const repository = {
|
|
87
|
+
uid: (_d = execution.application.tags.find((t) => t.name === DEFAULT_EXECUTION_TAG_ARTIFACT_REPO)) === null || _d === void 0 ? void 0 : _d.value,
|
|
88
|
+
organization,
|
|
89
|
+
};
|
|
90
|
+
const artifact = {
|
|
91
|
+
uid: executionArtifact === null || executionArtifact === void 0 ? void 0 : executionArtifact.buildNo,
|
|
92
|
+
repository,
|
|
93
|
+
};
|
|
94
|
+
if (artifact.uid &&
|
|
95
|
+
artifact.repository.uid &&
|
|
96
|
+
artifact.repository.organization.uid &&
|
|
97
|
+
artifact.repository.organization.source) {
|
|
98
|
+
return artifact;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
parseWorkflow(execution, source) {
|
|
105
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
106
|
+
const outcome = (_a = execution.outcomes) === null || _a === void 0 ? void 0 : _a.nodes.find((o) => { var _a; return (_a = o.service) === null || _a === void 0 ? void 0 : _a.artifactType; });
|
|
107
|
+
if (!outcome) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
const artifactSource = outcome.service.artifactSources.find((a) => a.name);
|
|
111
|
+
if (!artifactSource) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
const build = {
|
|
115
|
+
uid: execution.id,
|
|
116
|
+
pipeline: {
|
|
117
|
+
uid: (_c = (_b = outcome.service.name) !== null && _b !== void 0 ? _b : execution.application.name) !== null && _c !== void 0 ? _c : artifactSource.name,
|
|
118
|
+
organization: {
|
|
119
|
+
uid: DEFAULT_CICD_ORGANIZATION_UID,
|
|
120
|
+
source,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
let artifact = undefined;
|
|
125
|
+
// artifact computation needs to have application tags
|
|
126
|
+
if (execution.application.tags) {
|
|
127
|
+
artifact = this.parseArtifactFromTags(execution);
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
application: {
|
|
131
|
+
name: (_d = execution.application.name) !== null && _d !== void 0 ? _d : artifactSource.name,
|
|
132
|
+
platform: (_g = (_f = (_e = execution.application.tags) === null || _e === void 0 ? void 0 : _e.find((t) => t.name === DEFAULT_EXECUTION_TAG_APPLICATION_PLATFORM)) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : '',
|
|
133
|
+
},
|
|
134
|
+
env: (_h = outcome.environment.name) !== null && _h !== void 0 ? _h : outcome.environment.type,
|
|
135
|
+
build,
|
|
136
|
+
artifact,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
parsePipeline(execution) {
|
|
140
|
+
var _a, _b, _c;
|
|
141
|
+
const service = (_a = execution.application.services) === null || _a === void 0 ? void 0 : _a.nodes.find((s) => s.artifactType);
|
|
142
|
+
if (!service) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const artifactSource = service.artifactSources.find((a) => a.name);
|
|
146
|
+
const environment = (_b = execution.application.environments) === null || _b === void 0 ? void 0 : _b.nodes.find((e) => e.type);
|
|
147
|
+
if (!artifactSource || !environment) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
application: {
|
|
152
|
+
name: artifactSource.name,
|
|
153
|
+
platform: service.artifactType,
|
|
154
|
+
},
|
|
155
|
+
env: (_c = environment.name) !== null && _c !== void 0 ? _c : environment.type,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
toBuildStatus(status) {
|
|
159
|
+
const statusLower = status.toLowerCase();
|
|
160
|
+
switch (statusLower) {
|
|
161
|
+
case 'aborted':
|
|
162
|
+
case 'rejected':
|
|
163
|
+
return { category: 'Canceled', detail: status };
|
|
164
|
+
case 'error':
|
|
165
|
+
case 'expired':
|
|
166
|
+
case 'failed':
|
|
167
|
+
return { category: 'Failed', detail: status };
|
|
168
|
+
case 'paused':
|
|
169
|
+
case 'queued':
|
|
170
|
+
case 'waiting':
|
|
171
|
+
return { category: 'Queued', detail: status };
|
|
172
|
+
case 'resumed':
|
|
173
|
+
case 'running':
|
|
174
|
+
return { category: 'Running', detail: status };
|
|
175
|
+
case 'success':
|
|
176
|
+
return { category: 'Success', detail: status };
|
|
177
|
+
case 'skipped':
|
|
178
|
+
default:
|
|
179
|
+
return { category: 'Custom', detail: status };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
toEnvironmentStatus(status) {
|
|
183
|
+
const statusLower = status.toLowerCase();
|
|
184
|
+
if (statusLower.startsWith('prod')) {
|
|
185
|
+
return { category: 'Prod', detail: status };
|
|
186
|
+
}
|
|
187
|
+
if (statusLower === 'staging') {
|
|
188
|
+
return { category: 'Staging', detail: status };
|
|
189
|
+
}
|
|
190
|
+
if (statusLower.startsWith('dev')) {
|
|
191
|
+
return { category: 'Dev', detail: status };
|
|
192
|
+
}
|
|
193
|
+
if (statusLower === 'qa') {
|
|
194
|
+
return { category: 'QA', detail: status };
|
|
195
|
+
}
|
|
196
|
+
return { category: 'Custom', detail: status };
|
|
197
|
+
}
|
|
198
|
+
toExecution(item, source) {
|
|
199
|
+
let implementation;
|
|
200
|
+
if (item.outcomes) {
|
|
201
|
+
implementation = this.parseWorkflow(item, source);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
implementation = this.parsePipeline(item);
|
|
205
|
+
}
|
|
206
|
+
if (!implementation) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
uid: item.id,
|
|
211
|
+
application: implementation.application,
|
|
212
|
+
startedAt: item.startedAt,
|
|
213
|
+
endedAt: item.endedAt,
|
|
214
|
+
env: implementation.env,
|
|
215
|
+
status: item.status,
|
|
216
|
+
build: implementation.build,
|
|
217
|
+
artifact: implementation.artifact,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
toDeploymentStatus(status) {
|
|
221
|
+
const statusLower = status.toLowerCase();
|
|
222
|
+
switch (statusLower) {
|
|
223
|
+
case 'aborted':
|
|
224
|
+
case 'rejected':
|
|
225
|
+
return { category: 'Canceled', detail: status };
|
|
226
|
+
case 'error':
|
|
227
|
+
case 'expired':
|
|
228
|
+
case 'failed':
|
|
229
|
+
return { category: 'Failed', detail: status };
|
|
230
|
+
case 'paused':
|
|
231
|
+
case 'queued':
|
|
232
|
+
case 'waiting':
|
|
233
|
+
return { category: 'Queued', detail: status };
|
|
234
|
+
case 'resumed':
|
|
235
|
+
case 'running':
|
|
236
|
+
return { category: 'Running', detail: status };
|
|
237
|
+
case 'success':
|
|
238
|
+
return { category: 'Success', detail: status };
|
|
239
|
+
case 'skipped':
|
|
240
|
+
default:
|
|
241
|
+
return { category: 'Custom', detail: status };
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
exports.Executions = Executions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { JenkinsConverter } from './common';
|
|
4
|
+
export declare class Builds extends JenkinsConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
id(record: AirbyteRecord): any;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
private convertBuildStatus;
|
|
9
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Builds = void 0;
|
|
4
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Builds extends common_1.JenkinsConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [
|
|
10
|
+
'cicd_Organization',
|
|
11
|
+
'cicd_Pipeline',
|
|
12
|
+
'cicd_Build',
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
id(record) {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
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;
|
|
18
|
+
}
|
|
19
|
+
async convert(record, ctx) {
|
|
20
|
+
const source = this.streamName.source;
|
|
21
|
+
const build = record.record.data;
|
|
22
|
+
const jenkinsUrl = common_1.JenkinsCommon.parseJenkinsUrl(build.url);
|
|
23
|
+
if (!jenkinsUrl)
|
|
24
|
+
return [];
|
|
25
|
+
const organization = common_1.JenkinsCommon.cicd_Organization(jenkinsUrl, source);
|
|
26
|
+
const orgKey = { uid: organization.record.uid, source };
|
|
27
|
+
const jobFullName = build.fullDisplayName.replace(/ #.*/, '');
|
|
28
|
+
const job = {
|
|
29
|
+
fullName: jobFullName,
|
|
30
|
+
name: jobFullName,
|
|
31
|
+
url: jenkinsUrl.url.replace(/[^/]*(\/)?$/, ''),
|
|
32
|
+
};
|
|
33
|
+
const pipeline = common_1.JenkinsCommon.cicd_Pipeline(job, orgKey);
|
|
34
|
+
const buildRecord = {
|
|
35
|
+
model: 'cicd_Build',
|
|
36
|
+
record: {
|
|
37
|
+
uid: build.id,
|
|
38
|
+
name: build.displayName,
|
|
39
|
+
number: build.number,
|
|
40
|
+
startedAt: faros_feeds_sdk_1.Utils.toDate(build.timestamp),
|
|
41
|
+
endedAt: faros_feeds_sdk_1.Utils.toDate(build.timestamp + build.duration),
|
|
42
|
+
status: this.convertBuildStatus(build.result),
|
|
43
|
+
url: jenkinsUrl.url,
|
|
44
|
+
pipeline: {
|
|
45
|
+
uid: pipeline.record.uid,
|
|
46
|
+
organization: orgKey,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
return [organization, pipeline, buildRecord];
|
|
51
|
+
}
|
|
52
|
+
convertBuildStatus(status) {
|
|
53
|
+
if (!status) {
|
|
54
|
+
return { category: 'Unknown', detail: null };
|
|
55
|
+
}
|
|
56
|
+
const detail = status.toLowerCase();
|
|
57
|
+
// Read more on Jenkins build results:
|
|
58
|
+
// 1. https://wiki.jenkins.io/display/jenkins/terminology
|
|
59
|
+
// 2. https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Result.java
|
|
60
|
+
switch (detail) {
|
|
61
|
+
case 'not_built':
|
|
62
|
+
case 'aborted':
|
|
63
|
+
return { category: 'Canceled', detail };
|
|
64
|
+
case 'failure':
|
|
65
|
+
case 'unstable':
|
|
66
|
+
return { category: 'Failed', detail };
|
|
67
|
+
case 'success':
|
|
68
|
+
return { category: 'Success', detail };
|
|
69
|
+
default:
|
|
70
|
+
return { category: 'Unknown', detail };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.Builds = Builds;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Converter, DestinationRecord } from '../converter';
|
|
2
|
+
interface JenkinsUrl {
|
|
3
|
+
hostname: string;
|
|
4
|
+
url: string;
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Job {
|
|
8
|
+
readonly fullName: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly url: string;
|
|
11
|
+
}
|
|
12
|
+
interface OrganizationKey {
|
|
13
|
+
uid: string;
|
|
14
|
+
source: string;
|
|
15
|
+
}
|
|
16
|
+
/** Common functions shares across Jenkins converters */
|
|
17
|
+
export declare class JenkinsCommon {
|
|
18
|
+
static cicd_Organization(jenkinsUrl: JenkinsUrl, source: string): DestinationRecord;
|
|
19
|
+
static cicd_Pipeline(job: Job, organization: OrganizationKey): DestinationRecord;
|
|
20
|
+
static parseJenkinsUrl(initUrl: string): undefined | JenkinsUrl;
|
|
21
|
+
}
|
|
22
|
+
export declare abstract class JenkinsConverter extends Converter {
|
|
23
|
+
source: string;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JenkinsConverter = exports.JenkinsCommon = void 0;
|
|
4
|
+
const url_1 = require("url");
|
|
5
|
+
const converter_1 = require("../converter");
|
|
6
|
+
/** Common functions shares across Jenkins converters */
|
|
7
|
+
class JenkinsCommon {
|
|
8
|
+
static cicd_Organization(jenkinsUrl, source) {
|
|
9
|
+
return {
|
|
10
|
+
model: 'cicd_Organization',
|
|
11
|
+
record: {
|
|
12
|
+
uid: jenkinsUrl.hostname.toLowerCase(),
|
|
13
|
+
name: jenkinsUrl.hostname,
|
|
14
|
+
url: jenkinsUrl.baseUrl,
|
|
15
|
+
source,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
static cicd_Pipeline(job, organization) {
|
|
20
|
+
return {
|
|
21
|
+
model: 'cicd_Pipeline',
|
|
22
|
+
record: {
|
|
23
|
+
uid: job.fullName.toLowerCase(),
|
|
24
|
+
name: job.name,
|
|
25
|
+
url: job.url,
|
|
26
|
+
organization,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static parseJenkinsUrl(initUrl) {
|
|
31
|
+
try {
|
|
32
|
+
const urlParsed = new url_1.URL(initUrl);
|
|
33
|
+
const hostname = urlParsed.hostname;
|
|
34
|
+
const url = urlParsed.toString();
|
|
35
|
+
urlParsed.pathname = '';
|
|
36
|
+
const baseUrl = urlParsed.toString();
|
|
37
|
+
if (!hostname) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return { hostname, url, baseUrl };
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.JenkinsCommon = JenkinsCommon;
|
|
48
|
+
class JenkinsConverter extends converter_1.Converter {
|
|
49
|
+
constructor() {
|
|
50
|
+
super(...arguments);
|
|
51
|
+
this.source = 'Jenkins';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.JenkinsConverter = JenkinsConverter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { JenkinsConverter } from './common';
|
|
4
|
+
export declare class Jobs extends JenkinsConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
id(record: AirbyteRecord): any;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Jobs = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Jobs extends common_1.JenkinsConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'cicd_Organization',
|
|
10
|
+
'cicd_Pipeline',
|
|
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.fullName;
|
|
16
|
+
}
|
|
17
|
+
async convert(record, ctx) {
|
|
18
|
+
const source = this.streamName.source;
|
|
19
|
+
const job = record.record.data;
|
|
20
|
+
const jenkinsUrl = common_1.JenkinsCommon.parseJenkinsUrl(job.url);
|
|
21
|
+
if (!jenkinsUrl)
|
|
22
|
+
return [];
|
|
23
|
+
const organization = common_1.JenkinsCommon.cicd_Organization(jenkinsUrl, source);
|
|
24
|
+
const orgKey = { uid: organization.record.uid, source };
|
|
25
|
+
const pipeline = common_1.JenkinsCommon.cicd_Pipeline(job, orgKey);
|
|
26
|
+
return [organization, pipeline];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Jobs = Jobs;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { JiraConverter } from './common';
|
|
4
|
+
export declare class BoardIssues extends JiraConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoardIssues = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class BoardIssues extends common_1.JiraConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'tms_TaskBoardRelationship',
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
async convert(record, ctx) {
|
|
13
|
+
if (!this.useBoardOwnership(ctx))
|
|
14
|
+
return [];
|
|
15
|
+
const issue = record.record.data;
|
|
16
|
+
const source = this.streamName.source;
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
model: 'tms_TaskBoardRelationship',
|
|
20
|
+
record: {
|
|
21
|
+
task: { uid: issue.key, source },
|
|
22
|
+
board: { uid: String(issue.boardId), source },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.BoardIssues = BoardIssues;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { JiraConverter } from './common';
|
|
4
|
+
export declare class Boards extends JiraConverter {
|
|
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.Boards = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Boards extends common_1.JiraConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'tms_TaskBoard',
|
|
10
|
+
'tms_TaskBoardProjectRelationship',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
async convert(record, ctx) {
|
|
14
|
+
if (!this.useBoardOwnership(ctx))
|
|
15
|
+
return [];
|
|
16
|
+
const board = record.record.data;
|
|
17
|
+
const uid = board.id.toString();
|
|
18
|
+
const source = this.streamName.source;
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
model: 'tms_TaskBoard',
|
|
22
|
+
record: { uid, name: board.name, source },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
model: 'tms_TaskBoardProjectRelationship',
|
|
26
|
+
record: {
|
|
27
|
+
board: { uid, source },
|
|
28
|
+
project: { uid: board.projectKey, source },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.Boards = Boards;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Dictionary } from 'ts-essentials';
|
|
3
|
+
import { Converter, StreamContext } from '../converter';
|
|
4
|
+
export interface Assignee {
|
|
5
|
+
readonly uid: string;
|
|
6
|
+
readonly assignedAt: Date;
|
|
7
|
+
}
|
|
8
|
+
export declare enum RepoSource {
|
|
9
|
+
BITBUCKET = "Bitbucket",
|
|
10
|
+
GITHUB = "GitHub",
|
|
11
|
+
GITLAB = "GitLab",
|
|
12
|
+
VCS = "VCS"
|
|
13
|
+
}
|
|
14
|
+
export interface Repo {
|
|
15
|
+
readonly source: RepoSource;
|
|
16
|
+
readonly org: string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PullRequest {
|
|
20
|
+
readonly repo: Repo;
|
|
21
|
+
readonly number: number;
|
|
22
|
+
}
|
|
23
|
+
export interface Status {
|
|
24
|
+
readonly category: string;
|
|
25
|
+
readonly detail: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SprintIssue {
|
|
28
|
+
id: number;
|
|
29
|
+
key: string;
|
|
30
|
+
fields: Dictionary<any>;
|
|
31
|
+
issueId: string;
|
|
32
|
+
sprintId: number;
|
|
33
|
+
}
|
|
34
|
+
export declare class JiraCommon {
|
|
35
|
+
static POINTS_FIELD_NAMES: string[];
|
|
36
|
+
static DEV_FIELD_NAME: string;
|
|
37
|
+
static EPIC_LINK_FIELD_NAME: string;
|
|
38
|
+
static EPIC_TYPE_NAME: string;
|
|
39
|
+
static SPRINT_FIELD_NAME: string;
|
|
40
|
+
static DEFAULT_ADDITIONAL_FIELDS_ARRAY_LIMIT: number;
|
|
41
|
+
static DEFAULT_TRUNCATE_LIMIT: number;
|
|
42
|
+
static normalize(str: string): string;
|
|
43
|
+
}
|
|
44
|
+
export declare const JiraStatusCategories: ReadonlyMap<string, string>;
|
|
45
|
+
export interface JiraConfig {
|
|
46
|
+
additional_fields_array_limit?: number;
|
|
47
|
+
exclude_fields?: string[];
|
|
48
|
+
use_board_ownership?: boolean;
|
|
49
|
+
truncate_limit?: number;
|
|
50
|
+
}
|
|
51
|
+
export declare abstract class JiraConverter extends Converter {
|
|
52
|
+
source: string;
|
|
53
|
+
/** All Jira records should have id property */
|
|
54
|
+
id(record: AirbyteRecord): any;
|
|
55
|
+
protected jiraConfig(ctx: StreamContext): JiraConfig;
|
|
56
|
+
protected additionalFieldsArrayLimit(ctx: StreamContext): number;
|
|
57
|
+
protected excludeFields(ctx: StreamContext): Set<string>;
|
|
58
|
+
protected truncateLimit(ctx: StreamContext): number;
|
|
59
|
+
protected truncate(ctx: StreamContext, str?: string): string | undefined;
|
|
60
|
+
protected useBoardOwnership(ctx: StreamContext): boolean;
|
|
61
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JiraConverter = exports.JiraStatusCategories = exports.JiraCommon = exports.RepoSource = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const converter_1 = require("../converter");
|
|
6
|
+
var RepoSource;
|
|
7
|
+
(function (RepoSource) {
|
|
8
|
+
RepoSource["BITBUCKET"] = "Bitbucket";
|
|
9
|
+
RepoSource["GITHUB"] = "GitHub";
|
|
10
|
+
RepoSource["GITLAB"] = "GitLab";
|
|
11
|
+
RepoSource["VCS"] = "VCS";
|
|
12
|
+
})(RepoSource = exports.RepoSource || (exports.RepoSource = {}));
|
|
13
|
+
class JiraCommon {
|
|
14
|
+
static normalize(str) {
|
|
15
|
+
return str.replace(/\s/g, '').toLowerCase();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.JiraCommon = JiraCommon;
|
|
19
|
+
JiraCommon.POINTS_FIELD_NAMES = ['Story Points', 'Story point estimate'];
|
|
20
|
+
JiraCommon.DEV_FIELD_NAME = 'Development';
|
|
21
|
+
JiraCommon.EPIC_LINK_FIELD_NAME = 'Epic Link';
|
|
22
|
+
JiraCommon.EPIC_TYPE_NAME = 'Epic';
|
|
23
|
+
JiraCommon.SPRINT_FIELD_NAME = 'Sprint';
|
|
24
|
+
JiraCommon.DEFAULT_ADDITIONAL_FIELDS_ARRAY_LIMIT = 50;
|
|
25
|
+
JiraCommon.DEFAULT_TRUNCATE_LIMIT = 10000;
|
|
26
|
+
exports.JiraStatusCategories = new Map(['Todo', 'InProgress', 'Done'].map((s) => [JiraCommon.normalize(s), s]));
|
|
27
|
+
class JiraConverter extends converter_1.Converter {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.source = 'Jira';
|
|
31
|
+
}
|
|
32
|
+
/** All Jira records should have id property */
|
|
33
|
+
id(record) {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
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;
|
|
36
|
+
}
|
|
37
|
+
jiraConfig(ctx) {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
return (_b = (_a = ctx.config.source_specific_configs) === null || _a === void 0 ? void 0 : _a.jira) !== null && _b !== void 0 ? _b : {};
|
|
40
|
+
}
|
|
41
|
+
additionalFieldsArrayLimit(ctx) {
|
|
42
|
+
var _a;
|
|
43
|
+
return ((_a = this.jiraConfig(ctx).additional_fields_array_limit) !== null && _a !== void 0 ? _a : JiraCommon.DEFAULT_ADDITIONAL_FIELDS_ARRAY_LIMIT);
|
|
44
|
+
}
|
|
45
|
+
excludeFields(ctx) {
|
|
46
|
+
var _a;
|
|
47
|
+
return new Set((_a = this.jiraConfig(ctx).exclude_fields) !== null && _a !== void 0 ? _a : []);
|
|
48
|
+
}
|
|
49
|
+
truncateLimit(ctx) {
|
|
50
|
+
var _a;
|
|
51
|
+
return ((_a = this.jiraConfig(ctx).truncate_limit) !== null && _a !== void 0 ? _a : JiraCommon.DEFAULT_TRUNCATE_LIMIT);
|
|
52
|
+
}
|
|
53
|
+
truncate(ctx, str) {
|
|
54
|
+
if ((0, lodash_1.isString)(str) && str.length > this.truncateLimit(ctx)) {
|
|
55
|
+
return str.substring(0, this.truncateLimit(ctx));
|
|
56
|
+
}
|
|
57
|
+
return str;
|
|
58
|
+
}
|
|
59
|
+
useBoardOwnership(ctx) {
|
|
60
|
+
var _a;
|
|
61
|
+
return (_a = this.jiraConfig(ctx).use_board_ownership) !== null && _a !== void 0 ? _a : false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.JiraConverter = JiraConverter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { JiraConverter } from './common';
|
|
4
|
+
export declare class Epics extends JiraConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
private turndown;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|