airbyte-faros-destination 0.22.7 → 0.22.9
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/bitbucket/repositories.js +1 -1
- package/lib/converters/bitbucket/repositories.js.map +1 -1
- package/lib/converters/harness/common.d.ts +1 -96
- package/lib/converters/harness/common.js +1 -2
- package/lib/converters/harness/common.js.map +1 -1
- package/lib/converters/harness/executions.d.ts +4 -7
- package/lib/converters/harness/executions.js +79 -198
- package/lib/converters/harness/executions.js.map +1 -1
- package/lib/converters/harness/organizations.d.ts +7 -0
- package/lib/converters/harness/organizations.js +29 -0
- package/lib/converters/harness/organizations.js.map +1 -0
- package/lib/converters/harness/pipelines.d.ts +7 -0
- package/lib/converters/harness/pipelines.js +29 -0
- package/lib/converters/harness/pipelines.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -30,7 +30,7 @@ class Repositories extends common_1.BitbucketConverter {
|
|
|
30
30
|
createdAt: faros_js_client_1.Utils.toDate(repository.createdOn),
|
|
31
31
|
updatedAt: faros_js_client_1.Utils.toDate(repository.updatedOn),
|
|
32
32
|
mainBranch: repository.mainBranch,
|
|
33
|
-
organization: { uid: repository.workspace, source },
|
|
33
|
+
organization: { uid: (0, lodash_1.toLower)(repository.workspace), source },
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repositories.js","sourceRoot":"","sources":["../../../src/converters/bitbucket/repositories.ts"],"names":[],"mappings":";;;AAEA,qDAAsC;AACtC,mCAA+B;AAG/B,qCAA4C;AAE5C,MAAa,YAAa,SAAQ,2BAAkB;IAApD;;QACW,sBAAiB,GAAoC;YAC5D,gBAAgB;SACjB,CAAC;IAgCJ,CAAC;IA9BC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,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,MAAM,CAAC,IAAkB,CAAC;QACpD,OAAO;YACL;gBACE,KAAK,EAAE,gBAAgB;gBACvB,MAAM,EAAE;oBACN,2DAA2D;oBAC3D,GAAG,EAAE,IAAA,gBAAO,EAAC,UAAU,CAAC,IAAI,CAAC;oBAC7B,IAAI,EAAE,IAAA,gBAAO,EAAC,UAAU,CAAC,IAAI,CAAC;oBAC9B,QAAQ,EAAE,UAAU,CAAC,QAAQ;oBAC7B,WAAW,EAAE,uBAAK,CAAC,gBAAgB,CACjC,UAAU,CAAC,WAAW,EACtB,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAC/B;oBACD,OAAO,EAAE,UAAU,CAAC,SAAS;oBAC7B,QAAQ,EAAE,UAAU,CAAC,QAAQ;oBAC7B,IAAI,EAAE,UAAU,CAAC,IAAI;oBACrB,OAAO,EAAE,UAAU,CAAC,OAAO;oBAC3B,SAAS,EAAE,uBAAK,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;oBAC7C,SAAS,EAAE,uBAAK,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;oBAC7C,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,YAAY,EAAE,EAAC,GAAG,EAAE,IAAA,gBAAO,EAAC,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,EAAC;iBAC3D;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAnCD,oCAmCC"}
|
|
@@ -1,102 +1,7 @@
|
|
|
1
1
|
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
-
import { ComputeApplication } from '../common/common';
|
|
3
2
|
import { Converter } from '../converter';
|
|
4
|
-
|
|
5
|
-
uid: string;
|
|
6
|
-
source: string;
|
|
7
|
-
}
|
|
8
|
-
interface CICDPipeline {
|
|
9
|
-
uid: string;
|
|
10
|
-
organization: CICDOrganization;
|
|
11
|
-
}
|
|
12
|
-
export interface CICDBuild {
|
|
13
|
-
uid: string;
|
|
14
|
-
pipeline: CICDPipeline;
|
|
15
|
-
}
|
|
16
|
-
interface CICDRepository {
|
|
17
|
-
uid: string;
|
|
18
|
-
organization: CICDOrganization;
|
|
19
|
-
}
|
|
20
|
-
export interface CICDArtifact {
|
|
21
|
-
readonly uid: string;
|
|
22
|
-
readonly repository: CICDRepository;
|
|
23
|
-
}
|
|
24
|
-
export interface Execution {
|
|
25
|
-
uid: string;
|
|
26
|
-
application: ComputeApplication;
|
|
27
|
-
startedAt: number;
|
|
28
|
-
endedAt: number;
|
|
29
|
-
env: string;
|
|
30
|
-
status: string;
|
|
31
|
-
build: CICDBuild;
|
|
32
|
-
artifact: CICDArtifact;
|
|
33
|
-
}
|
|
34
|
-
export interface ExecutionImplementation {
|
|
35
|
-
application: ComputeApplication;
|
|
36
|
-
env: string;
|
|
37
|
-
build?: CICDBuild;
|
|
38
|
-
artifact?: CICDArtifact;
|
|
39
|
-
}
|
|
40
|
-
interface HarnessService {
|
|
41
|
-
id: string;
|
|
42
|
-
name?: string;
|
|
43
|
-
artifactType: string;
|
|
44
|
-
artifactSources: {
|
|
45
|
-
name: string;
|
|
46
|
-
}[];
|
|
47
|
-
}
|
|
48
|
-
interface HarnessEnvironment {
|
|
49
|
-
type: string;
|
|
50
|
-
name: string;
|
|
51
|
-
}
|
|
52
|
-
export interface HarnessExecutionNode {
|
|
53
|
-
id: string;
|
|
54
|
-
application: {
|
|
55
|
-
id: string;
|
|
56
|
-
name?: string;
|
|
57
|
-
services?: {
|
|
58
|
-
nodes: HarnessService[];
|
|
59
|
-
};
|
|
60
|
-
environments?: {
|
|
61
|
-
nodes: HarnessEnvironment[];
|
|
62
|
-
};
|
|
63
|
-
tags?: {
|
|
64
|
-
name: string;
|
|
65
|
-
value: string;
|
|
66
|
-
}[];
|
|
67
|
-
};
|
|
68
|
-
status: string;
|
|
69
|
-
createdAt: number;
|
|
70
|
-
startedAt: number;
|
|
71
|
-
endedAt: number;
|
|
72
|
-
artifacts?: {
|
|
73
|
-
id: string;
|
|
74
|
-
buildNo: string;
|
|
75
|
-
artifactSource: {
|
|
76
|
-
id: string;
|
|
77
|
-
name: string;
|
|
78
|
-
};
|
|
79
|
-
}[];
|
|
80
|
-
outcomes?: {
|
|
81
|
-
nodes: {
|
|
82
|
-
service: HarnessService;
|
|
83
|
-
environment: HarnessEnvironment;
|
|
84
|
-
}[];
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
export interface ExecutionWorkflow {
|
|
88
|
-
application: ComputeApplication;
|
|
89
|
-
env: string;
|
|
90
|
-
build: CICDBuild;
|
|
91
|
-
artifact: CICDArtifact;
|
|
92
|
-
}
|
|
93
|
-
export interface ExecutionPipeline {
|
|
94
|
-
application: ComputeApplication;
|
|
95
|
-
env: string;
|
|
96
|
-
}
|
|
97
|
-
/** Harness converter base */
|
|
3
|
+
export { CDModuleInfo, Organization, Pipeline, PipelineExecution, } from 'faros-airbyte-common/harness';
|
|
98
4
|
export declare abstract class HarnessConverter extends Converter {
|
|
99
5
|
source: string;
|
|
100
6
|
id(record: AirbyteRecord): any;
|
|
101
7
|
}
|
|
102
|
-
export {};
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HarnessConverter = void 0;
|
|
4
4
|
const converter_1 = require("../converter");
|
|
5
|
-
/** Harness converter base */
|
|
6
5
|
class HarnessConverter extends converter_1.Converter {
|
|
7
6
|
constructor() {
|
|
8
7
|
super(...arguments);
|
|
9
8
|
this.source = 'Harness';
|
|
10
9
|
}
|
|
11
10
|
id(record) {
|
|
12
|
-
return record?.record?.data?.
|
|
11
|
+
return (record?.record?.data?.identifier ?? record?.record?.data?.planExecutionId);
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
exports.HarnessConverter = HarnessConverter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/harness/common.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/harness/common.ts"],"names":[],"mappings":";;;AAEA,4CAAuC;AASvC,MAAsB,gBAAiB,SAAQ,qBAAS;IAAxD;;QACE,WAAM,GAAG,SAAS,CAAC;IAOrB,CAAC;IALC,EAAE,CAAC,MAAqB;QACtB,OAAO,CACL,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,CAC1E,CAAC;IACJ,CAAC;CACF;AARD,4CAQC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
-
import { DestinationModel, DestinationRecord
|
|
2
|
+
import { DestinationModel, DestinationRecord } from '../converter';
|
|
3
3
|
import { HarnessConverter } from './common';
|
|
4
4
|
export declare class Executions extends HarnessConverter {
|
|
5
5
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
6
|
private seenApplications;
|
|
7
|
-
convert(record: AirbyteRecord
|
|
8
|
-
private
|
|
9
|
-
private parseWorkflow;
|
|
10
|
-
private parsePipeline;
|
|
7
|
+
convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
private statusCategory;
|
|
11
9
|
private toBuildStatus;
|
|
12
|
-
private toEnvironmentStatus;
|
|
13
|
-
private toExecution;
|
|
14
10
|
private toDeploymentStatus;
|
|
11
|
+
private toEnvironment;
|
|
15
12
|
}
|
|
@@ -1,237 +1,118 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Executions = void 0;
|
|
4
|
+
const canonical_models_1 = require("@faros-ai/canonical-models");
|
|
4
5
|
const faros_js_client_1 = require("faros-js-client");
|
|
5
6
|
const common_1 = require("../common/common");
|
|
6
7
|
const common_2 = 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
8
|
class Executions extends common_2.HarnessConverter {
|
|
13
9
|
constructor() {
|
|
14
10
|
super(...arguments);
|
|
15
11
|
this.destinationModels = [
|
|
16
|
-
'cicd_ArtifactDeployment',
|
|
17
12
|
'cicd_Build',
|
|
18
13
|
'cicd_Deployment',
|
|
19
14
|
'compute_Application',
|
|
20
15
|
];
|
|
21
16
|
this.seenApplications = new Set();
|
|
22
17
|
}
|
|
23
|
-
async convert(record
|
|
24
|
-
const executionRaw = record.record.data;
|
|
18
|
+
async convert(record) {
|
|
25
19
|
const source = this.streamName.source;
|
|
20
|
+
const execution = record.record.data;
|
|
26
21
|
const res = [];
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
application = common_1.Common.computeApplication(execution.application?.name, execution.application?.platform);
|
|
31
|
-
const appKey = application.uid;
|
|
32
|
-
if (!this.seenApplications.has(appKey)) {
|
|
33
|
-
res.push({ model: 'compute_Application', record: application });
|
|
34
|
-
this.seenApplications.add(appKey);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const deploymentStatus = this.toDeploymentStatus(execution.status);
|
|
38
|
-
const buildStatus = this.toBuildStatus(execution.status);
|
|
39
|
-
const deployment = { uid: execution.uid, source };
|
|
40
|
-
res.push({
|
|
41
|
-
model: 'cicd_Deployment',
|
|
42
|
-
record: {
|
|
43
|
-
...deployment,
|
|
44
|
-
application,
|
|
45
|
-
build: execution.build,
|
|
46
|
-
startedAt: faros_js_client_1.Utils.toDate(execution.startedAt),
|
|
47
|
-
endedAt: faros_js_client_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_js_client_1.Utils.toDate(execution.startedAt),
|
|
58
|
-
endedAt: faros_js_client_1.Utils.toDate(execution.endedAt),
|
|
59
|
-
status: buildStatus,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
if (execution.artifact) {
|
|
64
|
-
res.push({
|
|
65
|
-
model: 'cicd_ArtifactDeployment',
|
|
66
|
-
record: {
|
|
67
|
-
artifact: execution.artifact,
|
|
68
|
-
deployment,
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return res;
|
|
73
|
-
}
|
|
74
|
-
parseArtifactFromTags(execution) {
|
|
75
|
-
if (!execution.artifacts || !execution.artifacts.length) {
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
const executionArtifact = execution.artifacts[0];
|
|
79
|
-
// artifact repo organization pulled from application tags
|
|
80
|
-
const organization = {
|
|
81
|
-
uid: execution.application.tags.find((t) => t.name === DEFAULT_EXECUTION_TAG_ARTIFACT_ORG)?.value,
|
|
82
|
-
source: execution.application.tags.find((t) => t.name === DEFAULT_EXECUTION_TAG_ARTIFACT_SOURCE)?.value ?? executionArtifact?.artifactSource.name,
|
|
83
|
-
};
|
|
84
|
-
const repository = {
|
|
85
|
-
uid: execution.application.tags.find((t) => t.name === DEFAULT_EXECUTION_TAG_ARTIFACT_REPO)?.value,
|
|
86
|
-
organization,
|
|
87
|
-
};
|
|
88
|
-
const artifact = {
|
|
89
|
-
uid: executionArtifact?.buildNo,
|
|
90
|
-
repository,
|
|
91
|
-
};
|
|
92
|
-
if (artifact.uid &&
|
|
93
|
-
artifact.repository.uid &&
|
|
94
|
-
artifact.repository.organization.uid &&
|
|
95
|
-
artifact.repository.organization.source) {
|
|
96
|
-
return artifact;
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
parseWorkflow(execution, source) {
|
|
103
|
-
const outcome = execution.outcomes?.nodes.find((o) => o.service?.artifactType);
|
|
104
|
-
if (!outcome) {
|
|
105
|
-
return undefined;
|
|
106
|
-
}
|
|
107
|
-
const artifactSource = outcome.service.artifactSources.find((a) => a.name);
|
|
108
|
-
if (!artifactSource) {
|
|
109
|
-
return undefined;
|
|
22
|
+
const cdInfo = execution.moduleInfo?.cd;
|
|
23
|
+
if (!cdInfo) {
|
|
24
|
+
return res;
|
|
110
25
|
}
|
|
111
26
|
const build = {
|
|
112
|
-
uid: execution.
|
|
27
|
+
uid: execution.planExecutionId,
|
|
113
28
|
pipeline: {
|
|
114
|
-
uid:
|
|
115
|
-
|
|
116
|
-
artifactSource.name,
|
|
117
|
-
organization: {
|
|
118
|
-
uid: DEFAULT_CICD_ORGANIZATION_UID,
|
|
119
|
-
source,
|
|
120
|
-
},
|
|
29
|
+
uid: execution.pipelineIdentifier,
|
|
30
|
+
organization: { uid: execution.orgIdentifier, source },
|
|
121
31
|
},
|
|
122
32
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
33
|
+
const buildRecord = {
|
|
34
|
+
...build,
|
|
35
|
+
name: execution.name,
|
|
36
|
+
startedAt: faros_js_client_1.Utils.toDate(execution.startTs),
|
|
37
|
+
endedAt: faros_js_client_1.Utils.toDate(execution.endTs),
|
|
38
|
+
status: this.toBuildStatus(execution.status),
|
|
39
|
+
};
|
|
40
|
+
res.push({ model: 'cicd_Build', record: buildRecord });
|
|
41
|
+
const serviceName = cdInfo.serviceIdentifiers?.[0];
|
|
42
|
+
let application = null;
|
|
43
|
+
if (serviceName) {
|
|
44
|
+
application = common_1.Common.computeApplication(serviceName, '');
|
|
45
|
+
if (!this.seenApplications.has(application.name)) {
|
|
46
|
+
res.push({ model: 'compute_Application', record: application });
|
|
47
|
+
this.seenApplications.add(application.name);
|
|
48
|
+
}
|
|
127
49
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
50
|
+
const envName = cdInfo.envIdentifiers?.[0];
|
|
51
|
+
const envType = cdInfo.environmentTypes?.[0];
|
|
52
|
+
const deploymentRecord = {
|
|
53
|
+
uid: execution.planExecutionId,
|
|
54
|
+
source,
|
|
55
|
+
application,
|
|
131
56
|
build,
|
|
132
|
-
|
|
57
|
+
startedAt: faros_js_client_1.Utils.toDate(execution.startTs),
|
|
58
|
+
endedAt: faros_js_client_1.Utils.toDate(execution.endTs),
|
|
59
|
+
env: this.toEnvironment(envName, envType),
|
|
60
|
+
status: this.toDeploymentStatus(execution.status),
|
|
133
61
|
};
|
|
62
|
+
res.push({ model: 'cicd_Deployment', record: deploymentRecord });
|
|
63
|
+
return res;
|
|
134
64
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
65
|
+
statusCategory(status) {
|
|
66
|
+
switch (status?.toUpperCase()) {
|
|
67
|
+
case 'ABORTED':
|
|
68
|
+
return 'Canceled';
|
|
69
|
+
case 'EXPIRED':
|
|
70
|
+
case 'FAILED':
|
|
71
|
+
return 'Failed';
|
|
72
|
+
case 'QUEUED':
|
|
73
|
+
case 'PAUSED':
|
|
74
|
+
case 'WAITING':
|
|
75
|
+
case 'APPROVALWAITING':
|
|
76
|
+
case 'ASYNCWAITING':
|
|
77
|
+
case 'TASKWAITING':
|
|
78
|
+
case 'TIMEDWAITING':
|
|
79
|
+
return 'Queued';
|
|
80
|
+
case 'RUNNING':
|
|
81
|
+
return 'Running';
|
|
82
|
+
case 'SUCCESS':
|
|
83
|
+
return 'Success';
|
|
84
|
+
default:
|
|
85
|
+
return 'Custom';
|
|
144
86
|
}
|
|
145
|
-
return {
|
|
146
|
-
application: common_1.Common.computeApplication(artifactSource.name, service.artifactType),
|
|
147
|
-
env: environment.name ?? environment.type,
|
|
148
|
-
};
|
|
149
87
|
}
|
|
150
88
|
toBuildStatus(status) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return { category: 'Canceled', detail: status };
|
|
156
|
-
case 'error':
|
|
157
|
-
case 'expired':
|
|
158
|
-
case 'failed':
|
|
159
|
-
return { category: 'Failed', detail: status };
|
|
160
|
-
case 'paused':
|
|
161
|
-
case 'queued':
|
|
162
|
-
case 'waiting':
|
|
163
|
-
return { category: 'Queued', detail: status };
|
|
164
|
-
case 'resumed':
|
|
165
|
-
case 'running':
|
|
166
|
-
return { category: 'Running', detail: status };
|
|
167
|
-
case 'success':
|
|
168
|
-
return { category: 'Success', detail: status };
|
|
169
|
-
case 'skipped':
|
|
170
|
-
default:
|
|
171
|
-
return { category: 'Custom', detail: status };
|
|
172
|
-
}
|
|
89
|
+
return {
|
|
90
|
+
category: canonical_models_1.cicd_BuildStatusCategory[this.statusCategory(status)],
|
|
91
|
+
detail: status,
|
|
92
|
+
};
|
|
173
93
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
if (statusLower === 'staging') {
|
|
180
|
-
return { category: 'Staging', detail: status };
|
|
181
|
-
}
|
|
182
|
-
if (statusLower.startsWith('dev')) {
|
|
183
|
-
return { category: 'Dev', detail: status };
|
|
184
|
-
}
|
|
185
|
-
if (statusLower === 'qa') {
|
|
186
|
-
return { category: 'QA', detail: status };
|
|
187
|
-
}
|
|
188
|
-
return { category: 'Custom', detail: status };
|
|
94
|
+
toDeploymentStatus(status) {
|
|
95
|
+
return {
|
|
96
|
+
category: canonical_models_1.cicd_DeploymentStatusCategory[this.statusCategory(status)],
|
|
97
|
+
detail: status,
|
|
98
|
+
};
|
|
189
99
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
100
|
+
toEnvironment(envName, envType) {
|
|
101
|
+
const env = envName || envType || 'unknown';
|
|
102
|
+
const envLower = env.toLowerCase();
|
|
103
|
+
if (envLower.includes('prod')) {
|
|
104
|
+
return { category: canonical_models_1.cicd_EnvironmentCategory.Prod, detail: env };
|
|
194
105
|
}
|
|
195
|
-
|
|
196
|
-
|
|
106
|
+
if (envLower.includes('staging')) {
|
|
107
|
+
return { category: canonical_models_1.cicd_EnvironmentCategory.Staging, detail: env };
|
|
197
108
|
}
|
|
198
|
-
if (
|
|
199
|
-
return;
|
|
109
|
+
if (envLower.includes('dev')) {
|
|
110
|
+
return { category: canonical_models_1.cicd_EnvironmentCategory.Dev, detail: env };
|
|
200
111
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
application: implementation.application,
|
|
204
|
-
startedAt: item.startedAt,
|
|
205
|
-
endedAt: item.endedAt,
|
|
206
|
-
env: implementation.env,
|
|
207
|
-
status: item.status,
|
|
208
|
-
build: implementation.build,
|
|
209
|
-
artifact: implementation.artifact,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
toDeploymentStatus(status) {
|
|
213
|
-
const statusLower = status.toLowerCase();
|
|
214
|
-
switch (statusLower) {
|
|
215
|
-
case 'aborted':
|
|
216
|
-
case 'rejected':
|
|
217
|
-
return { category: 'Canceled', detail: status };
|
|
218
|
-
case 'error':
|
|
219
|
-
case 'expired':
|
|
220
|
-
case 'failed':
|
|
221
|
-
return { category: 'Failed', detail: status };
|
|
222
|
-
case 'paused':
|
|
223
|
-
case 'queued':
|
|
224
|
-
case 'waiting':
|
|
225
|
-
return { category: 'Queued', detail: status };
|
|
226
|
-
case 'resumed':
|
|
227
|
-
case 'running':
|
|
228
|
-
return { category: 'Running', detail: status };
|
|
229
|
-
case 'success':
|
|
230
|
-
return { category: 'Success', detail: status };
|
|
231
|
-
case 'skipped':
|
|
232
|
-
default:
|
|
233
|
-
return { category: 'Custom', detail: status };
|
|
112
|
+
if (envLower.includes('qa') || envLower.includes('test')) {
|
|
113
|
+
return { category: canonical_models_1.cicd_EnvironmentCategory.QA, detail: env };
|
|
234
114
|
}
|
|
115
|
+
return { category: canonical_models_1.cicd_EnvironmentCategory.Custom, detail: env };
|
|
235
116
|
}
|
|
236
117
|
}
|
|
237
118
|
exports.Executions = Executions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executions.js","sourceRoot":"","sources":["../../../src/converters/harness/executions.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"executions.js","sourceRoot":"","sources":["../../../src/converters/harness/executions.ts"],"names":[],"mappings":";;;AAAA,iEAUoC;AAEpC,qDAAsC;AAEtC,6CAAwC;AAExC,qCAA6D;AAI7D,MAAa,UAAW,SAAQ,yBAAgB;IAAhD;;QACW,sBAAiB,GAAoC;YAC5D,YAAY;YACZ,iBAAiB;YACjB,qBAAqB;SACtB,CAAC;QAEM,qBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;IAsH/C,CAAC;IApHC,KAAK,CAAC,OAAO,CACX,MAAqB;QAErB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAyB,CAAC;QAC1D,MAAM,GAAG,GAAwB,EAAE,CAAC;QAEpC,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,EAAE,EAAE,CAAC;QACxC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,GAAG,CAAC;QACb,CAAC;QAED,MAAM,KAAK,GAAa;YACtB,GAAG,EAAE,SAAS,CAAC,eAAe;YAC9B,QAAQ,EAAE;gBACR,GAAG,EAAE,SAAS,CAAC,kBAAkB;gBACjC,YAAY,EAAE,EAAC,GAAG,EAAE,SAAS,CAAC,aAAa,EAAE,MAAM,EAAC;aACrD;SACF,CAAC;QAEF,MAAM,WAAW,GAAwB;YACvC,GAAG,KAAK;YACR,IAAI,EAAE,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AAG,CAAC,WAAW,EAAE,CAAC;QAEnC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAC,QAAQ,EAAE,2CAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC;QAChE,CAAC;QACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACjC,OAAO,EAAC,QAAQ,EAAE,2CAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC;QACnE,CAAC;QACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAC,QAAQ,EAAE,2CAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC;QAC/D,CAAC;QACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACzD,OAAO,EAAC,QAAQ,EAAE,2CAAwB,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC;QAC9D,CAAC;QAED,OAAO,EAAC,QAAQ,EAAE,2CAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC;IAClE,CAAC;CACF;AA7HD,gCA6HC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord } from '../converter';
|
|
3
|
+
import { HarnessConverter } from './common';
|
|
4
|
+
export declare class Organizations extends HarnessConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord): 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.HarnessConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'cicd_Organization',
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
async convert(record) {
|
|
13
|
+
const source = this.streamName.source;
|
|
14
|
+
const org = record.record.data;
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
model: 'cicd_Organization',
|
|
18
|
+
record: {
|
|
19
|
+
uid: org.identifier,
|
|
20
|
+
name: org.name,
|
|
21
|
+
description: org.description,
|
|
22
|
+
source,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Organizations = Organizations;
|
|
29
|
+
//# sourceMappingURL=organizations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organizations.js","sourceRoot":"","sources":["../../../src/converters/harness/organizations.ts"],"names":[],"mappings":";;;AAIA,qCAAwD;AAExD,MAAa,aAAc,SAAQ,yBAAgB;IAAnD;;QACW,sBAAiB,GAAoC;YAC5D,mBAAmB;SACpB,CAAC;IAoBJ,CAAC;IAlBC,KAAK,CAAC,OAAO,CACX,MAAqB;QAErB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAoB,CAAC;QAE/C,OAAO;YACL;gBACE,KAAK,EAAE,mBAAmB;gBAC1B,MAAM,EAAE;oBACN,GAAG,EAAE,GAAG,CAAC,UAAU;oBACnB,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,WAAW,EAAE,GAAG,CAAC,WAAW;oBAC5B,MAAM;iBAC8B;aACvC;SACF,CAAC;IACJ,CAAC;CACF;AAvBD,sCAuBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord } from '../converter';
|
|
3
|
+
import { HarnessConverter } from './common';
|
|
4
|
+
export declare class Pipelines extends HarnessConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.HarnessConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'cicd_Pipeline',
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
async convert(record) {
|
|
13
|
+
const source = this.streamName.source;
|
|
14
|
+
const pipeline = record.record.data;
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
model: 'cicd_Pipeline',
|
|
18
|
+
record: {
|
|
19
|
+
uid: pipeline.identifier,
|
|
20
|
+
name: pipeline.name,
|
|
21
|
+
description: pipeline.description,
|
|
22
|
+
organization: { uid: pipeline.orgIdentifier, source },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Pipelines = Pipelines;
|
|
29
|
+
//# sourceMappingURL=pipelines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipelines.js","sourceRoot":"","sources":["../../../src/converters/harness/pipelines.ts"],"names":[],"mappings":";;;AAIA,qCAAoD;AAEpD,MAAa,SAAU,SAAQ,yBAAgB;IAA/C;;QACW,sBAAiB,GAAoC;YAC5D,eAAe;SAChB,CAAC;IAoBJ,CAAC;IAlBC,KAAK,CAAC,OAAO,CACX,MAAqB;QAErB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAgB,CAAC;QAEhD,OAAO;YACL;gBACE,KAAK,EAAE,eAAe;gBACtB,MAAM,EAAE;oBACN,GAAG,EAAE,QAAQ,CAAC,UAAU;oBACxB,IAAI,EAAE,QAAQ,CAAC,IAAI;oBACnB,WAAW,EAAE,QAAQ,CAAC,WAAW;oBACjC,YAAY,EAAE,EAAC,GAAG,EAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAC;iBACnB;aACnC;SACF,CAAC;IACJ,CAAC;CACF;AAvBD,8BAuBC"}
|