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.
Files changed (280) hide show
  1. package/README.md +161 -0
  2. package/lib/common/write-stats.d.ts +16 -0
  3. package/lib/common/write-stats.js +48 -0
  4. package/lib/community/hasura-client.d.ts +27 -0
  5. package/lib/community/hasura-client.js +278 -0
  6. package/lib/community/hasura-writer.d.ts +12 -0
  7. package/lib/community/hasura-writer.js +44 -0
  8. package/lib/community/types.d.ts +26 -0
  9. package/lib/community/types.js +9 -0
  10. package/lib/converters/agileaccelerator/agileaccelerator_types.d.ts +315 -0
  11. package/lib/converters/agileaccelerator/agileaccelerator_types.js +81 -0
  12. package/lib/converters/agileaccelerator/common.d.ts +64 -0
  13. package/lib/converters/agileaccelerator/common.js +167 -0
  14. package/lib/converters/agileaccelerator/works.d.ts +7 -0
  15. package/lib/converters/agileaccelerator/works.js +105 -0
  16. package/lib/converters/asana/common.d.ts +39 -0
  17. package/lib/converters/asana/common.js +64 -0
  18. package/lib/converters/asana/projects.d.ts +7 -0
  19. package/lib/converters/asana/projects.js +29 -0
  20. package/lib/converters/asana/sections.d.ts +7 -0
  21. package/lib/converters/asana/sections.js +28 -0
  22. package/lib/converters/asana/stories.d.ts +7 -0
  23. package/lib/converters/asana/stories.js +32 -0
  24. package/lib/converters/asana/tags.d.ts +7 -0
  25. package/lib/converters/asana/tags.js +22 -0
  26. package/lib/converters/asana/tasks.d.ts +11 -0
  27. package/lib/converters/asana/tasks.js +160 -0
  28. package/lib/converters/asana/users.d.ts +7 -0
  29. package/lib/converters/asana/users.js +16 -0
  30. package/lib/converters/backlog/common.d.ts +20 -0
  31. package/lib/converters/backlog/common.js +59 -0
  32. package/lib/converters/backlog/issues.d.ts +7 -0
  33. package/lib/converters/backlog/issues.js +119 -0
  34. package/lib/converters/backlog/models.d.ts +156 -0
  35. package/lib/converters/backlog/models.js +23 -0
  36. package/lib/converters/backlog/projects.d.ts +7 -0
  37. package/lib/converters/backlog/projects.js +78 -0
  38. package/lib/converters/backlog/users.d.ts +7 -0
  39. package/lib/converters/backlog/users.js +26 -0
  40. package/lib/converters/bitbucket/branches.d.ts +7 -0
  41. package/lib/converters/bitbucket/branches.js +31 -0
  42. package/lib/converters/bitbucket/commits.d.ts +7 -0
  43. package/lib/converters/bitbucket/commits.js +50 -0
  44. package/lib/converters/bitbucket/common.d.ts +28 -0
  45. package/lib/converters/bitbucket/common.js +56 -0
  46. package/lib/converters/bitbucket/deployments.d.ts +11 -0
  47. package/lib/converters/bitbucket/deployments.js +100 -0
  48. package/lib/converters/bitbucket/issues.d.ts +12 -0
  49. package/lib/converters/bitbucket/issues.js +111 -0
  50. package/lib/converters/bitbucket/pipeline_steps.d.ts +10 -0
  51. package/lib/converters/bitbucket/pipeline_steps.js +83 -0
  52. package/lib/converters/bitbucket/pipelines.d.ts +8 -0
  53. package/lib/converters/bitbucket/pipelines.js +90 -0
  54. package/lib/converters/bitbucket/pull_request_activities.d.ts +13 -0
  55. package/lib/converters/bitbucket/pull_request_activities.js +112 -0
  56. package/lib/converters/bitbucket/pull_requests.d.ts +10 -0
  57. package/lib/converters/bitbucket/pull_requests.js +95 -0
  58. package/lib/converters/bitbucket/repositories.d.ts +9 -0
  59. package/lib/converters/bitbucket/repositories.js +41 -0
  60. package/lib/converters/bitbucket/types.d.ts +667 -0
  61. package/lib/converters/bitbucket/types.js +2 -0
  62. package/lib/converters/bitbucket/workspace_users.d.ts +7 -0
  63. package/lib/converters/bitbucket/workspace_users.js +31 -0
  64. package/lib/converters/bitbucket/workspaces.d.ts +8 -0
  65. package/lib/converters/bitbucket/workspaces.js +61 -0
  66. package/lib/converters/converter-registry.d.ts +25 -0
  67. package/lib/converters/converter-registry.js +64 -0
  68. package/lib/converters/converter.d.ts +63 -0
  69. package/lib/converters/converter.js +122 -0
  70. package/lib/converters/datadog/common.d.ts +27 -0
  71. package/lib/converters/datadog/common.js +34 -0
  72. package/lib/converters/datadog/incidents.d.ts +9 -0
  73. package/lib/converters/datadog/incidents.js +128 -0
  74. package/lib/converters/datadog/users.d.ts +7 -0
  75. package/lib/converters/datadog/users.js +27 -0
  76. package/lib/converters/docker/common.d.ts +87 -0
  77. package/lib/converters/docker/common.js +76 -0
  78. package/lib/converters/docker/tags.d.ts +8 -0
  79. package/lib/converters/docker/tags.js +98 -0
  80. package/lib/converters/github/assignees.d.ts +7 -0
  81. package/lib/converters/github/assignees.js +16 -0
  82. package/lib/converters/github/branches.d.ts +7 -0
  83. package/lib/converters/github/branches.js +28 -0
  84. package/lib/converters/github/collaborators.d.ts +7 -0
  85. package/lib/converters/github/collaborators.js +19 -0
  86. package/lib/converters/github/commits.d.ts +7 -0
  87. package/lib/converters/github/commits.js +48 -0
  88. package/lib/converters/github/common.d.ts +37 -0
  89. package/lib/converters/github/common.js +130 -0
  90. package/lib/converters/github/issue_labels.d.ts +7 -0
  91. package/lib/converters/github/issue_labels.js +20 -0
  92. package/lib/converters/github/issue_milestones.d.ts +8 -0
  93. package/lib/converters/github/issue_milestones.js +42 -0
  94. package/lib/converters/github/issues.d.ts +9 -0
  95. package/lib/converters/github/issues.js +90 -0
  96. package/lib/converters/github/organizations.d.ts +7 -0
  97. package/lib/converters/github/organizations.js +37 -0
  98. package/lib/converters/github/projects.d.ts +7 -0
  99. package/lib/converters/github/projects.js +21 -0
  100. package/lib/converters/github/pull_request_stats.d.ts +7 -0
  101. package/lib/converters/github/pull_request_stats.js +43 -0
  102. package/lib/converters/github/pull_requests.d.ts +7 -0
  103. package/lib/converters/github/pull_requests.js +63 -0
  104. package/lib/converters/github/releases.d.ts +7 -0
  105. package/lib/converters/github/releases.js +51 -0
  106. package/lib/converters/github/repositories.d.ts +7 -0
  107. package/lib/converters/github/repositories.js +44 -0
  108. package/lib/converters/github/review_comments.d.ts +7 -0
  109. package/lib/converters/github/review_comments.js +39 -0
  110. package/lib/converters/github/reviews.d.ts +7 -0
  111. package/lib/converters/github/reviews.js +58 -0
  112. package/lib/converters/github/tags.d.ts +7 -0
  113. package/lib/converters/github/tags.js +31 -0
  114. package/lib/converters/github/users.d.ts +7 -0
  115. package/lib/converters/github/users.js +19 -0
  116. package/lib/converters/gitlab/branches.d.ts +8 -0
  117. package/lib/converters/gitlab/branches.js +44 -0
  118. package/lib/converters/gitlab/commits.d.ts +7 -0
  119. package/lib/converters/gitlab/commits.js +33 -0
  120. package/lib/converters/gitlab/common.d.ts +30 -0
  121. package/lib/converters/gitlab/common.js +70 -0
  122. package/lib/converters/gitlab/group_labels.d.ts +7 -0
  123. package/lib/converters/gitlab/group_labels.js +15 -0
  124. package/lib/converters/gitlab/group_milestones.d.ts +8 -0
  125. package/lib/converters/gitlab/group_milestones.js +41 -0
  126. package/lib/converters/gitlab/groups.d.ts +7 -0
  127. package/lib/converters/gitlab/groups.js +43 -0
  128. package/lib/converters/gitlab/issues.d.ts +10 -0
  129. package/lib/converters/gitlab/issues.js +79 -0
  130. package/lib/converters/gitlab/jobs.d.ts +11 -0
  131. package/lib/converters/gitlab/jobs.js +75 -0
  132. package/lib/converters/gitlab/merge_request_commits.d.ts +7 -0
  133. package/lib/converters/gitlab/merge_request_commits.js +34 -0
  134. package/lib/converters/gitlab/merge_requests.d.ts +10 -0
  135. package/lib/converters/gitlab/merge_requests.js +65 -0
  136. package/lib/converters/gitlab/pipelines.d.ts +7 -0
  137. package/lib/converters/gitlab/pipelines.js +41 -0
  138. package/lib/converters/gitlab/project_labels.d.ts +7 -0
  139. package/lib/converters/gitlab/project_labels.js +15 -0
  140. package/lib/converters/gitlab/project_milestones.d.ts +8 -0
  141. package/lib/converters/gitlab/project_milestones.js +41 -0
  142. package/lib/converters/gitlab/projects.d.ts +7 -0
  143. package/lib/converters/gitlab/projects.js +51 -0
  144. package/lib/converters/gitlab/releases.d.ts +10 -0
  145. package/lib/converters/gitlab/releases.js +68 -0
  146. package/lib/converters/gitlab/tags.d.ts +10 -0
  147. package/lib/converters/gitlab/tags.js +41 -0
  148. package/lib/converters/gitlab/users.d.ts +7 -0
  149. package/lib/converters/gitlab/users.js +33 -0
  150. package/lib/converters/googlecalendar/calendar_models.d.ts +618 -0
  151. package/lib/converters/googlecalendar/calendar_models.js +2 -0
  152. package/lib/converters/googlecalendar/calendars.d.ts +7 -0
  153. package/lib/converters/googlecalendar/calendars.js +29 -0
  154. package/lib/converters/googlecalendar/common.d.ts +52 -0
  155. package/lib/converters/googlecalendar/common.js +130 -0
  156. package/lib/converters/googlecalendar/events.d.ts +8 -0
  157. package/lib/converters/googlecalendar/events.js +117 -0
  158. package/lib/converters/harness/common.d.ts +105 -0
  159. package/lib/converters/harness/common.js +16 -0
  160. package/lib/converters/harness/executions.d.ts +15 -0
  161. package/lib/converters/harness/executions.js +245 -0
  162. package/lib/converters/jenkins/builds.d.ts +9 -0
  163. package/lib/converters/jenkins/builds.js +74 -0
  164. package/lib/converters/jenkins/common.d.ts +25 -0
  165. package/lib/converters/jenkins/common.js +54 -0
  166. package/lib/converters/jenkins/jobs.d.ts +8 -0
  167. package/lib/converters/jenkins/jobs.js +29 -0
  168. package/lib/converters/jira/board_issues.d.ts +7 -0
  169. package/lib/converters/jira/board_issues.js +28 -0
  170. package/lib/converters/jira/boards.d.ts +7 -0
  171. package/lib/converters/jira/boards.js +34 -0
  172. package/lib/converters/jira/common.d.ts +61 -0
  173. package/lib/converters/jira/common.js +64 -0
  174. package/lib/converters/jira/epics.d.ts +8 -0
  175. package/lib/converters/jira/epics.js +45 -0
  176. package/lib/converters/jira/issue_fields.d.ts +7 -0
  177. package/lib/converters/jira/issue_fields.js +15 -0
  178. package/lib/converters/jira/issues.d.ts +52 -0
  179. package/lib/converters/jira/issues.js +545 -0
  180. package/lib/converters/jira/project_versions.d.ts +9 -0
  181. package/lib/converters/jira/project_versions.js +48 -0
  182. package/lib/converters/jira/projects.d.ts +7 -0
  183. package/lib/converters/jira/projects.js +40 -0
  184. package/lib/converters/jira/pull_requests.d.ts +7 -0
  185. package/lib/converters/jira/pull_requests.js +15 -0
  186. package/lib/converters/jira/sprint_issues.d.ts +7 -0
  187. package/lib/converters/jira/sprint_issues.js +15 -0
  188. package/lib/converters/jira/sprints.d.ts +16 -0
  189. package/lib/converters/jira/sprints.js +80 -0
  190. package/lib/converters/jira/users.d.ts +8 -0
  191. package/lib/converters/jira/users.js +33 -0
  192. package/lib/converters/jira/workflow_statuses.d.ts +7 -0
  193. package/lib/converters/jira/workflow_statuses.js +15 -0
  194. package/lib/converters/jsonata.d.ts +17 -0
  195. package/lib/converters/jsonata.js +47 -0
  196. package/lib/converters/okta/common.d.ts +8 -0
  197. package/lib/converters/okta/common.js +17 -0
  198. package/lib/converters/okta/groups.d.ts +7 -0
  199. package/lib/converters/okta/groups.js +47 -0
  200. package/lib/converters/okta/models.d.ts +102 -0
  201. package/lib/converters/okta/models.js +2 -0
  202. package/lib/converters/okta/users.d.ts +8 -0
  203. package/lib/converters/okta/users.js +73 -0
  204. package/lib/converters/okta_faros/common.d.ts +4 -0
  205. package/lib/converters/okta_faros/common.js +11 -0
  206. package/lib/converters/okta_faros/groups.d.ts +13 -0
  207. package/lib/converters/okta_faros/groups.js +23 -0
  208. package/lib/converters/okta_faros/users.d.ts +13 -0
  209. package/lib/converters/okta_faros/users.js +23 -0
  210. package/lib/converters/pagerduty/common.d.ts +37 -0
  211. package/lib/converters/pagerduty/common.js +40 -0
  212. package/lib/converters/pagerduty/incident_log_entries.d.ts +8 -0
  213. package/lib/converters/pagerduty/incident_log_entries.js +56 -0
  214. package/lib/converters/pagerduty/incidents.d.ts +10 -0
  215. package/lib/converters/pagerduty/incidents.js +127 -0
  216. package/lib/converters/pagerduty/priorities_resource.d.ts +11 -0
  217. package/lib/converters/pagerduty/priorities_resource.js +64 -0
  218. package/lib/converters/pagerduty/users.d.ts +7 -0
  219. package/lib/converters/pagerduty/users.js +26 -0
  220. package/lib/converters/phabricator/commits.d.ts +8 -0
  221. package/lib/converters/phabricator/commits.js +75 -0
  222. package/lib/converters/phabricator/common.d.ts +40 -0
  223. package/lib/converters/phabricator/common.js +107 -0
  224. package/lib/converters/phabricator/repositories.d.ts +7 -0
  225. package/lib/converters/phabricator/repositories.js +56 -0
  226. package/lib/converters/phabricator/revisions.d.ts +7 -0
  227. package/lib/converters/phabricator/revisions.js +83 -0
  228. package/lib/converters/phabricator/users.d.ts +7 -0
  229. package/lib/converters/phabricator/users.js +39 -0
  230. package/lib/converters/shortcut/common.d.ts +16 -0
  231. package/lib/converters/shortcut/common.js +68 -0
  232. package/lib/converters/shortcut/epics.d.ts +7 -0
  233. package/lib/converters/shortcut/epics.js +29 -0
  234. package/lib/converters/shortcut/iterations.d.ts +7 -0
  235. package/lib/converters/shortcut/iterations.js +29 -0
  236. package/lib/converters/shortcut/members.d.ts +7 -0
  237. package/lib/converters/shortcut/members.js +26 -0
  238. package/lib/converters/shortcut/models.d.ts +392 -0
  239. package/lib/converters/shortcut/models.js +30 -0
  240. package/lib/converters/shortcut/projects.d.ts +7 -0
  241. package/lib/converters/shortcut/projects.js +46 -0
  242. package/lib/converters/shortcut/stories.d.ts +7 -0
  243. package/lib/converters/shortcut/stories.js +127 -0
  244. package/lib/converters/squadcast/common.d.ts +169 -0
  245. package/lib/converters/squadcast/common.js +62 -0
  246. package/lib/converters/squadcast/events.d.ts +9 -0
  247. package/lib/converters/squadcast/events.js +53 -0
  248. package/lib/converters/squadcast/incidents.d.ts +10 -0
  249. package/lib/converters/squadcast/incidents.js +141 -0
  250. package/lib/converters/squadcast/services.d.ts +7 -0
  251. package/lib/converters/squadcast/services.js +28 -0
  252. package/lib/converters/squadcast/users.d.ts +7 -0
  253. package/lib/converters/squadcast/users.js +27 -0
  254. package/lib/converters/statuspage/common.d.ts +93 -0
  255. package/lib/converters/statuspage/common.js +80 -0
  256. package/lib/converters/statuspage/incident_updates.d.ts +8 -0
  257. package/lib/converters/statuspage/incident_updates.js +45 -0
  258. package/lib/converters/statuspage/incidents.d.ts +10 -0
  259. package/lib/converters/statuspage/incidents.js +128 -0
  260. package/lib/converters/statuspage/users.d.ts +7 -0
  261. package/lib/converters/statuspage/users.js +26 -0
  262. package/lib/converters/victorops/common.d.ts +16 -0
  263. package/lib/converters/victorops/common.js +24 -0
  264. package/lib/converters/victorops/incidents.d.ts +12 -0
  265. package/lib/converters/victorops/incidents.js +209 -0
  266. package/lib/converters/victorops/teams.d.ts +8 -0
  267. package/lib/converters/victorops/teams.js +30 -0
  268. package/lib/converters/victorops/users.d.ts +8 -0
  269. package/lib/converters/victorops/users.js +33 -0
  270. package/lib/destination-runner.d.ts +12 -0
  271. package/lib/destination-runner.js +22 -0
  272. package/lib/destination.d.ts +42 -0
  273. package/lib/destination.js +508 -0
  274. package/lib/index.d.ts +16 -0
  275. package/lib/index.js +39 -0
  276. package/lib/tsconfig.tsbuildinfo +1 -0
  277. package/package.json +71 -0
  278. package/resources/fetch-primary-keys.sql +16 -0
  279. package/resources/introspection-query.gql +61 -0
  280. package/resources/spec.json +468 -0
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProjectVersions = void 0;
4
+ const faros_feeds_sdk_1 = require("faros-feeds-sdk");
5
+ const converter_1 = require("../converter");
6
+ const common_1 = require("./common");
7
+ class ProjectVersions extends common_1.JiraConverter {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.destinationModels = [
11
+ 'tms_Release',
12
+ 'tms_ProjectReleaseRelationship',
13
+ ];
14
+ }
15
+ get dependencies() {
16
+ return [ProjectVersions.projectsStream];
17
+ }
18
+ async convert(record, ctx) {
19
+ const projectVersion = record.record.data;
20
+ const source = this.streamName.source;
21
+ const results = [
22
+ {
23
+ model: 'tms_Release',
24
+ record: {
25
+ uid: projectVersion.id,
26
+ name: projectVersion.name,
27
+ description: this.truncate(projectVersion.description),
28
+ startedAt: faros_feeds_sdk_1.Utils.toDate(projectVersion.startDate),
29
+ releasedAt: faros_feeds_sdk_1.Utils.toDate(projectVersion.releaseDate),
30
+ source,
31
+ },
32
+ },
33
+ ];
34
+ const project = ctx.get(ProjectVersions.projectsStream.asString, String(projectVersion.projectId));
35
+ if (project) {
36
+ results.push({
37
+ model: 'tms_ProjectReleaseRelationship',
38
+ record: {
39
+ project: { uid: project.record.data.key, source },
40
+ release: { uid: projectVersion.id, source },
41
+ },
42
+ });
43
+ }
44
+ return results;
45
+ }
46
+ }
47
+ exports.ProjectVersions = ProjectVersions;
48
+ ProjectVersions.projectsStream = new converter_1.StreamName('jira', 'projects');
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { JiraConverter } from './common';
4
+ export declare class Projects extends JiraConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Projects = void 0;
4
+ const common_1 = require("./common");
5
+ class Projects extends common_1.JiraConverter {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.destinationModels = [
9
+ 'tms_Project',
10
+ 'tms_TaskBoard',
11
+ 'tms_TaskBoardProjectRelationship',
12
+ ];
13
+ }
14
+ async convert(record, ctx) {
15
+ const project = record.record.data;
16
+ const source = this.streamName.source;
17
+ const uid = project.key;
18
+ const results = [];
19
+ results.push({
20
+ model: 'tms_Project',
21
+ record: {
22
+ uid,
23
+ name: project.name,
24
+ description: this.truncate(ctx, project.description),
25
+ source,
26
+ },
27
+ });
28
+ if (!this.useBoardOwnership(ctx)) {
29
+ results.push({
30
+ model: 'tms_TaskBoard',
31
+ record: { uid, name: project.name, source },
32
+ }, {
33
+ model: 'tms_TaskBoardProjectRelationship',
34
+ record: { board: { uid, source }, project: { uid, source } },
35
+ });
36
+ }
37
+ return results;
38
+ }
39
+ }
40
+ exports.Projects = Projects;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { JiraConverter } from './common';
4
+ export declare class PullRequests extends JiraConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PullRequests = void 0;
4
+ const common_1 = require("./common");
5
+ // Required as dependency by Issues converter
6
+ class PullRequests extends common_1.JiraConverter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.destinationModels = [];
10
+ }
11
+ async convert(record, ctx) {
12
+ return [];
13
+ }
14
+ }
15
+ exports.PullRequests = PullRequests;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { JiraConverter } from './common';
4
+ export declare class SprintIssues extends JiraConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SprintIssues = void 0;
4
+ const common_1 = require("./common");
5
+ // Required as dependency Sprints converter
6
+ class SprintIssues extends common_1.JiraConverter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.destinationModels = [];
10
+ }
11
+ async convert(record, ctx) {
12
+ return [];
13
+ }
14
+ }
15
+ exports.SprintIssues = SprintIssues;
@@ -0,0 +1,16 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
3
+ import { JiraConverter } from './common';
4
+ export declare class Sprints extends JiraConverter {
5
+ private logger;
6
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
7
+ private static readonly issueFieldsStream;
8
+ private static readonly sprintIssuesStream;
9
+ private pointsFieldIdsByName?;
10
+ private sprintIssueRecords?;
11
+ get dependencies(): ReadonlyArray<StreamName>;
12
+ private static getFieldIdsByName;
13
+ private static getSprintIssueRecords;
14
+ private getPoints;
15
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
16
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sprints = void 0;
4
+ const faros_airbyte_cdk_1 = require("faros-airbyte-cdk");
5
+ const faros_feeds_sdk_1 = require("faros-feeds-sdk");
6
+ const lodash_1 = require("lodash");
7
+ const converter_1 = require("../converter");
8
+ const common_1 = require("./common");
9
+ class Sprints extends common_1.JiraConverter {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.logger = new faros_airbyte_cdk_1.AirbyteLogger();
13
+ this.destinationModels = ['tms_Sprint'];
14
+ }
15
+ get dependencies() {
16
+ return [Sprints.issueFieldsStream, Sprints.sprintIssuesStream];
17
+ }
18
+ static getFieldIdsByName(ctx) {
19
+ const records = ctx.getAll(Sprints.issueFieldsStream.asString);
20
+ return (0, lodash_1.invertBy)((0, lodash_1.pickBy)((0, lodash_1.mapValues)(records, (r) => r.record.data.name), (name) => common_1.JiraCommon.POINTS_FIELD_NAMES.includes(name)));
21
+ }
22
+ static getSprintIssueRecords(ctx) {
23
+ const records = ctx.getAll(Sprints.sprintIssuesStream.asString);
24
+ return (0, lodash_1.groupBy)(Object.values(records).map((r) => r.record.data), (si) => si.sprintId);
25
+ }
26
+ getPoints(issue) {
27
+ var _a;
28
+ let points = 0;
29
+ for (const fieldName of common_1.JiraCommon.POINTS_FIELD_NAMES) {
30
+ const fieldIds = (_a = this.pointsFieldIdsByName[fieldName]) !== null && _a !== void 0 ? _a : [];
31
+ for (const fieldId of fieldIds) {
32
+ const pointsString = issue.fields[fieldId];
33
+ if (!pointsString)
34
+ continue;
35
+ try {
36
+ points = faros_feeds_sdk_1.Utils.parseFloatFixedPoint(pointsString);
37
+ }
38
+ catch (err) {
39
+ this.logger.warn(`Failed to get story points for issue ${issue.key}: ${err.message}`);
40
+ }
41
+ return points;
42
+ }
43
+ }
44
+ return points;
45
+ }
46
+ async convert(record, ctx) {
47
+ var _a, _b, _c;
48
+ const sprint = record.record.data;
49
+ if (!this.pointsFieldIdsByName) {
50
+ this.pointsFieldIdsByName = Sprints.getFieldIdsByName(ctx);
51
+ }
52
+ if (!this.sprintIssueRecords) {
53
+ this.sprintIssueRecords = Sprints.getSprintIssueRecords(ctx);
54
+ }
55
+ let completedPoints = 0;
56
+ for (const issue of (_a = this.sprintIssueRecords[sprint.id]) !== null && _a !== void 0 ? _a : []) {
57
+ const status = (_c = (_b = issue.fields.status) === null || _b === void 0 ? void 0 : _b.statusCategory) === null || _c === void 0 ? void 0 : _c.name;
58
+ if (status && common_1.JiraCommon.normalize(status) === 'done') {
59
+ completedPoints += this.getPoints(issue);
60
+ }
61
+ }
62
+ return [
63
+ {
64
+ model: 'tms_Sprint',
65
+ record: {
66
+ uid: String(sprint.id),
67
+ name: sprint.name,
68
+ state: (0, lodash_1.upperFirst)((0, lodash_1.camelCase)(sprint.state)),
69
+ completedPoints,
70
+ startedAt: faros_feeds_sdk_1.Utils.toDate(sprint.startDate),
71
+ endedAt: faros_feeds_sdk_1.Utils.toDate(sprint.endDate),
72
+ source: this.streamName.source,
73
+ },
74
+ },
75
+ ];
76
+ }
77
+ }
78
+ exports.Sprints = Sprints;
79
+ Sprints.issueFieldsStream = new converter_1.StreamName('jira', 'issue_fields');
80
+ Sprints.sprintIssuesStream = new converter_1.StreamName('jira', 'sprint_issues');
@@ -0,0 +1,8 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { JiraConverter } from './common';
4
+ export declare class Users extends JiraConverter {
5
+ private logger;
6
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
7
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
8
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Users = void 0;
4
+ const faros_airbyte_cdk_1 = require("faros-airbyte-cdk");
5
+ const common_1 = require("./common");
6
+ class Users extends common_1.JiraConverter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.logger = new faros_airbyte_cdk_1.AirbyteLogger();
10
+ this.destinationModels = ['tms_User'];
11
+ }
12
+ async convert(record, ctx) {
13
+ var _a;
14
+ const user = record.record.data;
15
+ const uid = (_a = user.accountId) !== null && _a !== void 0 ? _a : user.name;
16
+ if (!uid) {
17
+ this.logger.warn(`Skipping user. User has no accountId or name defined: ${JSON.stringify(user)}`);
18
+ return [];
19
+ }
20
+ return [
21
+ {
22
+ model: 'tms_User',
23
+ record: {
24
+ uid,
25
+ name: user.displayName,
26
+ emailAddress: user.emailAddress,
27
+ source: this.streamName.source,
28
+ },
29
+ },
30
+ ];
31
+ }
32
+ }
33
+ exports.Users = Users;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { JiraConverter } from './common';
4
+ export declare class WorkflowStatuses extends JiraConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkflowStatuses = void 0;
4
+ const common_1 = require("./common");
5
+ // Required as dependency by Issues converter
6
+ class WorkflowStatuses extends common_1.JiraConverter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.destinationModels = [];
10
+ }
11
+ async convert(record, ctx) {
12
+ return [];
13
+ }
14
+ }
15
+ exports.WorkflowStatuses = WorkflowStatuses;
@@ -0,0 +1,17 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import jsonata from 'jsonata';
3
+ import { Converter, DestinationModel, DestinationRecord, StreamContext } from './converter';
4
+ /** Record converter to convert records using provided JSONata expression */
5
+ export declare class JSONataConverter extends Converter {
6
+ private readonly jsonataExpr;
7
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
8
+ source: string;
9
+ constructor(jsonataExpr: jsonata.Expression, destinationModels: ReadonlyArray<DestinationModel>);
10
+ id(record: AirbyteRecord): any;
11
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
12
+ static make(expression: string, destinationModels: ReadonlyArray<DestinationModel>): JSONataConverter;
13
+ }
14
+ export declare enum JSONataApplyMode {
15
+ FALLBACK = "FALLBACK",
16
+ OVERRIDE = "OVERRIDE"
17
+ }
@@ -0,0 +1,47 @@
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.JSONataApplyMode = exports.JSONataConverter = void 0;
7
+ const jsonata_1 = __importDefault(require("jsonata"));
8
+ const verror_1 = require("verror");
9
+ const converter_1 = require("./converter");
10
+ /** Record converter to convert records using provided JSONata expression */
11
+ class JSONataConverter extends converter_1.Converter {
12
+ constructor(jsonataExpr, destinationModels) {
13
+ super();
14
+ this.jsonataExpr = jsonataExpr;
15
+ this.destinationModels = destinationModels;
16
+ this.source = 'JSONata';
17
+ }
18
+ id(record) {
19
+ return undefined;
20
+ }
21
+ async convert(record, ctx) {
22
+ const res = this.jsonataExpr.evaluate(record.record);
23
+ if (!res)
24
+ return [];
25
+ if (!Array.isArray(res))
26
+ return [res];
27
+ return res;
28
+ }
29
+ static make(expression, destinationModels) {
30
+ if (!Array.isArray(destinationModels) || !destinationModels.length) {
31
+ throw new verror_1.VError('Destination models cannot be empty');
32
+ }
33
+ try {
34
+ const jsonataExpr = (0, jsonata_1.default)(expression);
35
+ return new JSONataConverter(jsonataExpr, destinationModels);
36
+ }
37
+ catch (error) {
38
+ throw new verror_1.VError(error, 'Failed to parse JSONata expression: %s (code: %s, position: %s, token: %s)', error.message, error.code, error.position, error.token);
39
+ }
40
+ }
41
+ }
42
+ exports.JSONataConverter = JSONataConverter;
43
+ var JSONataApplyMode;
44
+ (function (JSONataApplyMode) {
45
+ JSONataApplyMode["FALLBACK"] = "FALLBACK";
46
+ JSONataApplyMode["OVERRIDE"] = "OVERRIDE";
47
+ })(JSONataApplyMode = exports.JSONataApplyMode || (exports.JSONataApplyMode = {}));
@@ -0,0 +1,8 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { Converter } from '../converter';
3
+ /** Okta converter base */
4
+ export declare abstract class OktaConverter extends Converter {
5
+ source: string;
6
+ /** Almost every Okta record have id property */
7
+ id(record: AirbyteRecord): any;
8
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OktaConverter = void 0;
4
+ const converter_1 = require("../converter");
5
+ /** Okta converter base */
6
+ class OktaConverter extends converter_1.Converter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.source = 'Okta';
10
+ }
11
+ /** Almost every Okta record have id property */
12
+ id(record) {
13
+ var _a, _b;
14
+ 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;
15
+ }
16
+ }
17
+ exports.OktaConverter = OktaConverter;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { OktaConverter } from './common';
4
+ export declare class Groups extends OktaConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Groups = void 0;
4
+ const common_1 = require("./common");
5
+ class Groups extends common_1.OktaConverter {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.destinationModels = [
9
+ 'org_Team',
10
+ 'org_TeamMembership',
11
+ ];
12
+ }
13
+ async convert(record, ctx) {
14
+ var _a, _b, _c;
15
+ const source = this.streamName.source;
16
+ const group = record.record.data;
17
+ const res = [];
18
+ const profile = group.profile;
19
+ const uid = group.id;
20
+ res.push({
21
+ model: 'org_Team',
22
+ record: {
23
+ uid,
24
+ name: (_a = profile.name) !== null && _a !== void 0 ? _a : null,
25
+ description: (_b = profile.description) !== null && _b !== void 0 ? _b : null,
26
+ lead: null,
27
+ parentTeam: { uid: 'all_teams' },
28
+ teamChain: ['all_teams'],
29
+ tags: null,
30
+ color: null,
31
+ photoUrl: null,
32
+ source,
33
+ },
34
+ });
35
+ for (const userId of (_c = group === null || group === void 0 ? void 0 : group.usersOfGroup) !== null && _c !== void 0 ? _c : []) {
36
+ res.push({
37
+ model: 'org_TeamMembership',
38
+ record: {
39
+ team: { uid },
40
+ member: { uid: userId },
41
+ },
42
+ });
43
+ }
44
+ return res;
45
+ }
46
+ }
47
+ exports.Groups = Groups;
@@ -0,0 +1,102 @@
1
+ interface Type {
2
+ id: string;
3
+ }
4
+ interface Profile {
5
+ profileUrl?: string;
6
+ lastName: string;
7
+ zipCode?: string;
8
+ preferredLanguage?: string;
9
+ manager?: string;
10
+ managerId?: string;
11
+ city?: string;
12
+ displayName?: string;
13
+ nickName?: string;
14
+ secondEmail?: string;
15
+ honorificPrefix?: string;
16
+ title?: string;
17
+ locale?: string;
18
+ login?: string;
19
+ honorificSuffix?: string;
20
+ firstName?: string;
21
+ primaryPhone?: string;
22
+ postalAddress?: string;
23
+ mobilePhone?: string;
24
+ streetAddress?: string;
25
+ countryCode?: string;
26
+ middleName?: string;
27
+ state?: string;
28
+ department?: string;
29
+ email?: string;
30
+ userType?: string;
31
+ startDate?: string;
32
+ }
33
+ interface Email {
34
+ value: string;
35
+ status: string;
36
+ type: string;
37
+ }
38
+ interface Provider {
39
+ type: string;
40
+ name: string;
41
+ }
42
+ interface Credentials {
43
+ password?: string;
44
+ emails: Email[];
45
+ provider: Provider;
46
+ }
47
+ interface Self {
48
+ href: string;
49
+ }
50
+ interface Links {
51
+ self: Self;
52
+ }
53
+ export interface User {
54
+ id: string;
55
+ status: string;
56
+ created: string;
57
+ activated?: any;
58
+ statusChanged: string;
59
+ lastLogin: string;
60
+ lastUpdated: string;
61
+ passwordChanged: string;
62
+ type: Type;
63
+ profile: Profile;
64
+ credentials: Credentials;
65
+ _links: Links;
66
+ }
67
+ export interface GroupProfile {
68
+ name: string;
69
+ description?: any;
70
+ }
71
+ export interface Logo {
72
+ name: string;
73
+ href: string;
74
+ type: string;
75
+ }
76
+ export interface Users {
77
+ href: string;
78
+ }
79
+ export interface Apps {
80
+ href: string;
81
+ }
82
+ export interface GroupLinks {
83
+ logo: Logo[];
84
+ users: Users;
85
+ apps: Apps;
86
+ }
87
+ export interface UserOfGroup {
88
+ id: string;
89
+ }
90
+ export interface Group {
91
+ item: any;
92
+ id: string;
93
+ created: string;
94
+ lastUpdated: string;
95
+ lastMembershipUpdated: string;
96
+ objectClass: string[];
97
+ type: string;
98
+ profile: GroupProfile;
99
+ _links: GroupLinks;
100
+ usersOfGroup: string[];
101
+ }
102
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { OktaConverter } from './common';
4
+ export declare class Users extends OktaConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ private seenDepartments;
7
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
8
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Users = 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 Users extends common_1.OktaConverter {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.destinationModels = [
11
+ 'identity_Identity',
12
+ 'org_Department',
13
+ 'org_Employee',
14
+ ];
15
+ this.seenDepartments = new Set();
16
+ }
17
+ async convert(record, ctx) {
18
+ var _a, _b, _c, _d;
19
+ const source = this.streamName.source;
20
+ const user = record.record.data;
21
+ const profile = user.profile;
22
+ const uid = user.id;
23
+ const res = [];
24
+ const fullName = [profile.firstName, profile.middleName, profile.lastName]
25
+ .filter((x) => x)
26
+ .join(' ');
27
+ const joinedAt = (_b = (_a = faros_feeds_sdk_1.Utils.toDate(profile.startDate)) !== null && _a !== void 0 ? _a : faros_feeds_sdk_1.Utils.toDate(user.created)) !== null && _b !== void 0 ? _b : null;
28
+ const departments = (0, lodash_1.sortBy)(Object.entries(profile).filter(([k, v]) => k.toLowerCase().includes('department')), ([k, v]) => k).map(([k, v]) => v);
29
+ const department = (_d = (_c = (departments.length > 0 ? departments[0] : null)) !== null && _c !== void 0 ? _c : profile.department) !== null && _d !== void 0 ? _d : null;
30
+ if (!this.seenDepartments.has(department)) {
31
+ this.seenDepartments.add(department);
32
+ res.push({
33
+ model: 'org_Department',
34
+ record: {
35
+ uid: department,
36
+ name: department,
37
+ description: null,
38
+ },
39
+ });
40
+ }
41
+ res.push({
42
+ model: 'identity_Identity',
43
+ record: {
44
+ uid,
45
+ firstName: profile.firstName,
46
+ lastName: profile.lastName,
47
+ fullName,
48
+ photoUrl: null,
49
+ primaryEmail: profile.email,
50
+ emails: [profile.email],
51
+ createdAt: null,
52
+ updatedAt: null,
53
+ },
54
+ }, {
55
+ model: 'org_Employee',
56
+ record: {
57
+ uid,
58
+ title: profile.title,
59
+ level: null,
60
+ joinedAt,
61
+ terminatedAt: null,
62
+ department: { uid: department },
63
+ identity: { uid, source },
64
+ manager: profile.manager ? { uid: profile.manager, source } : null,
65
+ reportingChain: null,
66
+ location: null,
67
+ source,
68
+ },
69
+ });
70
+ return res;
71
+ }
72
+ }
73
+ exports.Users = Users;
@@ -0,0 +1,4 @@
1
+ import { Converter } from '../converter';
2
+ export declare abstract class OktaFarosConverter extends Converter {
3
+ source: string;
4
+ }