airbyte-faros-destination 0.9.16 → 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.
- package/lib/common/types.d.ts +1 -0
- package/lib/common/types.js.map +1 -1
- package/lib/common/write-stats.d.ts +1 -0
- package/lib/common/write-stats.js +12 -0
- package/lib/common/write-stats.js.map +1 -1
- package/lib/converters/trello/actions.d.ts +7 -0
- package/lib/converters/trello/actions.js +15 -0
- package/lib/converters/trello/actions.js.map +1 -0
- package/lib/converters/trello/boards.d.ts +7 -0
- package/lib/converters/trello/boards.js +40 -0
- package/lib/converters/trello/boards.js.map +1 -0
- package/lib/converters/trello/cards.d.ts +33 -0
- package/lib/converters/trello/cards.js +377 -0
- package/lib/converters/trello/cards.js.map +1 -0
- package/lib/converters/trello/common.d.ts +26 -0
- package/lib/converters/trello/common.js +58 -0
- package/lib/converters/trello/common.js.map +1 -0
- package/lib/converters/trello/labels.d.ts +8 -0
- package/lib/converters/trello/labels.js +32 -0
- package/lib/converters/trello/labels.js.map +1 -0
- package/lib/converters/trello/models.d.ts +285 -0
- package/lib/converters/trello/models.js +3 -0
- package/lib/converters/trello/models.js.map +1 -0
- package/lib/converters/trello/users.d.ts +7 -0
- package/lib/converters/trello/users.js +17 -0
- package/lib/converters/trello/users.js.map +1 -0
- package/lib/converters/workday/customreports.d.ts +2 -1
- package/lib/converters/workday/customreports.js +36 -7
- package/lib/converters/workday/customreports.js.map +1 -1
- package/lib/converters/workday/models.d.ts +5 -0
- package/lib/converters/workday/models.js.map +1 -1
- package/lib/converters/zendesk/common.d.ts +2 -0
- package/lib/converters/zendesk/common.js +2 -0
- package/lib/converters/zendesk/common.js.map +1 -1
- package/lib/converters/zendesk/satisfaction_ratings.d.ts +9 -0
- package/lib/converters/zendesk/satisfaction_ratings.js +47 -0
- package/lib/converters/zendesk/satisfaction_ratings.js.map +1 -0
- package/lib/converters/zendesk/tickets.d.ts +6 -0
- package/lib/converters/zendesk/tickets.js +109 -18
- package/lib/converters/zendesk/tickets.js.map +1 -1
- package/lib/destination.d.ts +4 -3
- package/lib/destination.js +34 -10
- package/lib/destination.js.map +1 -1
- package/lib/sync.d.ts +23 -0
- package/lib/sync.js +52 -0
- package/lib/sync.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/resources/source-specific-configs/spec.json +6 -0
- package/resources/source-specific-configs/trello.json +30 -0
- package/resources/source-specific-configs/workday.json +6 -0
- package/resources/source-specific-configs/zendesk.json +34 -0
- package/resources/spec.json +6 -0
package/lib/common/types.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface DestinationConfig extends AirbyteConfig {
|
|
|
23
23
|
readonly source_specific_configs?: Dictionary<any>;
|
|
24
24
|
readonly keep_alive?: boolean;
|
|
25
25
|
readonly skip_source_success_check?: boolean;
|
|
26
|
+
readonly faros_source_id?: string;
|
|
26
27
|
}
|
|
27
28
|
export declare enum Operation {
|
|
28
29
|
UPSERT = "Upsert",
|
package/lib/common/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":";;;AAKA,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,kCAAuB,CAAA;IACvB,0BAAe,CAAA;AACjB,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAED,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,sCAAa,CAAA;AACf,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":";;;AAKA,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,kCAAuB,CAAA;IACvB,0BAAe,CAAA;AACjB,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAED,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,sCAAa,CAAA;AACf,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC;AAmBD,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;AACvB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
|
|
@@ -44,6 +44,18 @@ class WriteStats {
|
|
|
44
44
|
logger.info(`Skipped ${this.recordsSkipped} records`);
|
|
45
45
|
logger.info(`Errored ${this.recordsErrored} records`);
|
|
46
46
|
}
|
|
47
|
+
asObject() {
|
|
48
|
+
return {
|
|
49
|
+
messagesRead: this.messagesRead,
|
|
50
|
+
recordsRead: this.recordsRead,
|
|
51
|
+
recordsProcessed: this.recordsProcessed,
|
|
52
|
+
recordsWritten: this.recordsWritten,
|
|
53
|
+
recordsErrored: this.recordsErrored,
|
|
54
|
+
recordsSkipped: this.recordsSkipped,
|
|
55
|
+
processedByStream: this.processedByStream,
|
|
56
|
+
writtenByModel: this.writtenByModel,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
60
|
exports.WriteStats = WriteStats;
|
|
49
61
|
//# sourceMappingURL=write-stats.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-stats.js","sourceRoot":"","sources":["../../src/common/write-stats.ts"],"names":[],"mappings":";;;;;;AACA,oDAAuB;AAGvB,MAAa,UAAU;IACrB,YACS,eAAuB,CAAC,EACxB,cAAsB,CAAC,EACvB,mBAA2B,CAAC,EAC5B,iBAAyB,CAAC,EAC1B,iBAAyB,CAAC,EAC1B,iBAAyB,CAAC,EAC1B,oBAAwC,EAAE,EAC1C,iBAAqC,EAAE;QAPvC,iBAAY,GAAZ,YAAY,CAAY;QACxB,gBAAW,GAAX,WAAW,CAAY;QACvB,qBAAgB,GAAhB,gBAAgB,CAAY;QAC5B,mBAAc,GAAd,cAAc,CAAY;QAC1B,mBAAc,GAAd,cAAc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ED,QAAQ;QACN,OAAO;YACL,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CAAC;IACJ,CAAC;CACF;AA1DD,gCA0DC"}
|
|
@@ -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,I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,CAAC;QAChB,CAAC;QACD,MAAM,GAAG,uBAAK,CAAC,gBAAgB,CAC7B,sBAAsB,EACtB,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,aAAa,CAAC,aAAqB;QACxC,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO,EAAC,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAC,CAAC;QACjE,CAAC;QACD,QAAQ,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC;YACtC,KAAK,KAAK;gBACR,OAAO,EAAC,QAAQ,EAAE,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAC,CAAC;YAChE,KAAK,OAAO;gBACV,OAAO,EAAC,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAC,CAAC;YAClE,KAAK,MAAM;gBACT,OAAO,EAAC,QAAQ,EAAE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAC,CAAC;YAC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