airbyte-faros-destination 0.1.66 → 0.1.69
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/lib/converters/azureactivedirectory/users.js +1 -1
- package/lib/converters/buildkite/builds.d.ts +7 -0
- package/lib/converters/buildkite/builds.js +87 -0
- package/lib/converters/buildkite/common.d.ts +129 -0
- package/lib/converters/buildkite/common.js +161 -0
- package/lib/converters/buildkite/organizations.d.ts +7 -0
- package/lib/converters/buildkite/organizations.js +29 -0
- package/lib/converters/buildkite/pipelines.d.ts +7 -0
- package/lib/converters/buildkite/pipelines.js +32 -0
- package/lib/converters/opsgenie/common.d.ts +20 -0
- package/lib/converters/opsgenie/common.js +30 -0
- package/lib/converters/opsgenie/incidents.d.ts +10 -0
- package/lib/converters/opsgenie/incidents.js +166 -0
- package/lib/converters/opsgenie/models.d.ts +122 -0
- package/lib/converters/opsgenie/models.js +39 -0
- package/lib/converters/opsgenie/teams.d.ts +7 -0
- package/lib/converters/opsgenie/teams.js +26 -0
- package/lib/converters/opsgenie/users.d.ts +7 -0
- package/lib/converters/opsgenie/users.js +38 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/resources/spec.json +44 -14
|
@@ -70,7 +70,7 @@ class Users extends common_1.AzureActiveDirectoryConverter {
|
|
|
70
70
|
title: user.displayName,
|
|
71
71
|
level: 0,
|
|
72
72
|
joinedAt,
|
|
73
|
-
department: { uid: user.department },
|
|
73
|
+
department: user.department ? { uid: user.department } : null,
|
|
74
74
|
identity: { uid, source },
|
|
75
75
|
manager,
|
|
76
76
|
location,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { BuildkiteConverter } from './common';
|
|
4
|
+
export declare class Builds extends BuildkiteConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
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 lodash_1 = require("lodash");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
class Builds extends common_1.BuildkiteConverter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.destinationModels = [
|
|
11
|
+
'cicd_Build',
|
|
12
|
+
'cicd_BuildCommitAssociation',
|
|
13
|
+
'cicd_BuildStep',
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
async convert(record, ctx) {
|
|
17
|
+
var _a;
|
|
18
|
+
const source = this.streamName.source;
|
|
19
|
+
const build = record.record.data;
|
|
20
|
+
if (!build.pipeline)
|
|
21
|
+
return [];
|
|
22
|
+
const pipeline = {
|
|
23
|
+
uid: build.pipeline.slug,
|
|
24
|
+
organization: { uid: build.pipeline.organization.slug, source },
|
|
25
|
+
};
|
|
26
|
+
const createdAt = faros_feeds_sdk_1.Utils.toDate(build.createdAt);
|
|
27
|
+
const startedAt = faros_feeds_sdk_1.Utils.toDate(build.startedAt);
|
|
28
|
+
const endedAt = faros_feeds_sdk_1.Utils.toDate(build.finishedAt);
|
|
29
|
+
const status = this.convertBuildState(build.state);
|
|
30
|
+
const res = [];
|
|
31
|
+
const buildKey = {
|
|
32
|
+
uid: build.uuid,
|
|
33
|
+
pipeline,
|
|
34
|
+
};
|
|
35
|
+
res.push({
|
|
36
|
+
model: 'cicd_Build',
|
|
37
|
+
record: {
|
|
38
|
+
uid: build.uuid,
|
|
39
|
+
name: build.message,
|
|
40
|
+
number: build.number,
|
|
41
|
+
createdAt,
|
|
42
|
+
startedAt,
|
|
43
|
+
endedAt,
|
|
44
|
+
status,
|
|
45
|
+
url: build.url,
|
|
46
|
+
pipeline,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
for (const job of build.jobs) {
|
|
50
|
+
res.push({
|
|
51
|
+
model: 'cicd_BuildStep',
|
|
52
|
+
record: {
|
|
53
|
+
uid: job.uuid,
|
|
54
|
+
name: job.label,
|
|
55
|
+
...this.convertBuildStepTime(job),
|
|
56
|
+
command: job.command,
|
|
57
|
+
type: this.convertBuildStepType(job.type),
|
|
58
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(job.createdAt),
|
|
59
|
+
startedAt: faros_feeds_sdk_1.Utils.toDate(job.startedAt),
|
|
60
|
+
endedAt: faros_feeds_sdk_1.Utils.toDate(job.finishedAt),
|
|
61
|
+
status: this.convertBuildStepState(job.state),
|
|
62
|
+
url: job.url,
|
|
63
|
+
build: buildKey,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const repo = (_a = build.pipeline) === null || _a === void 0 ? void 0 : _a.repository;
|
|
68
|
+
if (repo) {
|
|
69
|
+
const repoExtract = this.extractRepo(repo.url);
|
|
70
|
+
if (repoExtract) {
|
|
71
|
+
const repoKey = {
|
|
72
|
+
organization: { uid: (0, lodash_1.toLower)(repoExtract.org), source },
|
|
73
|
+
name: (0, lodash_1.toLower)(repoExtract.name),
|
|
74
|
+
};
|
|
75
|
+
res.push({
|
|
76
|
+
model: 'cicd_BuildCommitAssociation',
|
|
77
|
+
record: {
|
|
78
|
+
build: buildKey,
|
|
79
|
+
commit: { repository: repoKey, sha: build.commit },
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return res;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.Builds = Builds;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Converter } from '../converter';
|
|
3
|
+
export interface Organization {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly slug: string;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly web_url: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Build {
|
|
10
|
+
readonly uuid: string;
|
|
11
|
+
readonly number: number;
|
|
12
|
+
readonly message: string;
|
|
13
|
+
readonly createdAt?: string;
|
|
14
|
+
readonly startedAt?: string;
|
|
15
|
+
readonly finishedAt?: string;
|
|
16
|
+
readonly state: string;
|
|
17
|
+
readonly url: string;
|
|
18
|
+
readonly commit: string;
|
|
19
|
+
readonly jobs: Array<Job>;
|
|
20
|
+
readonly pipeline?: {
|
|
21
|
+
slug?: string;
|
|
22
|
+
readonly repository?: Repo;
|
|
23
|
+
readonly organization?: {
|
|
24
|
+
slug?: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface Job {
|
|
29
|
+
readonly type: string;
|
|
30
|
+
readonly uuid: string;
|
|
31
|
+
readonly label?: string;
|
|
32
|
+
readonly state: string;
|
|
33
|
+
readonly createdAt?: string;
|
|
34
|
+
readonly startedAt?: string;
|
|
35
|
+
readonly finishedAt?: string;
|
|
36
|
+
readonly triggered?: {
|
|
37
|
+
startedAt?: string;
|
|
38
|
+
createdAt?: string;
|
|
39
|
+
finishedAt?: string;
|
|
40
|
+
};
|
|
41
|
+
readonly unblockedAt?: string;
|
|
42
|
+
readonly url?: string;
|
|
43
|
+
readonly command: string;
|
|
44
|
+
readonly build?: {
|
|
45
|
+
uuid?: string;
|
|
46
|
+
readonly pipeline?: {
|
|
47
|
+
slug?: string;
|
|
48
|
+
readonly organization?: {
|
|
49
|
+
slug?: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface Timestamps {
|
|
55
|
+
createdAt?: Date;
|
|
56
|
+
startedAt?: Date;
|
|
57
|
+
endedAt?: Date;
|
|
58
|
+
}
|
|
59
|
+
export interface JobState {
|
|
60
|
+
category: string;
|
|
61
|
+
detail: string;
|
|
62
|
+
}
|
|
63
|
+
export interface Pipeline {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly uuid: string;
|
|
66
|
+
readonly slug: string;
|
|
67
|
+
readonly name: string;
|
|
68
|
+
readonly url: string;
|
|
69
|
+
readonly description?: string;
|
|
70
|
+
readonly repository?: Repo;
|
|
71
|
+
readonly createdAt?: string;
|
|
72
|
+
readonly organization?: {
|
|
73
|
+
slug?: string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export declare enum RepoSource {
|
|
77
|
+
BITBUCKET = "Bitbucket",
|
|
78
|
+
GITHUB = "GitHub",
|
|
79
|
+
GITLAB = "GitLab",
|
|
80
|
+
VCS = "VCS"
|
|
81
|
+
}
|
|
82
|
+
export declare enum BuildStateCategory {
|
|
83
|
+
Unknown = "Unknown",
|
|
84
|
+
Canceled = "Canceled",
|
|
85
|
+
Failed = "Failed",
|
|
86
|
+
Success = "Success",
|
|
87
|
+
Running = "Running",
|
|
88
|
+
Queued = "Queued",
|
|
89
|
+
Custom = "Custom"
|
|
90
|
+
}
|
|
91
|
+
export declare enum JobType {
|
|
92
|
+
JobTypeBlock = "JobTypeBlock",
|
|
93
|
+
JobTypeTrigger = "JobTypeTrigger",
|
|
94
|
+
JobTypeWait = "JobTypeWait",
|
|
95
|
+
JobTypeCommand = "JobTypeCommand"
|
|
96
|
+
}
|
|
97
|
+
export declare enum JobCategory {
|
|
98
|
+
Custom = "Custom",
|
|
99
|
+
Script = "Script",
|
|
100
|
+
Manual = "Manual"
|
|
101
|
+
}
|
|
102
|
+
export interface Repo {
|
|
103
|
+
readonly provider: Provider;
|
|
104
|
+
readonly url: string;
|
|
105
|
+
}
|
|
106
|
+
export interface RepoExtract {
|
|
107
|
+
readonly org: string;
|
|
108
|
+
readonly name: string;
|
|
109
|
+
}
|
|
110
|
+
export interface Provider {
|
|
111
|
+
readonly name: RepoSource;
|
|
112
|
+
}
|
|
113
|
+
/** Buildkite converter base */
|
|
114
|
+
export declare abstract class BuildkiteConverter extends Converter {
|
|
115
|
+
source: string;
|
|
116
|
+
/** Almost every Buildkite record have id property */
|
|
117
|
+
id(record: AirbyteRecord): any;
|
|
118
|
+
convertBuildState(state: string | undefined): {
|
|
119
|
+
category: string;
|
|
120
|
+
detail: string;
|
|
121
|
+
};
|
|
122
|
+
extractRepo(repoUrl: string): RepoExtract | undefined;
|
|
123
|
+
convertBuildStepTime(buildStep: Job): Timestamps;
|
|
124
|
+
convertBuildStepState(state: string | undefined): {
|
|
125
|
+
category: string;
|
|
126
|
+
detail: string;
|
|
127
|
+
};
|
|
128
|
+
convertBuildStepType(type: string): JobState;
|
|
129
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BuildkiteConverter = exports.JobCategory = exports.JobType = exports.BuildStateCategory = exports.RepoSource = void 0;
|
|
7
|
+
const faros_feeds_sdk_1 = require("faros-feeds-sdk");
|
|
8
|
+
const git_url_parse_1 = __importDefault(require("git-url-parse"));
|
|
9
|
+
const converter_1 = require("../converter");
|
|
10
|
+
var RepoSource;
|
|
11
|
+
(function (RepoSource) {
|
|
12
|
+
RepoSource["BITBUCKET"] = "Bitbucket";
|
|
13
|
+
RepoSource["GITHUB"] = "GitHub";
|
|
14
|
+
RepoSource["GITLAB"] = "GitLab";
|
|
15
|
+
RepoSource["VCS"] = "VCS";
|
|
16
|
+
})(RepoSource = exports.RepoSource || (exports.RepoSource = {}));
|
|
17
|
+
var BuildStateCategory;
|
|
18
|
+
(function (BuildStateCategory) {
|
|
19
|
+
BuildStateCategory["Unknown"] = "Unknown";
|
|
20
|
+
BuildStateCategory["Canceled"] = "Canceled";
|
|
21
|
+
BuildStateCategory["Failed"] = "Failed";
|
|
22
|
+
BuildStateCategory["Success"] = "Success";
|
|
23
|
+
BuildStateCategory["Running"] = "Running";
|
|
24
|
+
BuildStateCategory["Queued"] = "Queued";
|
|
25
|
+
BuildStateCategory["Custom"] = "Custom";
|
|
26
|
+
})(BuildStateCategory = exports.BuildStateCategory || (exports.BuildStateCategory = {}));
|
|
27
|
+
var JobType;
|
|
28
|
+
(function (JobType) {
|
|
29
|
+
JobType["JobTypeBlock"] = "JobTypeBlock";
|
|
30
|
+
JobType["JobTypeTrigger"] = "JobTypeTrigger";
|
|
31
|
+
JobType["JobTypeWait"] = "JobTypeWait";
|
|
32
|
+
JobType["JobTypeCommand"] = "JobTypeCommand";
|
|
33
|
+
})(JobType = exports.JobType || (exports.JobType = {}));
|
|
34
|
+
var JobCategory;
|
|
35
|
+
(function (JobCategory) {
|
|
36
|
+
JobCategory["Custom"] = "Custom";
|
|
37
|
+
JobCategory["Script"] = "Script";
|
|
38
|
+
JobCategory["Manual"] = "Manual";
|
|
39
|
+
})(JobCategory = exports.JobCategory || (exports.JobCategory = {}));
|
|
40
|
+
/** Buildkite converter base */
|
|
41
|
+
class BuildkiteConverter extends converter_1.Converter {
|
|
42
|
+
constructor() {
|
|
43
|
+
super(...arguments);
|
|
44
|
+
this.source = 'Buildkite';
|
|
45
|
+
}
|
|
46
|
+
/** Almost every Buildkite record have id property */
|
|
47
|
+
id(record) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
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;
|
|
50
|
+
}
|
|
51
|
+
convertBuildState(state) {
|
|
52
|
+
if (!state) {
|
|
53
|
+
return { category: BuildStateCategory.Unknown, detail: 'undefined' };
|
|
54
|
+
}
|
|
55
|
+
const detail = state.toLowerCase();
|
|
56
|
+
// Read more on Buildkite build states:
|
|
57
|
+
// https://buildkite.com/user/graphql/documentation/type/BuildStates
|
|
58
|
+
switch (detail) {
|
|
59
|
+
case 'canceling':
|
|
60
|
+
case 'canceled':
|
|
61
|
+
return { category: BuildStateCategory.Canceled, detail };
|
|
62
|
+
case 'failed':
|
|
63
|
+
return { category: BuildStateCategory.Failed, detail };
|
|
64
|
+
case 'passed':
|
|
65
|
+
return { category: BuildStateCategory.Success, detail };
|
|
66
|
+
case 'running':
|
|
67
|
+
return { category: BuildStateCategory.Running, detail };
|
|
68
|
+
case 'scheduled':
|
|
69
|
+
case 'blocked':
|
|
70
|
+
return { category: BuildStateCategory.Queued, detail };
|
|
71
|
+
case 'skipped':
|
|
72
|
+
case 'not_run':
|
|
73
|
+
default:
|
|
74
|
+
return { category: BuildStateCategory.Custom, detail };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
extractRepo(repoUrl) {
|
|
78
|
+
const gitUrl = (0, git_url_parse_1.default)(repoUrl);
|
|
79
|
+
if (!gitUrl.organization || !gitUrl.name)
|
|
80
|
+
return undefined;
|
|
81
|
+
return { org: gitUrl.organization, name: gitUrl.name };
|
|
82
|
+
}
|
|
83
|
+
convertBuildStepTime(buildStep) {
|
|
84
|
+
const type = buildStep.type;
|
|
85
|
+
const result = {
|
|
86
|
+
createdAt: faros_feeds_sdk_1.Utils.toDate(buildStep.createdAt),
|
|
87
|
+
startedAt: faros_feeds_sdk_1.Utils.toDate(buildStep.startedAt),
|
|
88
|
+
endedAt: faros_feeds_sdk_1.Utils.toDate(buildStep.finishedAt),
|
|
89
|
+
};
|
|
90
|
+
switch (type) {
|
|
91
|
+
case JobType.JobTypeBlock:
|
|
92
|
+
result.createdAt = faros_feeds_sdk_1.Utils.toDate(buildStep.unblockedAt);
|
|
93
|
+
result.startedAt = faros_feeds_sdk_1.Utils.toDate(buildStep.unblockedAt);
|
|
94
|
+
result.endedAt = faros_feeds_sdk_1.Utils.toDate(buildStep.unblockedAt);
|
|
95
|
+
break;
|
|
96
|
+
case JobType.JobTypeTrigger:
|
|
97
|
+
result.createdAt = faros_feeds_sdk_1.Utils.toDate(buildStep.createdAt);
|
|
98
|
+
result.startedAt = faros_feeds_sdk_1.Utils.toDate(buildStep.startedAt);
|
|
99
|
+
result.endedAt = faros_feeds_sdk_1.Utils.toDate(buildStep.finishedAt);
|
|
100
|
+
break;
|
|
101
|
+
case JobType.JobTypeWait: // This type does not currently have timestamps
|
|
102
|
+
case JobType.JobTypeCommand:
|
|
103
|
+
default:
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
convertBuildStepState(state) {
|
|
109
|
+
if (!state) {
|
|
110
|
+
return { category: BuildStateCategory.Unknown, detail: 'undefined' };
|
|
111
|
+
}
|
|
112
|
+
const detail = state.toLowerCase();
|
|
113
|
+
// Read more on Buildkite job states:
|
|
114
|
+
// https://buildkite.com/user/graphql/documentation/type/JobStates
|
|
115
|
+
switch (detail) {
|
|
116
|
+
case 'canceling':
|
|
117
|
+
case 'canceled':
|
|
118
|
+
return { category: BuildStateCategory.Canceled, detail };
|
|
119
|
+
case 'blocked_failed':
|
|
120
|
+
case 'broken':
|
|
121
|
+
case 'timed_out':
|
|
122
|
+
case 'timing_out':
|
|
123
|
+
case 'unblocked_failed':
|
|
124
|
+
case 'waiting_failed':
|
|
125
|
+
return { category: BuildStateCategory.Failed, detail };
|
|
126
|
+
case 'finished':
|
|
127
|
+
return { category: BuildStateCategory.Success, detail };
|
|
128
|
+
case 'running':
|
|
129
|
+
return { category: BuildStateCategory.Running, detail };
|
|
130
|
+
case 'scheduled':
|
|
131
|
+
case 'accepted':
|
|
132
|
+
case 'assigned':
|
|
133
|
+
case 'blocked':
|
|
134
|
+
case 'limited':
|
|
135
|
+
case 'limiting':
|
|
136
|
+
case 'waiting':
|
|
137
|
+
return { category: BuildStateCategory.Queued, detail };
|
|
138
|
+
case 'skipped':
|
|
139
|
+
case 'pending':
|
|
140
|
+
case 'unblocked':
|
|
141
|
+
default:
|
|
142
|
+
return { category: BuildStateCategory.Custom, detail };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
convertBuildStepType(type) {
|
|
146
|
+
if (!type) {
|
|
147
|
+
return { category: JobCategory.Custom, detail: 'undefined' };
|
|
148
|
+
}
|
|
149
|
+
const detail = type;
|
|
150
|
+
switch (type) {
|
|
151
|
+
case JobType.JobTypeCommand:
|
|
152
|
+
return { category: JobCategory.Script, detail };
|
|
153
|
+
case JobType.JobTypeBlock:
|
|
154
|
+
return { category: JobCategory.Manual, detail };
|
|
155
|
+
case JobType.JobTypeWait:
|
|
156
|
+
default:
|
|
157
|
+
return { category: JobCategory.Custom, detail };
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
exports.BuildkiteConverter = BuildkiteConverter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { BuildkiteConverter } from './common';
|
|
4
|
+
export declare class Organizations extends BuildkiteConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Organizations = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Organizations extends common_1.BuildkiteConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'cicd_Organization',
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
async convert(record, ctx) {
|
|
13
|
+
const source = this.streamName.source;
|
|
14
|
+
const organization = record.record.data;
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
model: 'cicd_Organization',
|
|
18
|
+
record: {
|
|
19
|
+
uid: organization.id,
|
|
20
|
+
name: organization.name,
|
|
21
|
+
slug: organization.slug,
|
|
22
|
+
url: organization.web_url,
|
|
23
|
+
source,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Organizations = Organizations;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { BuildkiteConverter } from './common';
|
|
4
|
+
export declare class Pipelines extends BuildkiteConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pipelines = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Pipelines extends common_1.BuildkiteConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'cicd_Pipeline',
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
async convert(record, ctx) {
|
|
13
|
+
var _a;
|
|
14
|
+
const source = this.streamName.source;
|
|
15
|
+
const pipeline = record.record.data;
|
|
16
|
+
if (!pipeline.organization)
|
|
17
|
+
return [];
|
|
18
|
+
const organization = { uid: (_a = pipeline.organization) === null || _a === void 0 ? void 0 : _a.slug, source };
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
model: 'cicd_Pipeline',
|
|
22
|
+
record: {
|
|
23
|
+
uid: pipeline.slug,
|
|
24
|
+
name: pipeline.name,
|
|
25
|
+
url: pipeline.url,
|
|
26
|
+
organization,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.Pipelines = Pipelines;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Converter, StreamContext } from '../converter';
|
|
3
|
+
declare type ApplicationMapping = Record<string, {
|
|
4
|
+
name: string;
|
|
5
|
+
platform?: string;
|
|
6
|
+
}>;
|
|
7
|
+
interface OpsGenieConfig {
|
|
8
|
+
application_mapping?: ApplicationMapping;
|
|
9
|
+
max_description_length?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Opsgenie converter base */
|
|
12
|
+
export declare abstract class OpsGenieConverter extends Converter {
|
|
13
|
+
source: string;
|
|
14
|
+
/** Almost every Opsgenie record have id property */
|
|
15
|
+
id(record: AirbyteRecord): any;
|
|
16
|
+
protected opsgenieConfig(ctx: StreamContext): OpsGenieConfig;
|
|
17
|
+
protected maxDescriptionLength(ctx: StreamContext): number;
|
|
18
|
+
protected applicationMapping(ctx: StreamContext): ApplicationMapping;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpsGenieConverter = void 0;
|
|
4
|
+
const converter_1 = require("../converter");
|
|
5
|
+
const MAX_DESCRIPTION_LENGTH = 1000;
|
|
6
|
+
/** Opsgenie converter base */
|
|
7
|
+
class OpsGenieConverter extends converter_1.Converter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.source = 'OpsGenie';
|
|
11
|
+
}
|
|
12
|
+
/** Almost every Opsgenie record have id property */
|
|
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.id;
|
|
16
|
+
}
|
|
17
|
+
opsgenieConfig(ctx) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
return (_b = (_a = ctx.config.source_specific_configs) === null || _a === void 0 ? void 0 : _a.opsgenie) !== null && _b !== void 0 ? _b : {};
|
|
20
|
+
}
|
|
21
|
+
maxDescriptionLength(ctx) {
|
|
22
|
+
var _a;
|
|
23
|
+
return ((_a = this.opsgenieConfig(ctx).max_description_length) !== null && _a !== void 0 ? _a : MAX_DESCRIPTION_LENGTH);
|
|
24
|
+
}
|
|
25
|
+
applicationMapping(ctx) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return ((_b = (0, converter_1.parseObjectConfig)((_a = this.opsgenieConfig(ctx)) === null || _a === void 0 ? void 0 : _a.application_mapping, 'Application Mapping')) !== null && _b !== void 0 ? _b : {});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.OpsGenieConverter = OpsGenieConverter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { OpsGenieConverter } from './common';
|
|
4
|
+
export declare class Incidents extends OpsGenieConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
private seenTags;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
private getPriority;
|
|
9
|
+
private getIncidentStatus;
|
|
10
|
+
}
|