airbyte-faros-destination 0.4.79 → 0.4.81

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.
@@ -1,6 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
1
2
  import { DestinationModel, DestinationRecord } from '../converter';
2
3
  import { CircleCIConverter } from './common';
3
4
  export declare class Pipelines extends CircleCIConverter {
4
5
  readonly destinationModels: ReadonlyArray<DestinationModel>;
5
- convert(): Promise<ReadonlyArray<DestinationRecord>>;
6
+ convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
6
7
  }
@@ -1,14 +1,72 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Pipelines = void 0;
4
+ const faros_js_client_1 = require("faros-js-client");
5
+ const lodash_1 = require("lodash");
4
6
  const common_1 = require("./common");
5
7
  class Pipelines extends common_1.CircleCIConverter {
6
8
  constructor() {
7
9
  super(...arguments);
8
- this.destinationModels = [];
10
+ this.destinationModels = [
11
+ 'cicd_Build',
12
+ 'cicd_BuildCommitAssociation',
13
+ 'cicd_BuildStep',
14
+ ];
9
15
  }
10
- async convert() {
11
- return [];
16
+ async convert(record) {
17
+ var _a, _b, _c;
18
+ const source = this.streamName.source;
19
+ const pipeline = record.record.data;
20
+ const res = [];
21
+ for (const workflow of pipeline.workflows) {
22
+ const buildKey = common_1.CircleCICommon.getBuildKey(workflow, pipeline, source);
23
+ const repoName = common_1.CircleCICommon.getProject(pipeline.project_slug);
24
+ res.push({
25
+ model: 'cicd_Build',
26
+ record: {
27
+ ...buildKey,
28
+ number: pipeline.number,
29
+ name: `${common_1.CircleCICommon.getProject(pipeline.project_slug)}_${pipeline.number}_${workflow.name}`,
30
+ createdAt: faros_js_client_1.Utils.toDate(workflow.created_at),
31
+ startedAt: faros_js_client_1.Utils.toDate(workflow.created_at),
32
+ endedAt: faros_js_client_1.Utils.toDate(workflow.stopped_at),
33
+ status: common_1.CircleCICommon.convertStatus(workflow.status),
34
+ },
35
+ });
36
+ res.push({
37
+ model: 'cicd_BuildCommitAssociation',
38
+ record: {
39
+ build: buildKey,
40
+ commit: {
41
+ sha: (_a = pipeline.vcs) === null || _a === void 0 ? void 0 : _a.revision,
42
+ uid: (_b = pipeline.vcs) === null || _b === void 0 ? void 0 : _b.revision,
43
+ repository: {
44
+ name: repoName,
45
+ uid: repoName,
46
+ organization: {
47
+ uid: common_1.CircleCICommon.getOrganization(pipeline.project_slug),
48
+ source: (_c = pipeline.vcs) === null || _c === void 0 ? void 0 : _c.provider_name,
49
+ },
50
+ },
51
+ },
52
+ },
53
+ });
54
+ for (const job of workflow.jobs) {
55
+ res.push({
56
+ model: 'cicd_BuildStep',
57
+ record: {
58
+ uid: (0, lodash_1.toLower)(job.id),
59
+ name: job.name,
60
+ startedAt: faros_js_client_1.Utils.toDate(job.started_at),
61
+ endedAt: faros_js_client_1.Utils.toDate(job.stopped_at),
62
+ status: common_1.CircleCICommon.convertStatus(job.status),
63
+ type: common_1.CircleCICommon.convertJobType(job.type),
64
+ build: buildKey,
65
+ },
66
+ });
67
+ }
68
+ }
69
+ return res;
12
70
  }
13
71
  }
14
72
  exports.Pipelines = Pipelines;
@@ -1 +1 @@
1
- {"version":3,"file":"pipelines.js","sourceRoot":"","sources":["../../../src/converters/circleci/pipelines.ts"],"names":[],"mappings":";;;AACA,qCAA2C;AAE3C,MAAa,SAAU,SAAQ,0BAAiB;IAAhD;;QACW,sBAAiB,GAAoC,EAAE,CAAC;IAInE,CAAC;IAHC,KAAK,CAAC,OAAO;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AALD,8BAKC"}
1
+ {"version":3,"file":"pipelines.js","sourceRoot":"","sources":["../../../src/converters/circleci/pipelines.ts"],"names":[],"mappings":";;;AACA,qDAAsC;AACtC,mCAA+B;AAG/B,qCAA2D;AAG3D,MAAa,SAAU,SAAQ,0BAAiB;IAAhD;;QACW,sBAAiB,GAAoC;YAC5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