airbyte-faros-destination 0.4.74 → 0.4.75

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,7 +1,6 @@
1
- import { AirbyteRecord } from 'faros-airbyte-cdk';
2
1
  import { DestinationModel, DestinationRecord } from '../converter';
3
2
  import { CircleCIConverter } from './common';
4
3
  export declare class Pipelines extends CircleCIConverter {
5
4
  readonly destinationModels: ReadonlyArray<DestinationModel>;
6
- convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
5
+ convert(): Promise<ReadonlyArray<DestinationRecord>>;
7
6
  }
@@ -1,72 +1,14 @@
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");
6
4
  const common_1 = require("./common");
7
5
  class Pipelines extends common_1.CircleCIConverter {
8
6
  constructor() {
9
7
  super(...arguments);
10
- this.destinationModels = [
11
- 'cicd_Build',
12
- 'cicd_BuildCommitAssociation',
13
- 'cicd_BuildStep',
14
- ];
8
+ this.destinationModels = [];
15
9
  }
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;
10
+ async convert() {
11
+ return [];
70
12
  }
71
13
  }
72
14
  exports.Pipelines = Pipelines;
@@ -1 +1 @@
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;YAC5D,YAAY;YACZ,6BAA6B;YAC7B,gBAAgB;SACjB,CAAC;IA4DJ,CAAC;IA3DC,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;QAChD,MAAM,GAAG,GAAwB,EAAE,CAAC;QAEpC,KAAK,MAAM,QAAQ,IAAI,QAAQ,CAAC,SAAS,EAAE;YACzC,MAAM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H,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE;gBAC/B,GAAG,CAAC,IAAI,CAAC;oBACP,KAAK,EAAE,gBAAgB;oBACvB,MAAM,EAAE;wBACN,GAAG,EAAE,IAAA,gBAAO,EAAC,GAAG,CAAC,EAAE,CAAC;wBACpB,IAAI,EAAE,GAAG,CAAC,IAAI;wBACd,SAAS,EAAE,uBAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;wBACvC,OAAO,EAAE,uBAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;wBACrC,MAAM,EAAE,uBAAc,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC;wBAChD,IAAI,EAAE,uBAAc,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;wBAC7C,KAAK,EAAE,QAAQ;qBAChB;iBACF,CAAC,CAAC;aACJ;SACF;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAjED,8BAiEC"}
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"}
@@ -0,0 +1,9 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
3
+ import { CircleCIConverter } from './common';
4
+ export declare class Workflows extends CircleCIConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ private static readonly pipelinesStream;
7
+ get dependencies(): ReadonlyArray<StreamName>;
8
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
9
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Workflows = void 0;
4
+ const faros_js_client_1 = require("faros-js-client");
5
+ const lodash_1 = require("lodash");
6
+ const converter_1 = require("../converter");
7
+ const common_1 = require("./common");
8
+ class Workflows extends common_1.CircleCIConverter {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.destinationModels = [
12
+ 'cicd_Build',
13
+ 'cicd_BuildCommitAssociation',
14
+ 'cicd_BuildStep',
15
+ ];
16
+ }
17
+ get dependencies() {
18
+ return [Workflows.pipelinesStream];
19
+ }
20
+ async convert(record, ctx) {
21
+ var _a, _b, _c, _d;
22
+ const source = this.streamName.source;
23
+ const workflow = record.record.data;
24
+ const res = [];
25
+ const pipeline = (_a = ctx.get(Workflows.pipelinesStream.asString, workflow.pipeline_id)) === null || _a === void 0 ? void 0 : _a.record.data;
26
+ if (!pipeline) {
27
+ ctx.logger.warn(`Could not find pipeline record for id ${workflow.pipeline_id}`);
28
+ return res;
29
+ }
30
+ const buildKey = common_1.CircleCICommon.getBuildKey(workflow, pipeline, source);
31
+ const repoName = common_1.CircleCICommon.getProject(pipeline.project_slug);
32
+ res.push({
33
+ model: 'cicd_Build',
34
+ record: {
35
+ ...buildKey,
36
+ number: pipeline.number,
37
+ name: `${common_1.CircleCICommon.getProject(pipeline.project_slug)}_${pipeline.number}_${workflow.name}`,
38
+ createdAt: faros_js_client_1.Utils.toDate(workflow.created_at),
39
+ startedAt: faros_js_client_1.Utils.toDate(workflow.created_at),
40
+ endedAt: faros_js_client_1.Utils.toDate(workflow.stopped_at),
41
+ status: common_1.CircleCICommon.convertStatus(workflow.status),
42
+ },
43
+ });
44
+ res.push({
45
+ model: 'cicd_BuildCommitAssociation',
46
+ record: {
47
+ build: buildKey,
48
+ commit: {
49
+ sha: (_b = pipeline.vcs) === null || _b === void 0 ? void 0 : _b.revision,
50
+ uid: (_c = pipeline.vcs) === null || _c === void 0 ? void 0 : _c.revision,
51
+ repository: {
52
+ name: repoName,
53
+ uid: repoName,
54
+ organization: {
55
+ uid: common_1.CircleCICommon.getOrganization(pipeline.project_slug),
56
+ source: (_d = pipeline.vcs) === null || _d === void 0 ? void 0 : _d.provider_name,
57
+ },
58
+ },
59
+ },
60
+ },
61
+ });
62
+ for (const job of workflow.jobs) {
63
+ res.push({
64
+ model: 'cicd_BuildStep',
65
+ record: {
66
+ uid: (0, lodash_1.toLower)(job.id),
67
+ name: job.name,
68
+ startedAt: faros_js_client_1.Utils.toDate(job.started_at),
69
+ endedAt: faros_js_client_1.Utils.toDate(job.stopped_at),
70
+ status: common_1.CircleCICommon.convertStatus(job.status),
71
+ type: common_1.CircleCICommon.convertJobType(job.type),
72
+ build: buildKey,
73
+ },
74
+ });
75
+ }
76
+ return res;
77
+ }
78
+ }
79
+ exports.Workflows = Workflows;
80
+ Workflows.pipelinesStream = new converter_1.StreamName('circleci', 'pipelines');
81
+ //# sourceMappingURL=workflows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../../src/converters/circleci/workflows.ts"],"names":[],"mappings":";;;AACA,qDAAsC;AACtC,mCAA+B;AAE/B,4CAKsB;AACtB,qCAA2D;AAG3D,MAAa,SAAU,SAAQ,0BAAiB;IAAhD;;QACW,sBAAiB,GAAoC;YAC5D,YAAY;YACZ,6BAA6B;YAC7B,gBAAgB;SACjB,CAAC;IAgFJ,CAAC;IAzEC,IAAa,YAAY;QACvB,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAgB,CAAC;QAChD,MAAM,GAAG,GAAwB,EAAE,CAAC;QAEpC,MAAM,QAAQ,GAAG,MAAA,GAAG,CAAC,GAAG,CACtB,SAAS,CAAC,eAAe,CAAC,QAAQ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