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,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Works = void 0;
4
+ const common_1 = require("./common");
5
+ class Works extends common_1.AgileAcceleratorConverter {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.destinationModels = [
9
+ 'tms_Epic',
10
+ 'tms_Project',
11
+ 'tms_Sprint',
12
+ 'tms_Task',
13
+ 'tms_User',
14
+ ];
15
+ }
16
+ async convert(record, ctx) {
17
+ var _a, _b, _c;
18
+ const source = this.streamName.source;
19
+ const work = record.record.data;
20
+ const res = [];
21
+ const maxDescriptionLength = this.maxDescriptionLength(ctx);
22
+ let creatorRef = undefined;
23
+ let epicRef = undefined;
24
+ let sprintRef = undefined;
25
+ if (work.CreatedBy) {
26
+ creatorRef = { uid: work.CreatedBy.Id, source };
27
+ res.push({
28
+ model: 'tms_User',
29
+ record: {
30
+ ...creatorRef,
31
+ emailAddress: work.CreatedBy.Email,
32
+ name: work.CreatedBy.Name,
33
+ },
34
+ });
35
+ }
36
+ if (work.agf__Epic__r && work.agf__Epic__r.agf__Project__r) {
37
+ epicRef = { uid: work.agf__Epic__r.Id, source };
38
+ const projectRef = { uid: work.agf__Epic__r.agf__Project__r.Id, source };
39
+ res.push({
40
+ model: 'tms_Project',
41
+ record: {
42
+ ...projectRef,
43
+ name: work.agf__Epic__r.agf__Project__r.Name,
44
+ description: (_a = work.agf__Epic__r.agf__Project__r.agf__Project_Management_Notes__c) === null || _a === void 0 ? void 0 : _a.substring(0, maxDescriptionLength),
45
+ createdAt: common_1.AgileAcceleratorCommon.toDateTime(work.agf__Epic__r.agf__Project__r.CreatedDate),
46
+ updatedAt: common_1.AgileAcceleratorCommon.toDateTime(work.agf__Epic__r.agf__Project__r.LastModifiedDate),
47
+ },
48
+ });
49
+ res.push({
50
+ model: 'tms_Epic',
51
+ record: {
52
+ ...epicRef,
53
+ name: work.agf__Epic__r.Name,
54
+ description: (_b = work.agf__Epic__r.agf__Description__c) === null || _b === void 0 ? void 0 : _b.substring(0, maxDescriptionLength),
55
+ status: common_1.AgileAcceleratorCommon.toEpicStatus(work.agf__Epic__r.agf__Health__c),
56
+ project: projectRef,
57
+ },
58
+ });
59
+ }
60
+ if (work.agf__Sprint__r) {
61
+ sprintRef = { uid: work.agf__Sprint__r.Id, source };
62
+ res.push({
63
+ model: 'tms_Sprint',
64
+ record: {
65
+ ...sprintRef,
66
+ name: work.agf__Sprint__r.Name,
67
+ plannedPoints: work.agf__Sprint__r.agf__Committed_Points__c,
68
+ completedPoints: work.agf__Sprint__r.agf__Completed_Story_Points__c,
69
+ state: common_1.AgileAcceleratorCommon.toSprintState(work.agf__Sprint__r.agf__Days_Remaining__c),
70
+ startedAt: common_1.AgileAcceleratorCommon.toDateTime(work.agf__Sprint__r.agf__Start_Date__c),
71
+ endedAt: common_1.AgileAcceleratorCommon.toDateTime(work.agf__Sprint__r.agf__End_Date__c, false),
72
+ },
73
+ });
74
+ }
75
+ const additionalFields = [];
76
+ const workFieldNames = this.workAdditionalFields(ctx);
77
+ for (const fieldName of workFieldNames) {
78
+ const value = work[fieldName];
79
+ if (value) {
80
+ additionalFields.push(common_1.AgileAcceleratorCommon.toTaskField(fieldName, value));
81
+ }
82
+ }
83
+ const task = {
84
+ uid: work.Id,
85
+ name: work.Name,
86
+ description: (_c = work.agf__Description__c) === null || _c === void 0 ? void 0 : _c.substring(0, maxDescriptionLength),
87
+ url: work.baseUrl.concat(work.attributes.url),
88
+ type: common_1.AgileAcceleratorCommon.toType(work.agf__Type__c),
89
+ priority: work.agf__Priority__c,
90
+ status: common_1.AgileAcceleratorCommon.toStatus(work.agf__Status__c),
91
+ points: work.agf__Story_Points__c,
92
+ additionalFields,
93
+ createdAt: common_1.AgileAcceleratorCommon.toDateTime(work.CreatedDate),
94
+ updatedAt: common_1.AgileAcceleratorCommon.toDateTime(work.LastModifiedDate),
95
+ parent: { uid: work.agf__Parent_ID__c, source },
96
+ creator: creatorRef,
97
+ epic: epicRef,
98
+ sprint: sprintRef,
99
+ source,
100
+ };
101
+ res.push({ model: 'tms_Task', record: task });
102
+ return res;
103
+ }
104
+ }
105
+ exports.Works = Works;
@@ -0,0 +1,39 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk/src/protocol';
2
+ import { Converter, DestinationRecord } from '../converter';
3
+ export interface AsanaProject {
4
+ gid: string;
5
+ }
6
+ export interface AsanaSection {
7
+ gid: string;
8
+ name: string;
9
+ project?: AsanaProject;
10
+ }
11
+ export interface AsanaUser {
12
+ gid: string;
13
+ name?: string;
14
+ email?: string;
15
+ }
16
+ interface TmsTaskType {
17
+ category: TmsTaskCategory;
18
+ detail: string;
19
+ }
20
+ declare enum TmsTaskCategory {
21
+ Bug = "Bug",
22
+ Custom = "Custom",
23
+ Story = "Story",
24
+ Task = "Task"
25
+ }
26
+ /** Common functions shares across Asana converters */
27
+ export declare class AsanaCommon {
28
+ static readonly MAX_DESCRIPTION_LENGTH = 1000;
29
+ static toTmsTaskType(type: string): TmsTaskType;
30
+ static tms_User(user: AsanaUser, source: string): DestinationRecord;
31
+ static tms_TaskBoard(section: AsanaSection, source: string): DestinationRecord;
32
+ }
33
+ /** Asana converter base */
34
+ export declare abstract class AsanaConverter extends Converter {
35
+ source: string;
36
+ /** All Asana records should have id property */
37
+ id(record: AirbyteRecord): any;
38
+ }
39
+ export {};
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsanaConverter = exports.AsanaCommon = void 0;
4
+ const converter_1 = require("../converter");
5
+ var TmsTaskCategory;
6
+ (function (TmsTaskCategory) {
7
+ TmsTaskCategory["Bug"] = "Bug";
8
+ TmsTaskCategory["Custom"] = "Custom";
9
+ TmsTaskCategory["Story"] = "Story";
10
+ TmsTaskCategory["Task"] = "Task";
11
+ })(TmsTaskCategory || (TmsTaskCategory = {}));
12
+ /** Common functions shares across Asana converters */
13
+ class AsanaCommon {
14
+ static toTmsTaskType(type) {
15
+ const detail = type.toLowerCase();
16
+ switch (detail) {
17
+ case 'bug':
18
+ return { category: TmsTaskCategory.Bug, detail };
19
+ case 'story':
20
+ return { category: TmsTaskCategory.Story, detail };
21
+ case 'task':
22
+ return { category: TmsTaskCategory.Task, detail };
23
+ default:
24
+ return { category: TmsTaskCategory.Custom, detail };
25
+ }
26
+ }
27
+ static tms_User(user, source) {
28
+ return {
29
+ model: 'tms_User',
30
+ record: {
31
+ uid: user.gid,
32
+ name: user.name || null,
33
+ emailAddress: user.email || null,
34
+ source,
35
+ },
36
+ };
37
+ }
38
+ static tms_TaskBoard(section, source) {
39
+ return {
40
+ model: 'tms_TaskBoard',
41
+ record: {
42
+ uid: section.gid,
43
+ name: section.name,
44
+ source,
45
+ },
46
+ };
47
+ }
48
+ }
49
+ exports.AsanaCommon = AsanaCommon;
50
+ // Max length for free-form description text fields such as issue body
51
+ AsanaCommon.MAX_DESCRIPTION_LENGTH = 1000;
52
+ /** Asana converter base */
53
+ class AsanaConverter extends converter_1.Converter {
54
+ constructor() {
55
+ super(...arguments);
56
+ this.source = 'Asana';
57
+ }
58
+ /** All Asana records should have id property */
59
+ id(record) {
60
+ var _a, _b;
61
+ 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.gid;
62
+ }
63
+ }
64
+ exports.AsanaConverter = AsanaConverter;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { AsanaConverter } from './common';
4
+ export declare class Projects extends AsanaConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,29 @@
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.AsanaConverter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.destinationModels = ['tms_Project'];
10
+ }
11
+ async convert(record, ctx) {
12
+ var _a;
13
+ const source = this.streamName.source;
14
+ const project = record.record.data;
15
+ const tmsProject = {
16
+ model: 'tms_Project',
17
+ record: {
18
+ uid: project.gid,
19
+ name: project.name,
20
+ description: (_a = project.notes) === null || _a === void 0 ? void 0 : _a.substring(0, common_1.AsanaCommon.MAX_DESCRIPTION_LENGTH),
21
+ createdAt: faros_feeds_sdk_1.Utils.toDate(project.created_at),
22
+ updatedAt: faros_feeds_sdk_1.Utils.toDate(project.modified_at),
23
+ source,
24
+ },
25
+ };
26
+ return [tmsProject];
27
+ }
28
+ }
29
+ exports.Projects = Projects;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { AsanaConverter } from './common';
4
+ export declare class Sections extends AsanaConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sections = void 0;
4
+ const common_1 = require("./common");
5
+ class Sections extends common_1.AsanaConverter {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.destinationModels = [
9
+ 'tms_TaskBoard',
10
+ 'tms_TaskBoardProjectRelationship',
11
+ ];
12
+ }
13
+ async convert(record, ctx) {
14
+ const res = [];
15
+ const source = this.streamName.source;
16
+ const section = record.record.data;
17
+ res.push(common_1.AsanaCommon.tms_TaskBoard(section, source));
18
+ res.push({
19
+ model: 'tms_TaskBoardProjectRelationship',
20
+ record: {
21
+ board: { uid: section.gid, source },
22
+ project: section.project ? { uid: section.project.gid, source } : null,
23
+ },
24
+ });
25
+ return res;
26
+ }
27
+ }
28
+ exports.Sections = Sections;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { AsanaConverter } from './common';
4
+ export declare class Stories extends AsanaConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Stories = void 0;
4
+ const faros_feeds_sdk_1 = require("faros-feeds-sdk");
5
+ const common_1 = require("./common");
6
+ class Stories extends common_1.AsanaConverter {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.destinationModels = ['tms_Task'];
10
+ }
11
+ async convert(record, ctx) {
12
+ var _a;
13
+ const res = [];
14
+ const source = this.streamName.source;
15
+ const story = record.record.data;
16
+ res.push({
17
+ model: 'tms_Task',
18
+ record: {
19
+ uid: story.gid,
20
+ name: story.source || null,
21
+ description: (_a = story.text) === null || _a === void 0 ? void 0 : _a.substring(0, common_1.AsanaCommon.MAX_DESCRIPTION_LENGTH),
22
+ type: common_1.AsanaCommon.toTmsTaskType(story.resource_type),
23
+ createdAt: faros_feeds_sdk_1.Utils.toDate(story.created_at),
24
+ updatedAt: faros_feeds_sdk_1.Utils.toDate(story.created_at),
25
+ creator: { uid: story.created_by.gid, source },
26
+ source,
27
+ },
28
+ });
29
+ return res;
30
+ }
31
+ }
32
+ exports.Stories = Stories;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { AsanaConverter } from './common';
4
+ export declare class Tags extends AsanaConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tags = void 0;
4
+ const common_1 = require("./common");
5
+ class Tags extends common_1.AsanaConverter {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.destinationModels = ['tms_Label'];
9
+ }
10
+ async convert(record, ctx) {
11
+ const tag = record.record.data;
12
+ return [
13
+ {
14
+ model: 'tms_Label',
15
+ record: {
16
+ name: tag.name,
17
+ },
18
+ },
19
+ ];
20
+ }
21
+ }
22
+ exports.Tags = Tags;
@@ -0,0 +1,11 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { AsanaConverter } from './common';
4
+ export declare class Tasks extends AsanaConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ private tms_TaskBoardRelationship;
8
+ private findFieldByName;
9
+ private toTaskField;
10
+ private toTmsTaskStatus;
11
+ }
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tasks = void 0;
4
+ const faros_feeds_sdk_1 = require("faros-feeds-sdk");
5
+ const common_1 = require("./common");
6
+ var Tms_TaskStatusCategory;
7
+ (function (Tms_TaskStatusCategory) {
8
+ Tms_TaskStatusCategory["Custom"] = "Custom";
9
+ Tms_TaskStatusCategory["Done"] = "Done";
10
+ Tms_TaskStatusCategory["InProgress"] = "InProgress";
11
+ Tms_TaskStatusCategory["Todo"] = "Todo";
12
+ })(Tms_TaskStatusCategory || (Tms_TaskStatusCategory = {}));
13
+ class Tasks extends common_1.AsanaConverter {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.destinationModels = [
17
+ 'tms_Task',
18
+ 'tms_Project',
19
+ 'tms_TaskProjectRelationship',
20
+ 'tms_TaskBoard',
21
+ 'tms_TaskBoardRelationship',
22
+ 'tms_TaskDependency',
23
+ 'tms_TaskAssignment',
24
+ 'tms_Label',
25
+ 'tms_TaskTag',
26
+ ];
27
+ }
28
+ async convert(record, ctx) {
29
+ var _a, _b;
30
+ const res = [];
31
+ const source = this.streamName.source;
32
+ const task = record.record.data;
33
+ const taskKey = { uid: task.gid, source };
34
+ const status = this.findFieldByName(task.custom_fields, 'status');
35
+ const parent = task.parent ? { uid: task.parent.gid, source } : null;
36
+ const priority = this.findFieldByName(task.custom_fields, 'priority');
37
+ const points = this.findFieldByName(task.custom_fields, 'points');
38
+ res.push({
39
+ model: 'tms_Task',
40
+ record: {
41
+ ...taskKey,
42
+ name: task.name,
43
+ description: (_a = task.notes) === null || _a === void 0 ? void 0 : _a.substring(0, common_1.AsanaCommon.MAX_DESCRIPTION_LENGTH),
44
+ url: (_b = task.permalink_url) !== null && _b !== void 0 ? _b : null,
45
+ type: common_1.AsanaCommon.toTmsTaskType(task.resource_type),
46
+ priority: typeof priority === 'string' ? priority : null,
47
+ status: typeof status === 'string' ? this.toTmsTaskStatus(status) : null,
48
+ points: typeof points === 'number' ? points : null,
49
+ additionalFields: task.custom_fields.map((f) => this.toTaskField(f)),
50
+ createdAt: faros_feeds_sdk_1.Utils.toDate(task.created_at),
51
+ updatedAt: faros_feeds_sdk_1.Utils.toDate(task.modified_at),
52
+ statusChangedAt: faros_feeds_sdk_1.Utils.toDate(task.modified_at),
53
+ parent,
54
+ creator: task.assignee ? { uid: task.assignee, source } : null,
55
+ },
56
+ });
57
+ for (const membership of task.memberships) {
58
+ if (membership.project) {
59
+ res.push({
60
+ model: 'tms_Project',
61
+ record: {
62
+ uid: membership.project.gid,
63
+ name: membership.project.name,
64
+ source,
65
+ },
66
+ });
67
+ res.push({
68
+ model: 'tms_TaskProjectRelationship',
69
+ record: {
70
+ task: taskKey,
71
+ project: { uid: membership.project.gid, source },
72
+ },
73
+ });
74
+ }
75
+ if (membership.section) {
76
+ res.push(...this.tms_TaskBoardRelationship(taskKey.uid, membership.section, source));
77
+ }
78
+ }
79
+ if (task.assignee) {
80
+ res.push({
81
+ model: 'tms_TaskAssignment',
82
+ record: {
83
+ task: taskKey,
84
+ assignee: { uid: task.assignee, source },
85
+ },
86
+ });
87
+ }
88
+ if (parent) {
89
+ res.push({
90
+ model: 'tms_TaskDependency',
91
+ record: {
92
+ dependentTask: taskKey,
93
+ blocking: false,
94
+ fulfillingTask: parent,
95
+ },
96
+ });
97
+ }
98
+ if (task.assignee_section) {
99
+ res.push(...this.tms_TaskBoardRelationship(taskKey.uid, task.assignee_section, source));
100
+ }
101
+ for (const tag of task.tags) {
102
+ if (tag.gid) {
103
+ const label = { name: tag.name };
104
+ res.push({
105
+ model: 'tms_Label',
106
+ record: { name: label.name },
107
+ });
108
+ res.push({
109
+ model: 'tms_TaskTag',
110
+ record: {
111
+ label: { name: label.name },
112
+ task: taskKey,
113
+ },
114
+ });
115
+ }
116
+ }
117
+ return res;
118
+ }
119
+ tms_TaskBoardRelationship(taskId, section, source) {
120
+ const res = [];
121
+ res.push(common_1.AsanaCommon.tms_TaskBoard(section, source));
122
+ res.push({
123
+ model: 'tms_TaskBoardRelationship',
124
+ record: {
125
+ task: { uid: taskId, source },
126
+ board: { uid: section.gid, source },
127
+ },
128
+ });
129
+ return res;
130
+ }
131
+ findFieldByName(customFields, compareName) {
132
+ for (const f of customFields) {
133
+ const name = f.name.toLowerCase();
134
+ if (name === compareName) {
135
+ return this.toTaskField(f).value;
136
+ }
137
+ }
138
+ }
139
+ toTaskField(customField) {
140
+ var _a, _b, _c, _d, _e, _f;
141
+ return {
142
+ name: customField.name,
143
+ value: (_f = (_d = (_b = (_a = customField.text_value) !== null && _a !== void 0 ? _a : customField.number_value) !== null && _b !== void 0 ? _b : (_c = customField.enum_value) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : (_e = customField.multi_enum_values) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : customField.display_value,
144
+ };
145
+ }
146
+ toTmsTaskStatus(status) {
147
+ const detail = status.toLowerCase();
148
+ switch (detail) {
149
+ case 'done':
150
+ return { category: Tms_TaskStatusCategory.Done, detail };
151
+ case 'inprogress':
152
+ return { category: Tms_TaskStatusCategory.InProgress, detail };
153
+ case 'todo':
154
+ return { category: Tms_TaskStatusCategory.Todo, detail };
155
+ default:
156
+ return { category: Tms_TaskStatusCategory.Custom, detail };
157
+ }
158
+ }
159
+ }
160
+ exports.Tasks = Tasks;
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
3
+ import { AsanaConverter } from './common';
4
+ export declare class Users extends AsanaConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,16 @@
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.AsanaConverter {
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 [common_1.AsanaCommon.tms_User(user, source)];
14
+ }
15
+ }
16
+ exports.Users = Users;
@@ -0,0 +1,20 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { Converter, StreamContext } from '../converter';
3
+ import { IssueType, TaskStatus, TaskType, VersionMilestone } from './models';
4
+ interface BacklogConfig {
5
+ max_description_length?: number;
6
+ }
7
+ export declare class BacklogCommon {
8
+ static getTaskType(issueType: IssueType): TaskType;
9
+ static getTaskStatus(issueName: string): TaskStatus;
10
+ static getSprintState(versionMilestone: VersionMilestone): string;
11
+ }
12
+ /** Backlog converter base */
13
+ export declare abstract class BacklogConverter extends Converter {
14
+ source: string;
15
+ /** Almost every Backlog record have id property */
16
+ id(record: AirbyteRecord): any;
17
+ protected backlogConfig(ctx: StreamContext): BacklogConfig;
18
+ protected maxDescriptionLength(ctx: StreamContext): number;
19
+ }
20
+ export {};
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BacklogConverter = exports.BacklogCommon = void 0;
4
+ const converter_1 = require("../converter");
5
+ const models_1 = require("./models");
6
+ const MAX_DESCRIPTION_LENGTH = 1000;
7
+ class BacklogCommon {
8
+ static getTaskType(issueType) {
9
+ const detail = issueType.name;
10
+ const issueTypeName = issueType.name;
11
+ switch (issueTypeName) {
12
+ case 'Bug':
13
+ return { category: models_1.TaskCategory.Bug, detail };
14
+ case 'Task':
15
+ case 'Request':
16
+ return { category: models_1.TaskCategory.Story, detail };
17
+ default:
18
+ return { category: models_1.TaskCategory.Custom, detail };
19
+ }
20
+ }
21
+ static getTaskStatus(issueName) {
22
+ switch (issueName) {
23
+ case 'Resolved':
24
+ case 'Closed':
25
+ return { category: models_1.TaskStatusCategory.Done, detail: issueName };
26
+ case 'Open':
27
+ return { category: models_1.TaskStatusCategory.Todo, detail: issueName };
28
+ default:
29
+ return { category: models_1.TaskStatusCategory.InProgress, detail: issueName };
30
+ }
31
+ }
32
+ static getSprintState(versionMilestone) {
33
+ if (versionMilestone.releaseDueDate)
34
+ return models_1.SprintState.Closed;
35
+ return models_1.SprintState.Active;
36
+ }
37
+ }
38
+ exports.BacklogCommon = BacklogCommon;
39
+ /** Backlog converter base */
40
+ class BacklogConverter extends converter_1.Converter {
41
+ constructor() {
42
+ super(...arguments);
43
+ this.source = 'Backlog';
44
+ }
45
+ /** Almost every Backlog record have id property */
46
+ id(record) {
47
+ var _a, _b;
48
+ 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;
49
+ }
50
+ backlogConfig(ctx) {
51
+ var _a, _b;
52
+ return (_b = (_a = ctx.config.source_specific_configs) === null || _a === void 0 ? void 0 : _a.backlog) !== null && _b !== void 0 ? _b : {};
53
+ }
54
+ maxDescriptionLength(ctx) {
55
+ var _a;
56
+ return ((_a = this.backlogConfig(ctx).max_description_length) !== null && _a !== void 0 ? _a : MAX_DESCRIPTION_LENGTH);
57
+ }
58
+ }
59
+ exports.BacklogConverter = BacklogConverter;
@@ -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 Issues extends BacklogConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }