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,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Issues = void 0;
4
+ const faros_feeds_sdk_1 = require("faros-feeds-sdk");
5
+ const common_1 = require("./common");
6
+ class Issues extends common_1.BacklogConverter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.destinationModels = [
10
+ 'tms_Label',
11
+ 'tms_Task',
12
+ 'tms_TaskAssignment',
13
+ 'tms_TaskBoardRelationship',
14
+ 'tms_TaskDependency',
15
+ 'tms_TaskProjectRelationship',
16
+ 'tms_TaskTag',
17
+ ];
18
+ }
19
+ async convert(record, ctx) {
20
+ var _a, _b, _c, _d, _e, _f;
21
+ const source = this.streamName.source;
22
+ const issue = record.record.data;
23
+ const res = [];
24
+ const maxDescriptionLength = this.maxDescriptionLength(ctx);
25
+ const taskKey = { uid: String(issue.id), source };
26
+ const statusChangelog = [];
27
+ const additionalFields = [];
28
+ let statusChangedAt = undefined;
29
+ for (const comment of (_a = issue.comments) !== null && _a !== void 0 ? _a : []) {
30
+ for (const changeLog of (_b = comment.changeLog) !== null && _b !== void 0 ? _b : []) {
31
+ if (changeLog.field === 'status' && changeLog.newValue) {
32
+ if (!statusChangedAt) {
33
+ statusChangedAt = faros_feeds_sdk_1.Utils.toDate(comment.created);
34
+ }
35
+ statusChangelog.push({
36
+ status: common_1.BacklogCommon.getTaskStatus(changeLog.newValue),
37
+ changedAt: faros_feeds_sdk_1.Utils.toDate(comment.created),
38
+ });
39
+ }
40
+ else if (changeLog.field === 'assigner' && changeLog.newValue) {
41
+ let assignUserId = 0;
42
+ for (const notification of (_c = comment.notifications) !== null && _c !== void 0 ? _c : []) {
43
+ if (notification.user.name === changeLog.newValue) {
44
+ assignUserId = notification.user.id;
45
+ break;
46
+ }
47
+ }
48
+ res.push({
49
+ model: 'tms_TaskAssignment',
50
+ record: {
51
+ task: taskKey,
52
+ assignee: { uid: String(assignUserId), source },
53
+ assignedAt: faros_feeds_sdk_1.Utils.toDate(comment.created),
54
+ },
55
+ });
56
+ }
57
+ }
58
+ }
59
+ for (const additionalField of (_d = issue.customFields) !== null && _d !== void 0 ? _d : []) {
60
+ additionalFields.push({
61
+ name: additionalField.name,
62
+ value: additionalField.value,
63
+ });
64
+ }
65
+ const status = common_1.BacklogCommon.getTaskStatus(issue.status.name);
66
+ res.push({
67
+ model: 'tms_Task',
68
+ record: {
69
+ ...taskKey,
70
+ name: issue.summary,
71
+ description: (_e = issue.description) === null || _e === void 0 ? void 0 : _e.substring(0, maxDescriptionLength),
72
+ priority: (_f = issue.priority) === null || _f === void 0 ? void 0 : _f.name,
73
+ type: common_1.BacklogCommon.getTaskType(issue.issueType),
74
+ status,
75
+ additionalFields,
76
+ createdAt: faros_feeds_sdk_1.Utils.toDate(issue.created),
77
+ updatedAt: faros_feeds_sdk_1.Utils.toDate(issue.updated),
78
+ statusChangedAt,
79
+ statusChangelog,
80
+ parent: issue.parentIssueId
81
+ ? { uid: String(issue.parentIssueId), source }
82
+ : undefined,
83
+ creator: issue.createdUser
84
+ ? { uid: String(issue.createdUser.id), source }
85
+ : undefined,
86
+ sprint: issue.milestone.length
87
+ ? { uid: String(issue.milestone[0].id), source }
88
+ : undefined,
89
+ },
90
+ });
91
+ const projectRef = { uid: String(issue.projectId), source };
92
+ res.push({
93
+ model: 'tms_TaskProjectRelationship',
94
+ record: {
95
+ task: taskKey,
96
+ project: projectRef,
97
+ },
98
+ });
99
+ res.push({
100
+ model: 'tms_TaskBoardRelationship',
101
+ record: {
102
+ task: taskKey,
103
+ board: projectRef,
104
+ },
105
+ });
106
+ if (issue.parentIssueId) {
107
+ res.push({
108
+ model: 'tms_TaskDependency',
109
+ record: {
110
+ dependentTask: { uid: String(issue.parentIssueId), source },
111
+ fulfillingTask: { uid: String(issue.id), source },
112
+ blocking: false,
113
+ },
114
+ });
115
+ }
116
+ return res;
117
+ }
118
+ }
119
+ exports.Issues = Issues;
@@ -0,0 +1,156 @@
1
+ interface CommonKey {
2
+ id: number;
3
+ name: string;
4
+ }
5
+ export interface Project extends CommonKey {
6
+ projectKey: string;
7
+ chartEnabled: boolean;
8
+ subtaskingEnabled: boolean;
9
+ projectLeaderCanEditProjectLeader: boolean;
10
+ useWikiTreeView: boolean;
11
+ textFormattingRule: string;
12
+ archived: boolean;
13
+ displayOrder: number;
14
+ useDevAttributes: boolean;
15
+ versionMilestones: VersionMilestone[];
16
+ }
17
+ export interface IssueType extends CommonKey {
18
+ projectId: number;
19
+ color: string;
20
+ displayOrder: number;
21
+ }
22
+ interface Status extends CommonKey {
23
+ projectId: number;
24
+ color: string;
25
+ displayOrder: number;
26
+ }
27
+ interface NulabAccount {
28
+ nulabId: string;
29
+ name: string;
30
+ uniqueId?: string;
31
+ }
32
+ export interface User extends CommonKey {
33
+ userId: string;
34
+ roleType: number;
35
+ lang: string;
36
+ mailAddress: string;
37
+ nulabAccount?: NulabAccount;
38
+ keyword: string;
39
+ }
40
+ interface Category extends CommonKey {
41
+ displayOrder: number;
42
+ }
43
+ export interface VersionMilestone extends CommonKey {
44
+ projectId: number;
45
+ description?: string;
46
+ startDate?: string;
47
+ releaseDueDate?: string;
48
+ archived: boolean;
49
+ displayOrder: number;
50
+ }
51
+ interface Attachment extends CommonKey {
52
+ size: number;
53
+ createdUser: User;
54
+ created: string;
55
+ }
56
+ interface Star {
57
+ id: number;
58
+ comment?: string;
59
+ url: string;
60
+ title: string;
61
+ presenter: User;
62
+ created: string;
63
+ }
64
+ interface ChangeLog {
65
+ field: string;
66
+ newValue?: string;
67
+ originalValue?: string;
68
+ attachmentInfo?: CommonKey;
69
+ attributeInfo?: any;
70
+ notificationInfo?: any;
71
+ }
72
+ export interface customFields {
73
+ name: string;
74
+ value: string;
75
+ }
76
+ export interface Notification {
77
+ id: number;
78
+ alreadyRead: boolean;
79
+ reason: number;
80
+ user: User;
81
+ resourceAlreadyRead: boolean;
82
+ }
83
+ export interface Comment {
84
+ id: number;
85
+ content?: string;
86
+ changeLog: ChangeLog[];
87
+ createdUser: User;
88
+ created: string;
89
+ updated: string;
90
+ stars: Star[];
91
+ notifications: Notification[];
92
+ }
93
+ export interface Issue {
94
+ id: number;
95
+ projectId: number;
96
+ issueKey: string;
97
+ keyId: number;
98
+ issueType: IssueType;
99
+ summary: string;
100
+ description?: string;
101
+ resolution?: CommonKey;
102
+ priority?: CommonKey;
103
+ status: Status;
104
+ assignee?: User;
105
+ category: Category[];
106
+ versions: VersionMilestone[];
107
+ milestone: VersionMilestone[];
108
+ startDate?: string;
109
+ dueDate?: string;
110
+ estimatedHours?: number;
111
+ actualHours?: number;
112
+ parentIssueId?: number;
113
+ createdUser: User;
114
+ created: string;
115
+ updatedUser: User;
116
+ updated: string;
117
+ customFields: customFields[];
118
+ attachments: Attachment[];
119
+ sharedFiles: any;
120
+ stars: Star[];
121
+ comments: Comment[];
122
+ }
123
+ export interface TaskType {
124
+ category: string;
125
+ detail?: string;
126
+ }
127
+ export declare enum TaskCategory {
128
+ Bug = "Bug",
129
+ Custom = "Custom",
130
+ Story = "Story",
131
+ Task = "Task"
132
+ }
133
+ export declare enum TaskStatusCategory {
134
+ Done = "Done",
135
+ InProgress = "InProgress",
136
+ Todo = "Todo"
137
+ }
138
+ export interface TaskStatus {
139
+ category: TaskStatusCategory;
140
+ detail: string;
141
+ }
142
+ export interface TaskStatusChange {
143
+ status: TaskStatus;
144
+ changedAt: Date;
145
+ }
146
+ export interface TaskField {
147
+ name: string;
148
+ value: string;
149
+ }
150
+ export declare enum SprintState {
151
+ Active = "Active",
152
+ Closed = "Closed",
153
+ Future = "Future",
154
+ Default = "Default"
155
+ }
156
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SprintState = exports.TaskStatusCategory = exports.TaskCategory = void 0;
4
+ var TaskCategory;
5
+ (function (TaskCategory) {
6
+ TaskCategory["Bug"] = "Bug";
7
+ TaskCategory["Custom"] = "Custom";
8
+ TaskCategory["Story"] = "Story";
9
+ TaskCategory["Task"] = "Task";
10
+ })(TaskCategory = exports.TaskCategory || (exports.TaskCategory = {}));
11
+ var TaskStatusCategory;
12
+ (function (TaskStatusCategory) {
13
+ TaskStatusCategory["Done"] = "Done";
14
+ TaskStatusCategory["InProgress"] = "InProgress";
15
+ TaskStatusCategory["Todo"] = "Todo";
16
+ })(TaskStatusCategory = exports.TaskStatusCategory || (exports.TaskStatusCategory = {}));
17
+ var SprintState;
18
+ (function (SprintState) {
19
+ SprintState["Active"] = "Active";
20
+ SprintState["Closed"] = "Closed";
21
+ SprintState["Future"] = "Future";
22
+ SprintState["Default"] = "Default";
23
+ })(SprintState = exports.SprintState || (exports.SprintState = {}));
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { BacklogConverter } from './common';
4
+ export declare class Projects extends BacklogConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Projects = void 0;
4
+ const faros_feeds_sdk_1 = require("faros-feeds-sdk");
5
+ const common_1 = require("./common");
6
+ class Projects extends common_1.BacklogConverter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.destinationModels = [
10
+ 'tms_Project',
11
+ 'tms_Release',
12
+ 'tms_Sprint',
13
+ 'tms_TaskBoard',
14
+ 'tms_TaskBoardProjectRelationship',
15
+ ];
16
+ }
17
+ async convert(record, ctx) {
18
+ var _a, _b;
19
+ const source = this.streamName.source;
20
+ const project = record.record.data;
21
+ const uid = String(project.id);
22
+ const res = [];
23
+ const maxDescriptionLength = this.maxDescriptionLength(ctx);
24
+ res.push({
25
+ model: 'tms_Project',
26
+ record: {
27
+ uid,
28
+ name: project.name,
29
+ description: null,
30
+ source,
31
+ },
32
+ });
33
+ res.push({
34
+ model: 'tms_TaskBoard',
35
+ record: {
36
+ uid,
37
+ name: project.name,
38
+ source,
39
+ },
40
+ });
41
+ res.push({
42
+ model: 'tms_TaskBoardProjectRelationship',
43
+ record: {
44
+ board: { uid, source },
45
+ project: { uid, source },
46
+ },
47
+ });
48
+ for (const versionMilestone of project.versionMilestones) {
49
+ res.push({
50
+ model: 'tms_Sprint',
51
+ record: {
52
+ uid: String(versionMilestone.id),
53
+ name: versionMilestone.name,
54
+ description: (_a = versionMilestone.description) === null || _a === void 0 ? void 0 : _a.substring(0, maxDescriptionLength),
55
+ startedAt: faros_feeds_sdk_1.Utils.toDate(versionMilestone.startDate),
56
+ endedAt: faros_feeds_sdk_1.Utils.toDate(versionMilestone.releaseDueDate),
57
+ state: common_1.BacklogCommon.getSprintState(versionMilestone),
58
+ source,
59
+ },
60
+ });
61
+ if (versionMilestone.releaseDueDate) {
62
+ res.push({
63
+ model: 'tms_Release',
64
+ record: {
65
+ uid: String(versionMilestone.id),
66
+ name: versionMilestone.name,
67
+ description: (_b = versionMilestone.description) === null || _b === void 0 ? void 0 : _b.substring(0, maxDescriptionLength),
68
+ startedAt: faros_feeds_sdk_1.Utils.toDate(versionMilestone.startDate),
69
+ releasedAt: faros_feeds_sdk_1.Utils.toDate(versionMilestone.releaseDueDate),
70
+ source,
71
+ },
72
+ });
73
+ }
74
+ }
75
+ return res;
76
+ }
77
+ }
78
+ exports.Projects = Projects;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { BacklogConverter } from './common';
4
+ export declare class Users extends BacklogConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Users = void 0;
4
+ const common_1 = require("./common");
5
+ class Users extends common_1.BacklogConverter {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.destinationModels = ['tms_User'];
9
+ }
10
+ async convert(record, ctx) {
11
+ const source = this.streamName.source;
12
+ const user = record.record.data;
13
+ return [
14
+ {
15
+ model: 'tms_User',
16
+ record: {
17
+ uid: String(user.id),
18
+ name: user.name,
19
+ emailAddress: user.mailAddress,
20
+ source,
21
+ },
22
+ },
23
+ ];
24
+ }
25
+ }
26
+ exports.Users = Users;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { BitbucketConverter } from './common';
4
+ export declare class Branches extends BitbucketConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Branches = void 0;
4
+ const common_1 = require("./common");
5
+ class Branches extends common_1.BitbucketConverter {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.destinationModels = ['vcs_Branch'];
9
+ }
10
+ async convert(record, ctx) {
11
+ const source = this.streamName.source;
12
+ const branch = record.record.data;
13
+ const [workspace, repo] = branch.target.repository.fullName.split('/');
14
+ if (!workspace || !repo)
15
+ return [];
16
+ return [
17
+ {
18
+ model: 'vcs_Branch',
19
+ record: {
20
+ name: branch.name,
21
+ uid: branch.name,
22
+ repository: {
23
+ organization: { uid: workspace.toLowerCase(), source },
24
+ name: repo.toLowerCase(),
25
+ },
26
+ },
27
+ },
28
+ ];
29
+ }
30
+ }
31
+ exports.Branches = Branches;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { BitbucketConverter } from './common';
4
+ export declare class Commits extends BitbucketConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Commits = void 0;
4
+ const faros_feeds_sdk_1 = require("faros-feeds-sdk");
5
+ const common_1 = require("./common");
6
+ class Commits extends common_1.BitbucketConverter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.destinationModels = [
10
+ 'vcs_Commit',
11
+ 'vcs_User',
12
+ ];
13
+ }
14
+ async convert(record, ctx) {
15
+ var _a, _b;
16
+ const source = this.streamName.source;
17
+ const commit = record.record.data;
18
+ const res = [];
19
+ const [workspace, repo] = commit.repository.fullName.split('/');
20
+ let author = null;
21
+ if ((_b = (_a = commit === null || commit === void 0 ? void 0 : commit.author) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.accountId) {
22
+ const commitUser = commit.author.user;
23
+ const user = common_1.BitbucketCommon.vcsUser(commitUser, source);
24
+ if (user) {
25
+ res.push(user);
26
+ author = { uid: commitUser.accountId, source };
27
+ }
28
+ }
29
+ if (!workspace || !repo) {
30
+ return res;
31
+ }
32
+ res.push({
33
+ model: 'vcs_Commit',
34
+ record: {
35
+ sha: commit.hash,
36
+ uid: commit.hash,
37
+ message: commit.message,
38
+ htmlUrl: commit.links.htmlUrl,
39
+ createdAt: faros_feeds_sdk_1.Utils.toDate(commit.date),
40
+ author,
41
+ repository: {
42
+ organization: { uid: workspace.toLowerCase(), source },
43
+ name: repo.toLowerCase(),
44
+ },
45
+ },
46
+ });
47
+ return res;
48
+ }
49
+ }
50
+ exports.Commits = Commits;
@@ -0,0 +1,28 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { Converter, DestinationRecord, StreamContext } from '../converter';
3
+ import { User } from './types';
4
+ interface BitbucketConfig {
5
+ application_mapping?: ApplicationMapping;
6
+ }
7
+ declare type ApplicationMapping = Record<string, {
8
+ name: string;
9
+ platform: string;
10
+ }>;
11
+ export interface CategoryRef {
12
+ readonly category: string;
13
+ readonly detail: string;
14
+ }
15
+ /** Common functions shares across Bitbucket converters */
16
+ export declare class BitbucketCommon {
17
+ static MAX_DESCRIPTION_LENGTH: number;
18
+ static vcsUser(user: User, source: string): DestinationRecord | undefined;
19
+ }
20
+ /** Bitbucket converter base */
21
+ export declare abstract class BitbucketConverter extends Converter {
22
+ source: string;
23
+ /** Almost all Bitbucket records should have id property */
24
+ id(record: AirbyteRecord): any;
25
+ protected bitbucketConfig(ctx: StreamContext): BitbucketConfig;
26
+ protected applicationMapping(ctx: StreamContext): ApplicationMapping;
27
+ }
28
+ export {};
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BitbucketConverter = exports.BitbucketCommon = void 0;
4
+ const converter_1 = require("../converter");
5
+ var UserTypeCategory;
6
+ (function (UserTypeCategory) {
7
+ UserTypeCategory["BOT"] = "Bot";
8
+ UserTypeCategory["ORGANIZATION"] = "Organization";
9
+ UserTypeCategory["USER"] = "User";
10
+ UserTypeCategory["CUSTOM"] = "Custom";
11
+ })(UserTypeCategory || (UserTypeCategory = {}));
12
+ /** Common functions shares across Bitbucket converters */
13
+ class BitbucketCommon {
14
+ static vcsUser(user, source) {
15
+ var _a;
16
+ if (!user.accountId)
17
+ return undefined;
18
+ const userType = user.type === 'user'
19
+ ? { category: UserTypeCategory.USER, detail: 'user' }
20
+ : { category: UserTypeCategory.CUSTOM, detail: user.type };
21
+ return {
22
+ model: 'vcs_User',
23
+ record: {
24
+ uid: user.accountId,
25
+ name: user.displayName,
26
+ type: userType,
27
+ htmlUrl: (_a = user.links) === null || _a === void 0 ? void 0 : _a.htmlUrl,
28
+ source,
29
+ },
30
+ };
31
+ }
32
+ }
33
+ exports.BitbucketCommon = BitbucketCommon;
34
+ // max length for free-form description text field
35
+ BitbucketCommon.MAX_DESCRIPTION_LENGTH = 1000;
36
+ /** Bitbucket converter base */
37
+ class BitbucketConverter extends converter_1.Converter {
38
+ constructor() {
39
+ super(...arguments);
40
+ this.source = 'Bitbucket';
41
+ }
42
+ /** Almost all Bitbucket records should have id property */
43
+ id(record) {
44
+ var _a, _b;
45
+ 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;
46
+ }
47
+ bitbucketConfig(ctx) {
48
+ var _a, _b;
49
+ return (_b = (_a = ctx.config) === null || _a === void 0 ? void 0 : _a.source_specific_configs) === null || _b === void 0 ? void 0 : _b.bitbucket;
50
+ }
51
+ applicationMapping(ctx) {
52
+ var _a, _b;
53
+ return ((_b = (0, converter_1.parseObjectConfig)((_a = this.bitbucketConfig(ctx)) === null || _a === void 0 ? void 0 : _a.application_mapping, 'Application Mapping')) !== null && _b !== void 0 ? _b : {});
54
+ }
55
+ }
56
+ exports.BitbucketConverter = BitbucketConverter;
@@ -0,0 +1,11 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
3
+ import { BitbucketConverter } from './common';
4
+ export declare class Deployments extends BitbucketConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ private readonly pipelinesStream;
7
+ get dependencies(): ReadonlyArray<StreamName>;
8
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
9
+ private convertEnvironment;
10
+ private convertDeploymentStatus;
11
+ }