airbyte-faros-destination 0.9.17 → 0.9.18

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.
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord } from '../converter';
3
+ import { TrelloConverter } from './common';
4
+ export declare class Actions extends TrelloConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Actions = void 0;
4
+ const common_1 = require("./common");
5
+ class Actions extends common_1.TrelloConverter {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.destinationModels = [];
9
+ }
10
+ async convert(record) {
11
+ return [];
12
+ }
13
+ }
14
+ exports.Actions = Actions;
15
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/converters/trello/actions.ts"],"names":[],"mappings":";;;AAGA,qCAAyC;AAEzC,MAAa,OAAQ,SAAQ,wBAAe;IAA5C;;QACW,sBAAiB,GAAoC,EAAE,CAAC;IAOnE,CAAC;IALC,KAAK,CAAC,OAAO,CACX,MAAqB;QAErB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AARD,0BAQC"}
@@ -0,0 +1,7 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord } from '../converter';
3
+ import { TrelloConverter } from './common';
4
+ export declare class Boards extends TrelloConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
7
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Boards = void 0;
4
+ const common_1 = require("./common");
5
+ class Boards extends common_1.TrelloConverter {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.destinationModels = [
9
+ 'tms_TaskBoard',
10
+ 'tms_Project',
11
+ 'tms_TaskBoardProjectRelationship',
12
+ ];
13
+ }
14
+ async convert(record) {
15
+ const source = this.streamName.source;
16
+ const board = record.record.data;
17
+ const tmsBoard = {
18
+ model: 'tms_TaskBoard',
19
+ record: {
20
+ uid: board.id,
21
+ name: board.name,
22
+ source,
23
+ },
24
+ };
25
+ const tmsProject = {
26
+ model: 'tms_Project',
27
+ record: tmsBoard.record,
28
+ };
29
+ const boardProjectRelationship = {
30
+ model: 'tms_TaskBoardProjectRelationship',
31
+ record: {
32
+ board: { uid: board.id, source },
33
+ project: { uid: board.id, source },
34
+ },
35
+ };
36
+ return [tmsBoard, tmsProject, boardProjectRelationship];
37
+ }
38
+ }
39
+ exports.Boards = Boards;
40
+ //# sourceMappingURL=boards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boards.js","sourceRoot":"","sources":["../../../src/converters/trello/boards.ts"],"names":[],"mappings":";;;AAGA,qCAAyC;AAGzC,MAAa,MAAO,SAAQ,wBAAe;IAA3C;;QACW,sBAAiB,GAAoC;YAC5D,eAAe;YACf,aAAa;YACb,kCAAkC;SACnC,CAAC;IAgCJ,CAAC;IA9BC,KAAK,CAAC,OAAO,CACX,MAAqB;QAErB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAa,CAAC;QAE1C,MAAM,QAAQ,GAAsB;YAClC,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE;gBACN,GAAG,EAAE,KAAK,CAAC,EAAE;gBACb,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,MAAM;aACP;SACF,CAAC;QAEF,MAAM,UAAU,GAAsB;YACpC,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC;QAEF,MAAM,wBAAwB,GAAsB;YAClD,KAAK,EAAE,kCAAkC;YACzC,MAAM,EAAE;gBACN,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,MAAM,EAAC;gBAC9B,OAAO,EAAE,EAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,MAAM,EAAC;aACjC;SACF,CAAC;QAEF,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,wBAAwB,CAAC,CAAC;IAC1D,CAAC;CACF;AArCD,wBAqCC"}
@@ -0,0 +1,33 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
3
+ import { TrelloConverter } from './common';
4
+ export interface TrelloConfig {
5
+ task_status_category_mapping?: Record<string, string>;
6
+ }
7
+ export declare class Cards extends TrelloConverter {
8
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
9
+ private config;
10
+ private initialize;
11
+ static readonly actionsStream: StreamName;
12
+ static readonly labelsStream: StreamName;
13
+ get dependencies(): ReadonlyArray<StreamName>;
14
+ private seenCards;
15
+ private createActions;
16
+ private updateActions;
17
+ private createdCards;
18
+ private updatedCards;
19
+ private deletedCards;
20
+ private labelNames;
21
+ convert(record: AirbyteRecord, ctx?: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
22
+ onProcessingComplete(ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
23
+ private processCard;
24
+ private processCreate;
25
+ private processLabels;
26
+ private processAssignment;
27
+ private processBoard;
28
+ private processUpdate;
29
+ private processDelete;
30
+ private getStatus;
31
+ private getStatusChangelog;
32
+ private getStatusFromList;
33
+ }
@@ -0,0 +1,377 @@
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.Cards = void 0;
7
+ const faros_airbyte_cdk_1 = require("faros-airbyte-cdk");
8
+ const faros_js_client_1 = require("faros-js-client");
9
+ const lodash_1 = require("lodash");
10
+ const lodash_2 = __importDefault(require("lodash"));
11
+ const converter_1 = require("../converter");
12
+ const common_1 = require("./common");
13
+ var Tms_TaskStatusCategory;
14
+ (function (Tms_TaskStatusCategory) {
15
+ Tms_TaskStatusCategory["Custom"] = "Custom";
16
+ Tms_TaskStatusCategory["Done"] = "Done";
17
+ Tms_TaskStatusCategory["InProgress"] = "InProgress";
18
+ Tms_TaskStatusCategory["Todo"] = "Todo";
19
+ })(Tms_TaskStatusCategory || (Tms_TaskStatusCategory = {}));
20
+ var TmsTaskCategory;
21
+ (function (TmsTaskCategory) {
22
+ TmsTaskCategory["Bug"] = "Bug";
23
+ TmsTaskCategory["Custom"] = "Custom";
24
+ TmsTaskCategory["Story"] = "Story";
25
+ TmsTaskCategory["Task"] = "Task";
26
+ })(TmsTaskCategory || (TmsTaskCategory = {}));
27
+ class Cards extends common_1.TrelloConverter {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.destinationModels = [
31
+ 'tms_Task',
32
+ 'tms_TaskProjectRelationship',
33
+ 'tms_TaskBoardRelationship',
34
+ 'tms_TaskDependency',
35
+ 'tms_TaskAssignment',
36
+ 'tms_TaskTag',
37
+ ];
38
+ this.config = undefined;
39
+ this.seenCards = new Map();
40
+ this.createActions = new Map();
41
+ this.updateActions = new Map();
42
+ this.createdCards = new Set();
43
+ this.updatedCards = new Set();
44
+ this.deletedCards = new Set();
45
+ this.labelNames = new Map();
46
+ }
47
+ initialize(ctx) {
48
+ var _a, _b, _c, _d, _e, _f;
49
+ this.config =
50
+ (_c = (_a = this.config) !== null && _a !== void 0 ? _a : (_b = ctx.config.source_specific_configs) === null || _b === void 0 ? void 0 : _b.trello) !== null && _c !== void 0 ? _c : {};
51
+ this.config.task_status_category_mapping =
52
+ (_f = (_d = this.config.task_status_category_mapping) !== null && _d !== void 0 ? _d : (0, converter_1.parseObjectConfig)((_e = this.config) === null || _e === void 0 ? void 0 : _e.task_status_category_mapping, 'Task Status Category Mapping')) !== null && _f !== void 0 ? _f : {};
53
+ }
54
+ get dependencies() {
55
+ return [Cards.actionsStream, Cards.labelsStream];
56
+ }
57
+ async convert(record, ctx) {
58
+ this.initialize(ctx);
59
+ const card = record.record.data;
60
+ this.seenCards.set(card.id, card);
61
+ return [];
62
+ }
63
+ async onProcessingComplete(ctx) {
64
+ var _a, _b, _c, _d, _e;
65
+ const actionCards = new Set();
66
+ for (const record of Object.values(ctx.getAll(Cards.actionsStream.asString))) {
67
+ const action = (_a = record.record) === null || _a === void 0 ? void 0 : _a.data;
68
+ const cardId = (_c = (_b = action === null || action === void 0 ? void 0 : action.data) === null || _b === void 0 ? void 0 : _b.card) === null || _c === void 0 ? void 0 : _c.id;
69
+ if (!cardId) {
70
+ continue;
71
+ }
72
+ actionCards.add(cardId);
73
+ const curActions = (_d = this.updateActions.get(cardId)) !== null && _d !== void 0 ? _d : [];
74
+ switch (action.type) {
75
+ case 'createCard':
76
+ this.createdCards.add(cardId);
77
+ this.createActions.set(cardId, action);
78
+ break;
79
+ case 'deleteCard':
80
+ this.deletedCards.add(cardId);
81
+ break;
82
+ case 'updateCard':
83
+ this.updatedCards.add(cardId);
84
+ curActions.push(action);
85
+ this.updateActions.set(cardId, curActions);
86
+ break;
87
+ default:
88
+ continue;
89
+ }
90
+ }
91
+ for (const record of Object.values(ctx.getAll(Cards.labelsStream.asString))) {
92
+ const label = (_e = record.record) === null || _e === void 0 ? void 0 : _e.data;
93
+ this.labelNames.set(label.id, label.name);
94
+ }
95
+ const res = [];
96
+ for (const cardId of actionCards) {
97
+ const cardRecords = await this.processCard(cardId, ctx);
98
+ res.push(...cardRecords);
99
+ }
100
+ return res;
101
+ }
102
+ async processCard(cardId, ctx) {
103
+ const isCreated = this.createdCards.has(cardId);
104
+ const isUpdated = this.updatedCards.has(cardId);
105
+ const isDeleted = this.deletedCards.has(cardId);
106
+ if (isDeleted) {
107
+ if (isCreated) {
108
+ // Card was created and then deleted within the same sync window, so we don't need to persist it
109
+ return [];
110
+ }
111
+ else {
112
+ // Card was deleted, so we need to delete it from the graph
113
+ return await this.processDelete(cardId);
114
+ }
115
+ }
116
+ if (isCreated) {
117
+ return await this.processCreate(cardId);
118
+ }
119
+ if (isUpdated) {
120
+ return await this.processUpdate(cardId, ctx);
121
+ }
122
+ return [];
123
+ }
124
+ async processCreate(cardId) {
125
+ var _a, _b, _c, _d, _e, _f;
126
+ const card = this.seenCards.get(cardId);
127
+ if (!card) {
128
+ return [];
129
+ }
130
+ const res = [];
131
+ const taskKey = { uid: card.id, source: this.source };
132
+ const statusChangelog = this.getStatusChangelog(cardId);
133
+ res.push({
134
+ model: 'tms_Task',
135
+ record: {
136
+ ...taskKey,
137
+ name: card.name,
138
+ description: (_a = faros_js_client_1.Utils.cleanAndTruncate(card.desc)) !== null && _a !== void 0 ? _a : null,
139
+ url: (_b = card.url) !== null && _b !== void 0 ? _b : null,
140
+ type: { category: TmsTaskCategory.Task, detail: null },
141
+ status: this.getStatus(card),
142
+ createdAt: (_d = faros_js_client_1.Utils.toDate((_c = this.createActions.get(cardId)) === null || _c === void 0 ? void 0 : _c.date)) !== null && _d !== void 0 ? _d : null,
143
+ updatedAt: (_e = faros_js_client_1.Utils.toDate(card.dateLastActivity)) !== null && _e !== void 0 ? _e : null,
144
+ statusChangedAt: (_f = faros_js_client_1.Utils.toDate(card.dateLastActivity)) !== null && _f !== void 0 ? _f : null,
145
+ statusChangelog: statusChangelog !== null && statusChangelog !== void 0 ? statusChangelog : null,
146
+ },
147
+ });
148
+ res.push(...(await this.processBoard(card, taskKey)));
149
+ res.push(...(await this.processAssignment(card, taskKey)));
150
+ res.push(...(await this.processLabels(card, taskKey)));
151
+ return res;
152
+ }
153
+ async processLabels(card, taskKey) {
154
+ var _a;
155
+ const res = [];
156
+ if (((_a = card === null || card === void 0 ? void 0 : card.idLabels) !== null && _a !== void 0 ? _a : []).length > 0) {
157
+ for (const labelId of card.idLabels) {
158
+ const labelName = this.labelNames.get(labelId);
159
+ if (!labelName) {
160
+ continue;
161
+ }
162
+ res.push({
163
+ model: 'tms_TaskTag',
164
+ record: {
165
+ task: taskKey,
166
+ label: { name: labelName },
167
+ },
168
+ });
169
+ }
170
+ }
171
+ return res;
172
+ }
173
+ async processAssignment(card, taskKey) {
174
+ var _a;
175
+ const res = [];
176
+ if (((_a = card === null || card === void 0 ? void 0 : card.idMembers) !== null && _a !== void 0 ? _a : []).length > 0) {
177
+ res.push({
178
+ model: 'tms_TaskAssignment',
179
+ record: {
180
+ task: taskKey,
181
+ assignee: { uid: card.idMembers[0], source: this.source },
182
+ },
183
+ });
184
+ }
185
+ return res;
186
+ }
187
+ async processBoard(card, taskKey) {
188
+ const res = [];
189
+ if (card === null || card === void 0 ? void 0 : card.idBoard) {
190
+ res.push({
191
+ model: 'tms_TaskBoardRelationship',
192
+ record: {
193
+ task: taskKey,
194
+ board: { uid: card.idBoard, source: this.source },
195
+ },
196
+ });
197
+ res.push({
198
+ model: 'tms_TaskProjectRelationship',
199
+ record: {
200
+ task: taskKey,
201
+ project: { uid: card.idBoard, source: this.source },
202
+ },
203
+ });
204
+ }
205
+ return res;
206
+ }
207
+ async processUpdate(cardId, ctx) {
208
+ var _a, _b, _c, _d, _e;
209
+ if (!ctx ||
210
+ ctx.streamsSyncMode[this.streamName.asString] ===
211
+ faros_airbyte_cdk_1.DestinationSyncMode.OVERWRITE ||
212
+ (0, lodash_1.isNil)(ctx.farosClient) ||
213
+ (0, lodash_1.isNil)(ctx.graph)) {
214
+ return [];
215
+ }
216
+ const card = this.seenCards.get(cardId);
217
+ if (!card) {
218
+ return [];
219
+ }
220
+ const query = `
221
+ {
222
+ tms_Task(
223
+ where: {_and: [{uid: {_eq: "${cardId}"}}, {source: {_eq: "${this.source}"}}]}
224
+ ) {
225
+ statusChangelog
226
+ boards {
227
+ board {
228
+ uid
229
+ source
230
+ }
231
+ }
232
+ assignees {
233
+ assignee {
234
+ uid
235
+ source
236
+ }
237
+ }
238
+ tags {
239
+ label {
240
+ name
241
+ }
242
+ }
243
+ }
244
+ }`;
245
+ const res = [];
246
+ for await (const task of ctx.farosClient.nodeIterable(ctx.graph, query, 100, faros_js_client_1.paginatedQueryV2)) {
247
+ const taskKey = { uid: task.uid, source: task.source };
248
+ const statusChangelog = this.getStatusChangelog(task.uid, task.statusChangelog);
249
+ res.push({
250
+ model: 'tms_Task__Update',
251
+ record: {
252
+ at: Date.now(),
253
+ where: taskKey,
254
+ mask: [
255
+ 'name',
256
+ 'description',
257
+ 'url',
258
+ 'type',
259
+ 'status',
260
+ 'updatedAt',
261
+ 'statusChangedAt',
262
+ 'statusChangelog',
263
+ ],
264
+ patch: {
265
+ name: card.name,
266
+ description: (_a = faros_js_client_1.Utils.cleanAndTruncate(card.desc)) !== null && _a !== void 0 ? _a : null,
267
+ url: (_b = card.url) !== null && _b !== void 0 ? _b : null,
268
+ type: { category: TmsTaskCategory.Task, detail: null },
269
+ status: this.getStatus(card),
270
+ updatedAt: (_c = faros_js_client_1.Utils.toDate(card.dateLastActivity)) !== null && _c !== void 0 ? _c : null,
271
+ statusChangedAt: (_d = faros_js_client_1.Utils.toDate(card.dateLastActivity)) !== null && _d !== void 0 ? _d : null,
272
+ statusChangelog: statusChangelog !== null && statusChangelog !== void 0 ? statusChangelog : null,
273
+ },
274
+ },
275
+ });
276
+ for (const board of task.boards || []) {
277
+ if (board.board.uid !== card.idBoard &&
278
+ board.board.source === this.source) {
279
+ res.push({
280
+ model: 'tms_TaskBoardRelationship__Deletion',
281
+ record: {
282
+ where: {
283
+ task: taskKey,
284
+ board: board.board,
285
+ },
286
+ },
287
+ });
288
+ }
289
+ }
290
+ res.push(...(await this.processBoard(card, taskKey)));
291
+ const assigneeId = (_e = card.idMembers) === null || _e === void 0 ? void 0 : _e[0];
292
+ for (const assignee of task.assignees || []) {
293
+ if (assignee.assignee.uid !== assigneeId &&
294
+ assignee.assignee.source === this.source) {
295
+ res.push({
296
+ model: 'tms_TaskAssignment__Deletion',
297
+ record: {
298
+ where: {
299
+ task: taskKey,
300
+ assignee: assignee.assignee,
301
+ },
302
+ },
303
+ });
304
+ }
305
+ }
306
+ res.push(...(await this.processAssignment(card, taskKey)));
307
+ const labels = new Set(card.idLabels);
308
+ for (const tag of task.tags || []) {
309
+ if (!labels.has(tag.label.name)) {
310
+ res.push({
311
+ model: 'tms_TaskTag__Deletion',
312
+ record: {
313
+ where: {
314
+ task: taskKey,
315
+ label: { name: tag.label.name },
316
+ },
317
+ },
318
+ });
319
+ }
320
+ }
321
+ res.push(...(await this.processLabels(card, taskKey)));
322
+ }
323
+ return res;
324
+ }
325
+ async processDelete(cardId) {
326
+ return [
327
+ {
328
+ model: 'tms_Task__Deletion',
329
+ record: {
330
+ where: {
331
+ uid: cardId,
332
+ source: this.source,
333
+ },
334
+ },
335
+ },
336
+ ];
337
+ }
338
+ getStatus(card) {
339
+ if (card.closed) {
340
+ return { category: Tms_TaskStatusCategory.Done, detail: 'completed' };
341
+ }
342
+ else {
343
+ return { category: Tms_TaskStatusCategory.Todo, detail: 'incomplete' };
344
+ }
345
+ }
346
+ getStatusChangelog(cardId, initialChangelog = []) {
347
+ var _a, _b;
348
+ const changelog = [...initialChangelog];
349
+ for (const action of (_a = this.updateActions.get(cardId)) !== null && _a !== void 0 ? _a : []) {
350
+ const changedAt = faros_js_client_1.Utils.toDate(action.date);
351
+ if ((_b = action.data) === null || _b === void 0 ? void 0 : _b.listAfter) {
352
+ const status = this.getStatusFromList(action.data.listAfter);
353
+ changelog.push({ status, changedAt });
354
+ }
355
+ else if (lodash_2.default.get(action, 'data.card.closed', false) !==
356
+ lodash_2.default.get(action, 'old.closed', false)) {
357
+ const status = this.getStatus(action.data.card);
358
+ changelog.push({ status, changedAt });
359
+ }
360
+ }
361
+ return lodash_2.default.sortBy(changelog, (item) => -item.changedAt.getTime());
362
+ }
363
+ getStatusFromList(list) {
364
+ // Try to map using the id first
365
+ // If there is no mapping for the id, try to map using the name
366
+ let result = faros_js_client_1.Utils.toCategoryDetail(Tms_TaskStatusCategory, list.id, this.config.task_status_category_mapping);
367
+ if (result.category !== Tms_TaskStatusCategory.Custom) {
368
+ return result;
369
+ }
370
+ result = faros_js_client_1.Utils.toCategoryDetail(Tms_TaskStatusCategory, list.name, this.config.task_status_category_mapping);
371
+ return result;
372
+ }
373
+ }
374
+ exports.Cards = Cards;
375
+ Cards.actionsStream = new converter_1.StreamName('trello', 'actions');
376
+ Cards.labelsStream = new converter_1.StreamName('trello', 'labels');
377
+ //# sourceMappingURL=cards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cards.js","sourceRoot":"","sources":["../../../src/converters/trello/cards.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAqE;AACrE,qDAAwD;AACxD,mCAA6B;AAC7B,oDAAuB;AAEvB,4CAMsB;AACtB,qCAAyC;AAazC,IAAK,sBAKJ;AALD,WAAK,sBAAsB;IACzB,2CAAiB,CAAA;IACjB,uCAAa,CAAA;IACb,mDAAyB,CAAA;IACzB,uCAAa,CAAA;AACf,CAAC,EALI,sBAAsB,KAAtB,sBAAsB,QAK1B;AAOD,IAAK,eAKJ;AALD,WAAK,eAAe;IAClB,8BAAW,CAAA;IACX,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EALI,eAAe,KAAf,eAAe,QAKnB;AAMD,MAAa,KAAM,SAAQ,wBAAe;IAA1C;;QACW,sBAAiB,GAAoC;YAC5D,UAAU;YACV,6BAA6B;YAC7B,2BAA2B;YAC3B,oBAAoB;YACpB,oBAAoB;YACpB,aAAa;SACd,CAAC;QAEM,WAAM,GAAiB,SAAS,CAAC;QAqBjC,cAAS,GAAsB,IAAI,GAAG,EAAE,CAAC;QACzC,kBAAa,GAAwB,IAAI,GAAG,EAAE,CAAC;QAC/C,kBAAa,GAA+B,IAAI,GAAG,EAAE,CAAC;QACtD,iBAAY,GAAgB,IAAI,GAAG,EAAE,CAAC;QACtC,i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ACtB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,MAAM,CAAC,4BAA4B,CACzC,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;;AAjcH,sBAkcC;AA1aiB,mBAAa,GAAG,IAAI,sBAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,AAAtC,CAAuC;AACpD,kBAAY,GAAG,IAAI,sBAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,AAArC,CAAsC"}
@@ -0,0 +1,26 @@
1
+ import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { Converter, DestinationRecord } from '../converter';
3
+ import { User } from './models';
4
+ interface TmsTaskType {
5
+ category: TmsTaskCategory;
6
+ detail: string;
7
+ }
8
+ declare enum TmsTaskCategory {
9
+ Bug = "Bug",
10
+ Custom = "Custom",
11
+ Story = "Story",
12
+ Task = "Task"
13
+ }
14
+ /** Common functions shares across Trello converters */
15
+ export declare class TrelloCommon {
16
+ static normalize(str: string): string;
17
+ static toTmsTaskType(resource_type: string): TmsTaskType;
18
+ static tms_User(user: User, source: string): DestinationRecord;
19
+ }
20
+ /** Trello converter base */
21
+ export declare abstract class TrelloConverter extends Converter {
22
+ source: string;
23
+ /** All Trello records should have id property */
24
+ id(record: AirbyteRecord): any;
25
+ }
26
+ export {};
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TrelloConverter = exports.TrelloCommon = 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 Trello converters */
13
+ class TrelloCommon {
14
+ static normalize(str) {
15
+ return str.replace(/\s/g, '').toLowerCase();
16
+ }
17
+ static toTmsTaskType(resource_type) {
18
+ if (!resource_type) {
19
+ return { category: TmsTaskCategory.Custom, detail: 'undefined' };
20
+ }
21
+ switch (this.normalize(resource_type)) {
22
+ case 'bug':
23
+ return { category: TmsTaskCategory.Bug, detail: resource_type };
24
+ case 'story':
25
+ return { category: TmsTaskCategory.Story, detail: resource_type };
26
+ case 'task':
27
+ return { category: TmsTaskCategory.Task, detail: resource_type };
28
+ default:
29
+ return { category: TmsTaskCategory.Custom, detail: resource_type };
30
+ }
31
+ }
32
+ static tms_User(user, source) {
33
+ return {
34
+ model: 'tms_User',
35
+ record: {
36
+ uid: user.id,
37
+ name: user.fullName || null,
38
+ emailAddress: user.username || null,
39
+ source,
40
+ },
41
+ };
42
+ }
43
+ }
44
+ exports.TrelloCommon = TrelloCommon;
45
+ /** Trello converter base */
46
+ class TrelloConverter extends converter_1.Converter {
47
+ constructor() {
48
+ super(...arguments);
49
+ this.source = 'Trello';
50
+ }
51
+ /** All Trello records should have id property */
52
+ id(record) {
53
+ var _a, _b;
54
+ 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;
55
+ }
56
+ }
57
+ exports.TrelloConverter = TrelloConverter;
58
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/trello/common.ts"],"names":[],"mappings":";;;AAEA,4CAA0D;AAQ1D,IAAK,eAKJ;AALD,WAAK,eAAe;IAClB,8BAAW,CAAA;IACX,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EALI,eAAe,KAAf,eAAe,QAKnB;AAED,uDAAuD;AACvD,MAAa,YAAY;IACvB,MAAM,CAAC,SAAS,CAAC,GAAW;QAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,aAA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 import { AirbyteRecord } from 'faros-airbyte-cdk';
2
+ import { DestinationModel, DestinationRecord } from '../converter';
3
+ import { TrelloConverter } from './common';
4
+ export declare class Labels extends TrelloConverter {
5
+ readonly destinationModels: ReadonlyArray<DestinationModel>;
6
+ private seenNames;
7
+ convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
8
+ }
@@ -0,0 +1,32 @@
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.Labels = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const common_1 = require("./common");
9
+ class Labels extends common_1.TrelloConverter {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.destinationModels = ['tms_Label'];
13
+ this.seenNames = new Set();
14
+ }
15
+ async convert(record) {
16
+ const label = record.record.data;
17
+ if (lodash_1.default.isNil(label.name) || this.seenNames.has(label.name)) {
18
+ return [];
19
+ }
20
+ this.seenNames.add(label.name);
21
+ return [
22
+ {
23
+ model: 'tms_Label',
24
+ record: {
25
+ name: label.name,
26
+ },
27
+ },
28
+ ];
29
+ }
30
+ }
31
+ exports.Labels = Labels;
32
+ //# sourceMappingURL=labels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels.js","sourceRoot":"","sources":["../../../src/converters/trello/labels.ts"],"names":[],"mappings":";;;;;;AACA,oDAAuB;AAGvB,qCAAyC;AAGzC,MAAa,MAAO,SAAQ,wBAAe;IAA3C;;QACW,sBAAiB,GAAoC,CAAC,WAAW,CAAC,CAAC;QAEpE,cAAS,GAAgB,IAAI,GAAG,EAAE,CAAC;IAsB7C,CAAC;IApBC,KAAK,CAAC,OAAO,CACX,MAAqB;QAErB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAa,CAAC;QAE1C,IAAI,gBAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1D,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE/B,OAAO;YACL;gBACE,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE;oBACN,IAAI,EAAE,KAAK,CAAC,IAAI;iBACjB;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAzBD,wBAyBC"}