airbyte-faros-destination 0.4.54 → 0.4.56
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/converters/clickup/common.d.ts +21 -0
- package/lib/converters/clickup/common.js +58 -0
- package/lib/converters/clickup/common.js.map +1 -0
- package/lib/converters/clickup/folders.d.ts +7 -0
- package/lib/converters/clickup/folders.js +34 -0
- package/lib/converters/clickup/folders.js.map +1 -0
- package/lib/converters/clickup/goals.d.ts +6 -0
- package/lib/converters/clickup/goals.js +15 -0
- package/lib/converters/clickup/goals.js.map +1 -0
- package/lib/converters/clickup/lists.d.ts +7 -0
- package/lib/converters/clickup/lists.js +34 -0
- package/lib/converters/clickup/lists.js.map +1 -0
- package/lib/converters/clickup/spaces.d.ts +7 -0
- package/lib/converters/clickup/spaces.js +34 -0
- package/lib/converters/clickup/spaces.js.map +1 -0
- package/lib/converters/clickup/status_histories.d.ts +7 -0
- package/lib/converters/clickup/status_histories.js +42 -0
- package/lib/converters/clickup/status_histories.js.map +1 -0
- package/lib/converters/clickup/tasks.d.ts +11 -0
- package/lib/converters/clickup/tasks.js +143 -0
- package/lib/converters/clickup/tasks.js.map +1 -0
- package/lib/converters/clickup/workspaces.d.ts +7 -0
- package/lib/converters/clickup/workspaces.js +40 -0
- package/lib/converters/clickup/workspaces.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/resources/spec.json +45 -54
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Converter, StreamContext } from '../converter';
|
|
3
|
+
type TaskBoardSource = 'space' | 'folder' | 'list';
|
|
4
|
+
interface ClickUpConfig {
|
|
5
|
+
taskboard_sources?: ReadonlyArray<TaskBoardSource>;
|
|
6
|
+
truncate_limit?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class ClickUpCommon {
|
|
9
|
+
static normalize(str: string): string;
|
|
10
|
+
static statusCategory(status: string): string;
|
|
11
|
+
}
|
|
12
|
+
export declare abstract class ClickUpConverter extends Converter {
|
|
13
|
+
source: string;
|
|
14
|
+
/** All ClickUp records should have id property */
|
|
15
|
+
id(record: AirbyteRecord): any;
|
|
16
|
+
protected clickupConfig(ctx: StreamContext): ClickUpConfig;
|
|
17
|
+
protected taskboardSources(ctx: StreamContext): ReadonlyArray<TaskBoardSource>;
|
|
18
|
+
protected truncateLimit(ctx: StreamContext): number;
|
|
19
|
+
protected truncate(ctx: StreamContext, str?: string): string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClickUpConverter = exports.ClickUpCommon = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const converter_1 = require("../converter");
|
|
6
|
+
const DEFAULT_TASKBOARD_SOURCES = ['space'];
|
|
7
|
+
const DEFAULT_TRUNCATE_LIMIT = 10000;
|
|
8
|
+
class ClickUpCommon {
|
|
9
|
+
static normalize(str) {
|
|
10
|
+
return str.replace(/\s/g, '').toLowerCase();
|
|
11
|
+
}
|
|
12
|
+
static statusCategory(status) {
|
|
13
|
+
switch (this.normalize(status)) {
|
|
14
|
+
case 'open':
|
|
15
|
+
return 'Todo';
|
|
16
|
+
case 'todo':
|
|
17
|
+
return 'Todo';
|
|
18
|
+
case 'inprogress':
|
|
19
|
+
return 'InProgress';
|
|
20
|
+
case 'closed':
|
|
21
|
+
return 'Done';
|
|
22
|
+
default:
|
|
23
|
+
return 'Custom';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ClickUpCommon = ClickUpCommon;
|
|
28
|
+
class ClickUpConverter extends converter_1.Converter {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.source = 'ClickUp';
|
|
32
|
+
}
|
|
33
|
+
/** All ClickUp records should have id property */
|
|
34
|
+
id(record) {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
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;
|
|
37
|
+
}
|
|
38
|
+
clickupConfig(ctx) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
return (_b = (_a = ctx.config.source_specific_configs) === null || _a === void 0 ? void 0 : _a.clickup) !== null && _b !== void 0 ? _b : {};
|
|
41
|
+
}
|
|
42
|
+
taskboardSources(ctx) {
|
|
43
|
+
var _a;
|
|
44
|
+
return ((_a = this.clickupConfig(ctx).taskboard_sources) !== null && _a !== void 0 ? _a : DEFAULT_TASKBOARD_SOURCES);
|
|
45
|
+
}
|
|
46
|
+
truncateLimit(ctx) {
|
|
47
|
+
var _a;
|
|
48
|
+
return (_a = this.clickupConfig(ctx).truncate_limit) !== null && _a !== void 0 ? _a : DEFAULT_TRUNCATE_LIMIT;
|
|
49
|
+
}
|
|
50
|
+
truncate(ctx, str) {
|
|
51
|
+
if ((0, lodash_1.isString)(str) && str.length > this.truncateLimit(ctx)) {
|
|
52
|
+
return str.substring(0, this.truncateLimit(ctx));
|
|
53
|
+
}
|
|
54
|
+
return str;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.ClickUpConverter = ClickUpConverter;
|
|
58
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/clickup/common.ts"],"names":[],"mappings":";;;AACA,mCAAgC;AAEhC,4CAAsD;AAStD,MAAM,yBAAyB,GAAmC,CAAC,OAAO,CAAC,CAAC;AAC5E,MAAM,sBAAsB,GAAG,KAAM,CAAC;AAEtC,MAAa,aAAa;IACxB,MAAM,CAAC,SAAS,CAAC,GAAW;QAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,C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,CAAC,CAAC,CAAC;SAClD;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AA9BD,4CA8BC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ClickUpConverter } from './common';
|
|
4
|
+
export declare class Folders extends ClickUpConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Folders = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Folders extends common_1.ClickUpConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'tms_TaskBoard',
|
|
10
|
+
'tms_TaskBoardProjectRelationship',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
async convert(record, ctx) {
|
|
14
|
+
const folder = record.record.data;
|
|
15
|
+
const source = this.streamName.source;
|
|
16
|
+
const uid = folder.id;
|
|
17
|
+
const results = [];
|
|
18
|
+
if (this.taskboardSources(ctx).includes('folder')) {
|
|
19
|
+
results.push({
|
|
20
|
+
model: 'tms_TaskBoard',
|
|
21
|
+
record: { uid, name: `${folder.name} (folder)`, source },
|
|
22
|
+
}, {
|
|
23
|
+
model: 'tms_TaskBoardProjectRelationship',
|
|
24
|
+
record: {
|
|
25
|
+
board: { uid, source },
|
|
26
|
+
project: { uid: folder.computedProperties.workspace.id, source },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return results;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Folders = Folders;
|
|
34
|
+
//# sourceMappingURL=folders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folders.js","sourceRoot":"","sources":["../../../src/converters/clickup/folders.ts"],"names":[],"mappings":";;;AAIA,qCAA0C;AAE1C,MAAa,OAAQ,SAAQ,yBAAgB;IAA7C;;QACW,sBAAiB,GAAoC;YAC5D,eAAe;YACf,kCAAkC;SACnC,CAAC;IA2BJ,CAAC;IAzBC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAc,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,OAAO,GAAwB,EAAE,CAAC;QACxC,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACjD,OAAO,CAAC,IAAI,CACV;gBACE,KAAK,EAAE,eAAe;gBACtB,MAAM,EAAE,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,WAAW,EAAE,MAAM,EAAC;aACvD,EACD;gBACE,KAAK,EAAE,kCAAkC;gBACzC,MAAM,EAAE;oBACN,KAAK,EAAE,EAAC,GAAG,EAAE,MAAM,EAAC;oBACpB,OAAO,EAAE,EAAC,GAAG,EAAE,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAC;iBAC/D;aACF,CACF,CAAC;SACH;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA/BD,0BA+BC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DestinationModel, DestinationRecord } from '../converter';
|
|
2
|
+
import { ClickUpConverter } from './common';
|
|
3
|
+
export declare class Goals extends ClickUpConverter {
|
|
4
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
5
|
+
convert(): Promise<ReadonlyArray<DestinationRecord>>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Goals = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Goals extends common_1.ClickUpConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [];
|
|
9
|
+
}
|
|
10
|
+
async convert() {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.Goals = Goals;
|
|
15
|
+
//# sourceMappingURL=goals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goals.js","sourceRoot":"","sources":["../../../src/converters/clickup/goals.ts"],"names":[],"mappings":";;;AACA,qCAA0C;AAE1C,MAAa,KAAM,SAAQ,yBAAgB;IAA3C;;QACW,sBAAiB,GAAoC,EAAE,CAAC;IAKnE,CAAC;IAHC,KAAK,CAAC,OAAO;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAND,sBAMC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ClickUpConverter } from './common';
|
|
4
|
+
export declare class Lists extends ClickUpConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Lists = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Lists extends common_1.ClickUpConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'tms_TaskBoard',
|
|
10
|
+
'tms_TaskBoardProjectRelationship',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
async convert(record, ctx) {
|
|
14
|
+
const list = record.record.data;
|
|
15
|
+
const source = this.streamName.source;
|
|
16
|
+
const uid = list.id;
|
|
17
|
+
const results = [];
|
|
18
|
+
if (this.taskboardSources(ctx).includes('list')) {
|
|
19
|
+
results.push({
|
|
20
|
+
model: 'tms_TaskBoard',
|
|
21
|
+
record: { uid, name: `${list.name} (list)`, source },
|
|
22
|
+
}, {
|
|
23
|
+
model: 'tms_TaskBoardProjectRelationship',
|
|
24
|
+
record: {
|
|
25
|
+
board: { uid, source },
|
|
26
|
+
project: { uid: list.computedProperties.workspace.id, source },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return results;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Lists = Lists;
|
|
34
|
+
//# sourceMappingURL=lists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lists.js","sourceRoot":"","sources":["../../../src/converters/clickup/lists.ts"],"names":[],"mappings":";;;AAIA,qCAA0C;AAE1C,MAAa,KAAM,SAAQ,yBAAgB;IAA3C;;QACW,sBAAiB,GAAoC;YAC5D,eAAe;YACf,kCAAkC;SACnC,CAAC;IA2BJ,CAAC;IAzBC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAY,CAAC;QACxC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,OAAO,GAAwB,EAAE,CAAC;QACxC,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YAC/C,OAAO,CAAC,IAAI,CACV;gBACE,KAAK,EAAE,eAAe;gBACtB,MAAM,EAAE,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,SAAS,EAAE,MAAM,EAAC;aACnD,EACD;gBACE,KAAK,EAAE,kCAAkC;gBACzC,MAAM,EAAE;oBACN,KAAK,EAAE,EAAC,GAAG,EAAE,MAAM,EAAC;oBACpB,OAAO,EAAE,EAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAC;iBAC7D;aACF,CACF,CAAC;SACH;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA/BD,sBA+BC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ClickUpConverter } from './common';
|
|
4
|
+
export declare class Spaces extends ClickUpConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Spaces = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Spaces extends common_1.ClickUpConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'tms_TaskBoard',
|
|
10
|
+
'tms_TaskBoardProjectRelationship',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
async convert(record, ctx) {
|
|
14
|
+
const space = record.record.data;
|
|
15
|
+
const source = this.streamName.source;
|
|
16
|
+
const uid = space.id;
|
|
17
|
+
const results = [];
|
|
18
|
+
if (this.taskboardSources(ctx).includes('space')) {
|
|
19
|
+
results.push({
|
|
20
|
+
model: 'tms_TaskBoard',
|
|
21
|
+
record: { uid, name: `${space.name} (space)`, source },
|
|
22
|
+
}, {
|
|
23
|
+
model: 'tms_TaskBoardProjectRelationship',
|
|
24
|
+
record: {
|
|
25
|
+
board: { uid, source },
|
|
26
|
+
project: { uid: space.computedProperties.workspace.id, source },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return results;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Spaces = Spaces;
|
|
34
|
+
//# sourceMappingURL=spaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spaces.js","sourceRoot":"","sources":["../../../src/converters/clickup/spaces.ts"],"names":[],"mappings":";;;AAIA,qCAA0C;AAE1C,MAAa,MAAO,SAAQ,yBAAgB;IAA5C;;QACW,sBAAiB,GAAoC;YAC5D,eAAe;YACf,kCAAkC;SACnC,CAAC;IA2BJ,CAAC;IAzBC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAa,CAAC;QAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,OAAO,GAAwB,EAAE,CAAC;QACxC,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAChD,OAAO,CAAC,IAAI,CACV;gBACE,KAAK,EAAE,eAAe;gBACtB,MAAM,EAAE,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,UAAU,EAAE,MAAM,EAAC;aACrD,EACD;gBACE,KAAK,EAAE,kCAAkC;gBACzC,MAAM,EAAE;oBACN,KAAK,EAAE,EAAC,GAAG,EAAE,MAAM,EAAC;oBACpB,OAAO,EAAE,EAAC,GAAG,EAAE,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAC;iBAC9D;aACF,CACF,CAAC;SACH;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA/BD,wBA+BC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ClickUpConverter } from './common';
|
|
4
|
+
export declare class StatusHistories extends ClickUpConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatusHistories = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class StatusHistories extends common_1.ClickUpConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = [];
|
|
10
|
+
}
|
|
11
|
+
async convert(record, ctx) {
|
|
12
|
+
var _a;
|
|
13
|
+
const history = record.record.data;
|
|
14
|
+
const source = this.streamName.source;
|
|
15
|
+
const taskKey = { uid: history.computedProperties.task.id, source };
|
|
16
|
+
const changelog = (0, lodash_1.sortBy)((_a = history.status_history) !== null && _a !== void 0 ? _a : [], (h) => new Date(Number(h.total_time.since)));
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
model: 'tms_Task__Update',
|
|
20
|
+
record: {
|
|
21
|
+
at: Date.now(),
|
|
22
|
+
where: taskKey,
|
|
23
|
+
mask: ['statusChangedAt', 'statusChangelog'],
|
|
24
|
+
patch: {
|
|
25
|
+
statusChangedAt: new Date(Number(history.current_status.total_time.since)),
|
|
26
|
+
statusChangelog: changelog.map((c) => {
|
|
27
|
+
return {
|
|
28
|
+
status: {
|
|
29
|
+
category: common_1.ClickUpCommon.statusCategory(c.status),
|
|
30
|
+
detail: c.status,
|
|
31
|
+
},
|
|
32
|
+
changedAt: new Date(Number(c.total_time.since)),
|
|
33
|
+
};
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.StatusHistories = StatusHistories;
|
|
42
|
+
//# sourceMappingURL=status_histories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status_histories.js","sourceRoot":"","sources":["../../../src/converters/clickup/status_histories.ts"],"names":[],"mappings":";;;AAEA,mCAA8B;AAG9B,qCAAyD;AAEzD,MAAa,eAAgB,SAAQ,yBAAgB;IAArD;;QACW,sBAAiB,GAAoC,EAAE,CAAC;IAsCnE,CAAC;IApCC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAqB,CAAC;QACpD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,OAAO,GAAG,EAAC,GAAG,EAAE,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAC,CAAC;QAClE,MAAM,SAAS,GAAG,IAAA,eAAM,EACtB,MAAA,OAAO,CAAC,cAAc,mCAAI,EAAE,EAC5B,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAC5C,CAAC;QACF,OAAO;YACL;gBACE,KAAK,EAAE,kBAAkB;gBACzB,MAAM,EAAE;oBACN,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;oBACd,KAAK,EAAE,OAAO;oBACd,IAAI,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;oBAC5C,KAAK,EAAE;wBACL,eAAe,EAAE,IAAI,IAAI,CACvB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAChD;wBACD,eAAe,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;4BACnC,OAAO;gCACL,MAAM,EAAE;oCACN,QAAQ,EAAE,sBAAa,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC;oCAChD,MAAM,EAAE,CAAC,CAAC,MAAM;iCACjB;gCACD,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;6BAChD,CAAC;wBACJ,CAAC,CAAC;qBACH;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAvCD,0CAuCC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
|
|
3
|
+
import { ClickUpConverter } from './common';
|
|
4
|
+
export declare class Tasks extends ClickUpConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
private readonly goalsStream;
|
|
7
|
+
get dependencies(): ReadonlyArray<StreamName>;
|
|
8
|
+
private seenTags;
|
|
9
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
10
|
+
private customFields;
|
|
11
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tasks = void 0;
|
|
4
|
+
const converter_1 = require("../converter");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
const GOAL_NAME_ADDITIONAL_FIELD_NAME = 'faros__ClickUpGoalName';
|
|
7
|
+
class Tasks extends common_1.ClickUpConverter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.destinationModels = [
|
|
11
|
+
'tms_Label',
|
|
12
|
+
'tms_Task',
|
|
13
|
+
'tms_TaskAssignment',
|
|
14
|
+
'tms_TaskBoardRelationship',
|
|
15
|
+
'tms_TaskDependency',
|
|
16
|
+
'tms_TaskProjectRelationship',
|
|
17
|
+
'tms_TaskTag',
|
|
18
|
+
];
|
|
19
|
+
this.goalsStream = new converter_1.StreamName('clickup', 'goals');
|
|
20
|
+
this.seenTags = new Set();
|
|
21
|
+
}
|
|
22
|
+
get dependencies() {
|
|
23
|
+
return [this.goalsStream];
|
|
24
|
+
}
|
|
25
|
+
async convert(record, ctx) {
|
|
26
|
+
var _a, _b, _c, _d, _e, _f;
|
|
27
|
+
const task = record.record.data;
|
|
28
|
+
const source = this.streamName.source;
|
|
29
|
+
const uid = task.id;
|
|
30
|
+
const taskKey = { uid, source };
|
|
31
|
+
const results = [];
|
|
32
|
+
results.push({
|
|
33
|
+
model: 'tms_Task',
|
|
34
|
+
record: {
|
|
35
|
+
...taskKey,
|
|
36
|
+
name: task.name,
|
|
37
|
+
description: this.truncate(ctx, task.description),
|
|
38
|
+
url: task.url,
|
|
39
|
+
type: { category: 'Task', detail: 'Task' },
|
|
40
|
+
priority: typeof task.priority === 'string'
|
|
41
|
+
? task.priority
|
|
42
|
+
: (_a = task.priority) === null || _a === void 0 ? void 0 : _a.priority,
|
|
43
|
+
status: ((_b = task.status) === null || _b === void 0 ? void 0 : _b.status)
|
|
44
|
+
? {
|
|
45
|
+
category: common_1.ClickUpCommon.statusCategory(task.status.status),
|
|
46
|
+
detail: task.status.status,
|
|
47
|
+
}
|
|
48
|
+
: null,
|
|
49
|
+
points: task.points,
|
|
50
|
+
additionalFields: this.customFields(task, ctx),
|
|
51
|
+
createdAt: millisToDate(task.date_created),
|
|
52
|
+
updatedAt: millisToDate(task.date_updated),
|
|
53
|
+
resolvedAt: millisToDate(task.date_closed),
|
|
54
|
+
parent: task.parent ? { uid: task.id, source } : null,
|
|
55
|
+
creator: task.creator ? { uid: `${task.creator.id}`, source } : null,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
results.push({
|
|
59
|
+
model: 'tms_TaskProjectRelationship',
|
|
60
|
+
record: {
|
|
61
|
+
task: taskKey,
|
|
62
|
+
project: { uid: task.computedProperties.workspace.id, source },
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
for (const assignee of (_c = task.assignees) !== null && _c !== void 0 ? _c : []) {
|
|
66
|
+
results.push({
|
|
67
|
+
model: 'tms_TaskAssignment',
|
|
68
|
+
record: { task: taskKey, assignee: { uid: `${assignee.id}`, source } },
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
for (const tag of (_d = task.tags) !== null && _d !== void 0 ? _d : []) {
|
|
72
|
+
const label = { name: tag.name };
|
|
73
|
+
results.push({
|
|
74
|
+
model: 'tms_TaskTag',
|
|
75
|
+
record: { task: taskKey, label },
|
|
76
|
+
});
|
|
77
|
+
if (this.seenTags.has(tag.name)) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
results.push({ model: 'tms_Label', record: label });
|
|
81
|
+
this.seenTags.add(tag.name);
|
|
82
|
+
}
|
|
83
|
+
for (const linkedTask of (_e = task.linked_tasks) !== null && _e !== void 0 ? _e : []) {
|
|
84
|
+
if (linkedTask.task_id !== task.id) {
|
|
85
|
+
continue; // linked_tasks is non-empty for both source and target task
|
|
86
|
+
}
|
|
87
|
+
results.push({
|
|
88
|
+
model: 'tms_TaskDependency',
|
|
89
|
+
record: {
|
|
90
|
+
dependentTask: taskKey,
|
|
91
|
+
fulfillingTask: { uid: linkedTask.link_id, source },
|
|
92
|
+
dependencyType: { category: 'RelatesTo' },
|
|
93
|
+
fulfillingType: { category: 'RelatesTo' },
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const taskboardSources = this.taskboardSources(ctx);
|
|
98
|
+
for (const tbSource of taskboardSources) {
|
|
99
|
+
if ((_f = task[tbSource]) === null || _f === void 0 ? void 0 : _f.id) {
|
|
100
|
+
results.push({
|
|
101
|
+
model: 'tms_TaskBoardRelationship',
|
|
102
|
+
record: { task: taskKey, board: { uid: task[tbSource].id, source } },
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return results;
|
|
107
|
+
}
|
|
108
|
+
customFields(task, ctx) {
|
|
109
|
+
var _a, _b, _c, _d, _e;
|
|
110
|
+
const fields = ((_a = task.custom_fields) !== null && _a !== void 0 ? _a : [])
|
|
111
|
+
.filter((f) => f.value !== undefined)
|
|
112
|
+
.map((f) => {
|
|
113
|
+
return { name: f.name, value: `${f.value}` };
|
|
114
|
+
});
|
|
115
|
+
// Note: Adding a ClickUp Task to a Goal does not count as a task update.
|
|
116
|
+
// Therefore, the goal will not be added to the tms_Task's additionalFields
|
|
117
|
+
// until some other update was applied to the task, forcing the task to be
|
|
118
|
+
// pulled by the next incremental sync. To resolve this limitation, we'd
|
|
119
|
+
// need to either always pull all tasks in the Airbyte Source, or always
|
|
120
|
+
// pull all tms_Tasks in the Destination to update their additionalFields.
|
|
121
|
+
// We don't have an "upsert-to-array-field" mutation type.
|
|
122
|
+
for (const rec of Object.values(ctx.getAll(this.goalsStream.asString))) {
|
|
123
|
+
const goal = rec.record.data;
|
|
124
|
+
for (const target of (_b = goal.key_results) !== null && _b !== void 0 ? _b : []) {
|
|
125
|
+
if (((_c = target.task_ids) !== null && _c !== void 0 ? _c : []).includes(task.id) ||
|
|
126
|
+
((_d = target.subcategory_ids) !== null && _d !== void 0 ? _d : []).includes((_e = task.list) === null || _e === void 0 ? void 0 : _e.id)) {
|
|
127
|
+
fields.push({
|
|
128
|
+
name: GOAL_NAME_ADDITIONAL_FIELD_NAME,
|
|
129
|
+
value: goal.name,
|
|
130
|
+
});
|
|
131
|
+
break; // Multiple targets in the same goal can include the same task
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return fields;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.Tasks = Tasks;
|
|
139
|
+
function millisToDate(str) {
|
|
140
|
+
const millis = str ? Number(str) : null;
|
|
141
|
+
return Number.isInteger(millis) ? new Date(millis) : null;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/converters/clickup/tasks.ts"],"names":[],"mappings":";;;AAGA,4CAKsB;AACtB,qCAAyD;AAEzD,MAAM,+BAA+B,GAAG,wBAAwB,CAAC;AAEjE,MAAa,KAAM,SAAQ,yBAAgB;IAA3C;;QACW,sBAAiB,GAAoC;YAC5D,WAAW;YACX,UAAU;YACV,oBAAoB;YACpB,2BAA2B;YAC3B,oBAAoB;YACpB,6BAA6B;YAC7B,aAAa;SACd,CAAC;QAEe,gBAAW,GAAG,IAAI,sBAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAM1D,aAAQ,GAAgB,IAAI,GAAG,EAAE,CAAC;IAiI5C,CAAC;IArIC,IAAa,YAAY;QACvB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5B,CAAC;IAID,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAY,CAAC;QACxC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,EAAC,GAAG,EAAE,MAAM,EAAC,CAAC;QAC9B,MAAM,OAAO,GAAwB,EAAE,CAAC;QAExC,OAAO,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,UAAU;Y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,0DAA0D;QAC1D,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAE;YACtE,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAY,CAAC;YACrC,KAAK,MAAM,MAAM,IAAI,MAAA,IAAI,CAAC,WAAW,mCAAI,EAAE,EAAE;gBAC3C,IACE,CAAC,MAAA,MAAM,CAAC,QAAQ,mCAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBACzC,CAAC,MAAA,MAAM,CAAC,eAAe,mCAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAA,IAAI,CAAC,IAAI,0CAAE,EAAE,CAAC,EACtD;oBACA,MAAM,CAAC,IAAI,CAAC;wBACV,IAAI,EAAE,+BAA+B;wBACrC,KAAK,EAAE,IAAI,CAAC,IAAI;qBACjB,CAAC,CAAC;oBACH,MAAM,CAAC,8DAA8D;iBACtE;aACF;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAlJD,sBAkJC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxC,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ClickUpConverter } from './common';
|
|
4
|
+
export declare class Workspaces extends ClickUpConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Workspaces = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class Workspaces extends common_1.ClickUpConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [
|
|
9
|
+
'tms_Project',
|
|
10
|
+
'tms_User',
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
async convert(record, ctx) {
|
|
14
|
+
var _a;
|
|
15
|
+
const workspace = record.record.data;
|
|
16
|
+
const source = this.streamName.source;
|
|
17
|
+
const results = [];
|
|
18
|
+
results.push({
|
|
19
|
+
model: 'tms_Project',
|
|
20
|
+
record: {
|
|
21
|
+
uid: workspace.id,
|
|
22
|
+
name: workspace.name,
|
|
23
|
+
source,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
for (const member of (_a = workspace.members) !== null && _a !== void 0 ? _a : []) {
|
|
27
|
+
results.push({
|
|
28
|
+
model: 'tms_User',
|
|
29
|
+
record: {
|
|
30
|
+
uid: `${member.user.id}`,
|
|
31
|
+
emailAddress: member.user.email,
|
|
32
|
+
name: member.user.username,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return results;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Workspaces = Workspaces;
|
|
40
|
+
//# sourceMappingURL=workspaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../../src/converters/clickup/workspaces.ts"],"names":[],"mappings":";;;AAIA,qCAA0C;AAE1C,MAAa,UAAW,SAAQ,yBAAgB;IAAhD;;QACW,sBAAiB,GAAoC;YAC5D,aAAa;YACb,UAAU;SACX,CAAC;IA6BJ,CAAC;IA3BC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAiB,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QACtC,MAAM,OAAO,GAAwB,EAAE,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE;gBACN,GAAG,EAAE,SAAS,CAAC,EAAE;gBACjB,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,MAAM;aACP;SACF,CAAC,CAAC;QACH,KAAK,MAAM,MAAM,IAAI,MAAA,SAAS,CAAC,OAAO,mCAAI,EAAE,EAAE;YAC5C,OAAO,CAAC,IAAI,CAAC;gBACX,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE;oBACN,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE;oBACxB,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK;oBAC/B,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ;iBAC3B;aACF,CAAC,CAAC;SACJ;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAjCD,gCAiCC"}
|