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,87 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Converter, StreamContext } from '../converter';
|
|
3
|
+
export declare const ARTIFACT_TYPE = "Docker";
|
|
4
|
+
interface DockerConfig {
|
|
5
|
+
label_prefix?: string;
|
|
6
|
+
skip_tags?: string[];
|
|
7
|
+
organization?: string;
|
|
8
|
+
}
|
|
9
|
+
interface LayerConfig {
|
|
10
|
+
mediaType: string;
|
|
11
|
+
size: number;
|
|
12
|
+
digest: string;
|
|
13
|
+
}
|
|
14
|
+
interface ImageManifest {
|
|
15
|
+
schemaVersion: number;
|
|
16
|
+
mediaType: string;
|
|
17
|
+
config: LayerConfig;
|
|
18
|
+
layers: LayerConfig[];
|
|
19
|
+
/**
|
|
20
|
+
* Optional for backwards compatibility. This field is not directly returned by the container registry,
|
|
21
|
+
* it is appended before returning the ImageManifest.
|
|
22
|
+
* It is only applicable to multi-platform images.
|
|
23
|
+
*/
|
|
24
|
+
indexDigest?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional for backwards compatibility. This field is not directly returned by the container registry,
|
|
27
|
+
* it is appended before returning the ImageManifest.
|
|
28
|
+
*/
|
|
29
|
+
manifestDigest?: string;
|
|
30
|
+
}
|
|
31
|
+
interface ImageConfigContainer {
|
|
32
|
+
Labels: Record<string, string>;
|
|
33
|
+
}
|
|
34
|
+
interface ImageConfig {
|
|
35
|
+
config: ImageConfigContainer;
|
|
36
|
+
created: string;
|
|
37
|
+
}
|
|
38
|
+
export interface Tag {
|
|
39
|
+
name: string;
|
|
40
|
+
projectName: string;
|
|
41
|
+
imageConfig?: ImageConfig;
|
|
42
|
+
imageManifest?: ImageManifest;
|
|
43
|
+
}
|
|
44
|
+
export interface OrganizationKey {
|
|
45
|
+
readonly uid: string;
|
|
46
|
+
readonly source: string;
|
|
47
|
+
}
|
|
48
|
+
interface PipelineKey {
|
|
49
|
+
readonly uid: string;
|
|
50
|
+
readonly organization: OrganizationKey;
|
|
51
|
+
}
|
|
52
|
+
interface BuildKey {
|
|
53
|
+
readonly uid: string;
|
|
54
|
+
readonly pipeline: PipelineKey;
|
|
55
|
+
}
|
|
56
|
+
export interface RepositoryKey {
|
|
57
|
+
readonly uid: string;
|
|
58
|
+
readonly organization: OrganizationKey;
|
|
59
|
+
}
|
|
60
|
+
interface VCSRepositoryKey {
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly organization: OrganizationKey;
|
|
63
|
+
}
|
|
64
|
+
interface CommitKey {
|
|
65
|
+
readonly sha: string;
|
|
66
|
+
readonly repository: VCSRepositoryKey;
|
|
67
|
+
}
|
|
68
|
+
export interface CICDTag {
|
|
69
|
+
name: string;
|
|
70
|
+
value: string;
|
|
71
|
+
}
|
|
72
|
+
export declare class DockerCommon {
|
|
73
|
+
static ALLOWED_MANIFEST_SCHEMA_VERSION: number;
|
|
74
|
+
static getBuildKey(tags: CICDTag[], prefix: string): BuildKey | undefined;
|
|
75
|
+
static getCommitKey(tags: CICDTag[], prefix: string): CommitKey | undefined;
|
|
76
|
+
}
|
|
77
|
+
/** Docker converter base */
|
|
78
|
+
export declare abstract class DockerConverter extends Converter {
|
|
79
|
+
source: string;
|
|
80
|
+
/** Every Docker record have id property */
|
|
81
|
+
id(record: AirbyteRecord): any;
|
|
82
|
+
protected dockerConfig(ctx: StreamContext): DockerConfig;
|
|
83
|
+
protected labelPrefix(ctx: StreamContext): string;
|
|
84
|
+
protected skipTags(ctx: StreamContext): string[];
|
|
85
|
+
protected organization(ctx: StreamContext): string | undefined;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DockerConverter = exports.DockerCommon = exports.ARTIFACT_TYPE = void 0;
|
|
4
|
+
const converter_1 = require("../converter");
|
|
5
|
+
exports.ARTIFACT_TYPE = 'Docker';
|
|
6
|
+
const DEFAULT_LABEL_PREFIX = 'faros-';
|
|
7
|
+
class DockerCommon {
|
|
8
|
+
static getBuildKey(tags, prefix) {
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
const buildId = tags.find(({ name }) => name === `${prefix}build-id`);
|
|
11
|
+
const ciPipeline = (_a = tags.find(({ name }) => name === `${prefix}ci-pipeline`)) !== null && _a !== void 0 ? _a : tags.find(({ name }) => name === `${prefix}pipeline-id`);
|
|
12
|
+
const ciOrg = (_b = tags.find(({ name }) => name === `${prefix}ci-org`)) !== null && _b !== void 0 ? _b : tags.find(({ name }) => name === `${prefix}org-id`);
|
|
13
|
+
const ciSource = (_c = tags.find(({ name }) => name === `${prefix}ci-source`)) !== null && _c !== void 0 ? _c : tags.find(({ name }) => name === `${prefix}org-source`);
|
|
14
|
+
if (buildId && ciPipeline && ciOrg && ciSource) {
|
|
15
|
+
return {
|
|
16
|
+
uid: buildId.value,
|
|
17
|
+
pipeline: {
|
|
18
|
+
uid: ciPipeline.value,
|
|
19
|
+
organization: {
|
|
20
|
+
uid: ciOrg.value,
|
|
21
|
+
source: ciSource.value,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
static getCommitKey(tags, prefix) {
|
|
29
|
+
const commitSha = tags.find(({ name }) => name === `${prefix}commit-sha`);
|
|
30
|
+
const vcsRepo = tags.find(({ name }) => name === `${prefix}vcs-repo`);
|
|
31
|
+
const vcsOrg = tags.find(({ name }) => name === `${prefix}vcs-org`);
|
|
32
|
+
const vcsSource = tags.find(({ name }) => name === `${prefix}vcs-source`);
|
|
33
|
+
if (commitSha && vcsRepo && vcsOrg && vcsSource) {
|
|
34
|
+
return {
|
|
35
|
+
sha: commitSha.value,
|
|
36
|
+
repository: {
|
|
37
|
+
name: vcsRepo.value,
|
|
38
|
+
organization: {
|
|
39
|
+
uid: vcsOrg.value,
|
|
40
|
+
source: vcsSource.value,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.DockerCommon = DockerCommon;
|
|
49
|
+
DockerCommon.ALLOWED_MANIFEST_SCHEMA_VERSION = 2;
|
|
50
|
+
/** Docker converter base */
|
|
51
|
+
class DockerConverter extends converter_1.Converter {
|
|
52
|
+
constructor() {
|
|
53
|
+
super(...arguments);
|
|
54
|
+
this.source = 'Docker';
|
|
55
|
+
}
|
|
56
|
+
/** Every Docker record have id property */
|
|
57
|
+
id(record) {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
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;
|
|
60
|
+
}
|
|
61
|
+
dockerConfig(ctx) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return (_b = (_a = ctx.config.source_specific_configs) === null || _a === void 0 ? void 0 : _a.docker) !== null && _b !== void 0 ? _b : {};
|
|
64
|
+
}
|
|
65
|
+
labelPrefix(ctx) {
|
|
66
|
+
return this.dockerConfig(ctx).label_prefix || DEFAULT_LABEL_PREFIX;
|
|
67
|
+
}
|
|
68
|
+
skipTags(ctx) {
|
|
69
|
+
var _a;
|
|
70
|
+
return (_a = this.dockerConfig(ctx).skip_tags) !== null && _a !== void 0 ? _a : [];
|
|
71
|
+
}
|
|
72
|
+
organization(ctx) {
|
|
73
|
+
return this.dockerConfig(ctx).organization;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.DockerConverter = DockerConverter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteLogger, AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { DockerConverter } from './common';
|
|
4
|
+
export declare class Tags extends DockerConverter {
|
|
5
|
+
readonly logger: AirbyteLogger;
|
|
6
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tags = 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
|
+
class Tags extends common_1.DockerConverter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.logger = new faros_airbyte_cdk_1.AirbyteLogger();
|
|
11
|
+
this.destinationModels = [
|
|
12
|
+
'cicd_Artifact',
|
|
13
|
+
'cicd_ArtifactCommitAssociation',
|
|
14
|
+
'cicd_Organization',
|
|
15
|
+
'cicd_Repository',
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
async convert(record, ctx) {
|
|
19
|
+
var _a;
|
|
20
|
+
const source = this.streamName.source;
|
|
21
|
+
const tag = record.record.data;
|
|
22
|
+
const res = [];
|
|
23
|
+
const org = this.organization(ctx);
|
|
24
|
+
if (!org) {
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
27
|
+
const organizationKey = {
|
|
28
|
+
uid: org.toLowerCase(),
|
|
29
|
+
source,
|
|
30
|
+
};
|
|
31
|
+
res.push({
|
|
32
|
+
model: 'cicd_Organization',
|
|
33
|
+
record: {
|
|
34
|
+
...organizationKey,
|
|
35
|
+
name: org,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const [repoName] = tag.projectName.toLowerCase().split('/').slice(-1);
|
|
39
|
+
const repositoryKey = {
|
|
40
|
+
uid: repoName.toLowerCase(),
|
|
41
|
+
organization: organizationKey,
|
|
42
|
+
};
|
|
43
|
+
res.push({
|
|
44
|
+
model: 'cicd_Repository',
|
|
45
|
+
record: {
|
|
46
|
+
...repositoryKey,
|
|
47
|
+
name: repoName,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
const cicdTags = [];
|
|
51
|
+
const imageInfo = `(${tag.projectName}:${tag.name})`;
|
|
52
|
+
if (((_a = tag.imageManifest) === null || _a === void 0 ? void 0 : _a.schemaVersion) !==
|
|
53
|
+
common_1.DockerCommon.ALLOWED_MANIFEST_SCHEMA_VERSION) {
|
|
54
|
+
this.logger.info(`Image schema version is not supported: ${tag.imageManifest.schemaVersion} != expected ${common_1.DockerCommon.ALLOWED_MANIFEST_SCHEMA_VERSION} ${imageInfo}`);
|
|
55
|
+
return res;
|
|
56
|
+
}
|
|
57
|
+
if (tag.imageConfig.config.Labels) {
|
|
58
|
+
Object.entries(tag.imageConfig.config.Labels).forEach(([name, value]) => {
|
|
59
|
+
cicdTags.push({ name, value });
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const skipTags = this.skipTags(ctx);
|
|
63
|
+
if (!skipTags || !skipTags.includes(tag.name)) {
|
|
64
|
+
const labelPrefix = this.labelPrefix(ctx);
|
|
65
|
+
const buildKey = common_1.DockerCommon.getBuildKey(cicdTags, labelPrefix);
|
|
66
|
+
const commitKey = common_1.DockerCommon.getCommitKey(cicdTags, labelPrefix);
|
|
67
|
+
res.push({
|
|
68
|
+
model: 'cicd_Artifact',
|
|
69
|
+
record: {
|
|
70
|
+
uid: tag.name,
|
|
71
|
+
name: tag.name,
|
|
72
|
+
type: common_1.ARTIFACT_TYPE,
|
|
73
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(tag.imageConfig.created),
|
|
74
|
+
build: buildKey,
|
|
75
|
+
tags: cicdTags,
|
|
76
|
+
repository: repositoryKey,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
if (commitKey) {
|
|
80
|
+
res.push({
|
|
81
|
+
model: 'cicd_ArtifactCommitAssociation',
|
|
82
|
+
record: {
|
|
83
|
+
artifact: {
|
|
84
|
+
uid: tag.name,
|
|
85
|
+
repository: repositoryKey,
|
|
86
|
+
},
|
|
87
|
+
commit: commitKey,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.logger.info(`Skipped artifact in repo ${repositoryKey.uid} (uid: ${tag.name})`);
|
|
94
|
+
}
|
|
95
|
+
return res;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.Tags = Tags;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Assignees extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Assignees = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Assignees extends common_1.GitHubConverter {
|
|
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 [common_1.GitHubCommon.tms_User(user, source)];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.Assignees = Assignees;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Branches extends GitHubConverter {
|
|
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.Branches = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Branches extends common_1.GitHubConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = ['vcs_Branch'];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
const source = this.streamName.source;
|
|
12
|
+
const branch = record.record.data;
|
|
13
|
+
const repository = common_1.GitHubCommon.parseRepositoryKey(branch.repository, source);
|
|
14
|
+
if (!repository)
|
|
15
|
+
return [];
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
model: 'vcs_Branch',
|
|
19
|
+
record: {
|
|
20
|
+
name: branch.name,
|
|
21
|
+
uid: branch.name,
|
|
22
|
+
repository,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Branches = Branches;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Collaborators extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Collaborators = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Collaborators extends common_1.GitHubConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'vcs_Membership',
|
|
10
|
+
'vcs_User',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
async convert(record, ctx) {
|
|
14
|
+
const source = this.streamName.source;
|
|
15
|
+
const user = record.record.data;
|
|
16
|
+
return common_1.GitHubCommon.vcs_User_with_Membership(user, source);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Collaborators = Collaborators;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class Commits extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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.GitHubConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [
|
|
10
|
+
'vcs_BranchCommitAssociation',
|
|
11
|
+
'vcs_Commit',
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
async convert(record, ctx) {
|
|
15
|
+
var _a;
|
|
16
|
+
const source = this.streamName.source;
|
|
17
|
+
const commit = record.record.data;
|
|
18
|
+
const res = [];
|
|
19
|
+
const repository = common_1.GitHubCommon.parseRepositoryKey(commit.repository, source);
|
|
20
|
+
if (!repository)
|
|
21
|
+
return res;
|
|
22
|
+
const author = commit.author ? { uid: commit.author.login, source } : null;
|
|
23
|
+
res.push({
|
|
24
|
+
model: 'vcs_Commit',
|
|
25
|
+
record: {
|
|
26
|
+
uid: commit.sha,
|
|
27
|
+
sha: commit.sha,
|
|
28
|
+
message: commit.commit.message,
|
|
29
|
+
author,
|
|
30
|
+
htmlUrl: commit.html_url,
|
|
31
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate((_a = commit.commit.author) === null || _a === void 0 ? void 0 : _a.date),
|
|
32
|
+
repository,
|
|
33
|
+
source,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
if (commit.branch) {
|
|
37
|
+
res.push({
|
|
38
|
+
model: 'vcs_BranchCommitAssociation',
|
|
39
|
+
record: {
|
|
40
|
+
commit: { sha: commit.sha, uid: commit.sha, repository },
|
|
41
|
+
branch: { name: commit.branch, uid: commit.branch, repository },
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return res;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.Commits = Commits;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Dictionary } from 'ts-essentials';
|
|
3
|
+
import { Converter, DestinationRecord } from '../converter';
|
|
4
|
+
/** Common functions shares across GitHub converters */
|
|
5
|
+
export declare class GitHubCommon {
|
|
6
|
+
static readonly MAX_DESCRIPTION_LENGTH = 1000;
|
|
7
|
+
static vcs_User_with_Membership(user: Dictionary<any>, source: string): DestinationRecord[];
|
|
8
|
+
static vcs_UserType(user: Dictionary<any>): {
|
|
9
|
+
category: string;
|
|
10
|
+
detail: string;
|
|
11
|
+
};
|
|
12
|
+
static vcs_User(user: Dictionary<any>, source: string): DestinationRecord;
|
|
13
|
+
static vcs_Membership(userUid: string, org: string, source: string): DestinationRecord;
|
|
14
|
+
static tms_User(user: Dictionary<any>, source: string): DestinationRecord;
|
|
15
|
+
static tms_ProjectBoard_with_TaskBoard(projectKey: ProjectKey, name: string, description: string | null, createdAt: string | null | undefined, updatedAt: string | null | undefined): DestinationRecord[];
|
|
16
|
+
static parseRepositoryKey(repository: string, source: string): undefined | RepositoryKey;
|
|
17
|
+
static parsePRnumber(pull_request_url: string): number;
|
|
18
|
+
}
|
|
19
|
+
/** Github converter base */
|
|
20
|
+
export declare abstract class GitHubConverter extends Converter {
|
|
21
|
+
source: string;
|
|
22
|
+
/** All Github records should have id property */
|
|
23
|
+
id(record: AirbyteRecord): any;
|
|
24
|
+
}
|
|
25
|
+
export interface RepositoryKey {
|
|
26
|
+
name: string;
|
|
27
|
+
uid: string;
|
|
28
|
+
organization: OrgKey;
|
|
29
|
+
}
|
|
30
|
+
export interface OrgKey {
|
|
31
|
+
uid: string;
|
|
32
|
+
source: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ProjectKey {
|
|
35
|
+
uid: string;
|
|
36
|
+
source: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitHubConverter = exports.GitHubCommon = 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 GitHub converters */
|
|
8
|
+
class GitHubCommon {
|
|
9
|
+
static vcs_User_with_Membership(user, source) {
|
|
10
|
+
const vcsUser = GitHubCommon.vcs_User(user, source);
|
|
11
|
+
const repository = GitHubCommon.parseRepositoryKey(user.repository, source);
|
|
12
|
+
if (!repository)
|
|
13
|
+
return [vcsUser];
|
|
14
|
+
const vcsMembership = GitHubCommon.vcs_Membership(vcsUser.record.uid, repository.organization.uid, repository.organization.source);
|
|
15
|
+
return [vcsUser, vcsMembership];
|
|
16
|
+
}
|
|
17
|
+
static vcs_UserType(user) {
|
|
18
|
+
if (!user.type) {
|
|
19
|
+
return { category: 'Custom', detail: 'unknown' };
|
|
20
|
+
}
|
|
21
|
+
const userTypeLower = user.type.toLowerCase();
|
|
22
|
+
switch (userTypeLower) {
|
|
23
|
+
case 'enterpriseuseraccount':
|
|
24
|
+
case 'user':
|
|
25
|
+
return { category: 'User', detail: userTypeLower };
|
|
26
|
+
case 'bot':
|
|
27
|
+
return { category: 'Bot', detail: userTypeLower };
|
|
28
|
+
case 'organization':
|
|
29
|
+
return { category: 'Organization', detail: userTypeLower };
|
|
30
|
+
case 'mannequin':
|
|
31
|
+
return { category: 'Mannequin', detail: userTypeLower };
|
|
32
|
+
default:
|
|
33
|
+
return { category: 'Custom', detail: userTypeLower };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
static vcs_User(user, source) {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
const type = GitHubCommon.vcs_UserType(user);
|
|
39
|
+
return {
|
|
40
|
+
model: 'vcs_User',
|
|
41
|
+
record: {
|
|
42
|
+
uid: user.login,
|
|
43
|
+
name: (_b = (_a = user.name) !== null && _a !== void 0 ? _a : user.login) !== null && _b !== void 0 ? _b : null,
|
|
44
|
+
htmlUrl: (_c = user.html_url) !== null && _c !== void 0 ? _c : null,
|
|
45
|
+
type,
|
|
46
|
+
source,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
static vcs_Membership(userUid, org, source) {
|
|
51
|
+
return {
|
|
52
|
+
model: 'vcs_Membership',
|
|
53
|
+
record: {
|
|
54
|
+
user: { uid: userUid, source },
|
|
55
|
+
organization: { uid: (0, lodash_1.toLower)(org), source },
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static tms_User(user, source) {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
return {
|
|
62
|
+
model: 'tms_User',
|
|
63
|
+
record: {
|
|
64
|
+
uid: user.login,
|
|
65
|
+
name: (_b = (_a = user.name) !== null && _a !== void 0 ? _a : user.login) !== null && _b !== void 0 ? _b : null,
|
|
66
|
+
source,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
static tms_ProjectBoard_with_TaskBoard(projectKey, name, description, createdAt, updatedAt) {
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
model: 'tms_Project',
|
|
74
|
+
record: {
|
|
75
|
+
...projectKey,
|
|
76
|
+
name: name,
|
|
77
|
+
description: description === null || description === void 0 ? void 0 : description.substring(0, GitHubCommon.MAX_DESCRIPTION_LENGTH),
|
|
78
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(createdAt),
|
|
79
|
+
updatedAt: faros_feeds_sdk_1.Utils.toDate(updatedAt),
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
model: 'tms_TaskBoard',
|
|
84
|
+
record: {
|
|
85
|
+
...projectKey,
|
|
86
|
+
name,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
model: 'tms_TaskBoardProjectRelationship',
|
|
91
|
+
record: {
|
|
92
|
+
board: projectKey,
|
|
93
|
+
project: projectKey,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
static parseRepositoryKey(repository, source) {
|
|
99
|
+
if (!repository)
|
|
100
|
+
return undefined;
|
|
101
|
+
const orgRepo = repository.split('/');
|
|
102
|
+
if (orgRepo.length != 2)
|
|
103
|
+
return undefined;
|
|
104
|
+
const [organization, repositoryName] = orgRepo;
|
|
105
|
+
return {
|
|
106
|
+
name: (0, lodash_1.toLower)(repositoryName),
|
|
107
|
+
uid: (0, lodash_1.toLower)(repositoryName),
|
|
108
|
+
organization: { uid: (0, lodash_1.toLower)(organization), source },
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
static parsePRnumber(pull_request_url) {
|
|
112
|
+
return faros_feeds_sdk_1.Utils.parseInteger(pull_request_url.substring(pull_request_url.lastIndexOf('/') + 1));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.GitHubCommon = GitHubCommon;
|
|
116
|
+
// Max length for free-form description text fields such as issue body
|
|
117
|
+
GitHubCommon.MAX_DESCRIPTION_LENGTH = 1000;
|
|
118
|
+
/** Github converter base */
|
|
119
|
+
class GitHubConverter extends converter_1.Converter {
|
|
120
|
+
constructor() {
|
|
121
|
+
super(...arguments);
|
|
122
|
+
this.source = 'GitHub';
|
|
123
|
+
}
|
|
124
|
+
/** All Github records should have id property */
|
|
125
|
+
id(record) {
|
|
126
|
+
var _a, _b;
|
|
127
|
+
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;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.GitHubConverter = GitHubConverter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class IssueLabels extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IssueLabels = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class IssueLabels extends common_1.GitHubConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = ['tms_Label'];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
const label = record.record.data;
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
model: 'tms_Label',
|
|
15
|
+
record: { name: label.name },
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.IssueLabels = IssueLabels;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { GitHubConverter } from './common';
|
|
4
|
+
export declare class IssueMilestones extends GitHubConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
private epicStatus;
|
|
8
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IssueMilestones = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class IssueMilestones extends common_1.GitHubConverter {
|
|
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.GitHubCommon.parseRepositoryKey(milestone.repository, source);
|
|
15
|
+
if (!repository)
|
|
16
|
+
return [];
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
model: 'tms_Epic',
|
|
20
|
+
record: {
|
|
21
|
+
uid: `${milestone.id}`,
|
|
22
|
+
name: milestone.title,
|
|
23
|
+
description: (_a = milestone.description) === null || _a === void 0 ? void 0 : _a.substring(0, common_1.GitHubCommon.MAX_DESCRIPTION_LENGTH),
|
|
24
|
+
project: { uid: repository.name, source },
|
|
25
|
+
status: this.epicStatus(milestone.state),
|
|
26
|
+
source,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
epicStatus(state) {
|
|
32
|
+
switch (state) {
|
|
33
|
+
case 'open':
|
|
34
|
+
return { category: 'InProgress', detail: state };
|
|
35
|
+
case 'closed':
|
|
36
|
+
return { category: 'Done', detail: state };
|
|
37
|
+
default:
|
|
38
|
+
return { category: 'Custom', detail: state };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.IssueMilestones = IssueMilestones;
|