airbyte-faros-destination 0.9.13 → 0.9.15
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/README.md +2 -1
- package/lib/converters/zendesk/common.d.ts +8 -0
- package/lib/converters/zendesk/common.js +18 -0
- package/lib/converters/zendesk/common.js.map +1 -0
- package/lib/converters/zendesk/tags.d.ts +7 -0
- package/lib/converters/zendesk/tags.js +25 -0
- package/lib/converters/zendesk/tags.js.map +1 -0
- package/lib/converters/zendesk/ticket_fields.d.ts +7 -0
- package/lib/converters/zendesk/ticket_fields.js +15 -0
- package/lib/converters/zendesk/ticket_fields.js.map +1 -0
- package/lib/converters/zendesk/ticket_metrics.d.ts +7 -0
- package/lib/converters/zendesk/ticket_metrics.js +15 -0
- package/lib/converters/zendesk/ticket_metrics.js.map +1 -0
- package/lib/converters/zendesk/tickets.d.ts +9 -0
- package/lib/converters/zendesk/tickets.js +124 -0
- package/lib/converters/zendesk/tickets.js.map +1 -0
- package/lib/converters/zendesk/users.d.ts +7 -0
- package/lib/converters/zendesk/users.js +31 -0
- package/lib/converters/zendesk/users.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { Converter, StreamName } from '../converter';
|
|
3
|
+
export declare const TicketMetricsStream: StreamName;
|
|
4
|
+
export declare const TicketFieldsStream: StreamName;
|
|
5
|
+
export declare abstract class ZendeskConverter extends Converter {
|
|
6
|
+
source: string;
|
|
7
|
+
id(record: AirbyteRecord): any;
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZendeskConverter = exports.TicketFieldsStream = exports.TicketMetricsStream = void 0;
|
|
4
|
+
const converter_1 = require("../converter");
|
|
5
|
+
exports.TicketMetricsStream = new converter_1.StreamName('zendesk', 'ticket_metrics');
|
|
6
|
+
exports.TicketFieldsStream = new converter_1.StreamName('zendesk', 'ticket_fields');
|
|
7
|
+
class ZendeskConverter extends converter_1.Converter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.source = 'Zendesk';
|
|
11
|
+
}
|
|
12
|
+
id(record) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
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;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ZendeskConverter = ZendeskConverter;
|
|
18
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/zendesk/common.ts"],"names":[],"mappings":";;;AAEA,4CAAmD;AAEtC,QAAA,mBAAmB,GAAG,IAAI,sBAAU,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAClE,QAAA,kBAAkB,GAAG,IAAI,sBAAU,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AAE7E,MAAsB,gBAAiB,SAAQ,qBAAS;IAAxD;;QACE,WAAM,GAAG,SAAS,CAAC;IAKrB,CAAC;IAHC,EAAE,CAAC,MAAqB;;QACtB,OAAO,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,IAAI,0CAAE,EAAE,CAAC;IAClC,CAAC;CACF;AAND,4CAMC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord } from '../converter';
|
|
3
|
+
import { ZendeskConverter } from './common';
|
|
4
|
+
export declare class Tags extends ZendeskConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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.ZendeskConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = ['tms_Label'];
|
|
9
|
+
}
|
|
10
|
+
async convert(record) {
|
|
11
|
+
var _a;
|
|
12
|
+
const name = (_a = record.record.data) === null || _a === void 0 ? void 0 : _a.name;
|
|
13
|
+
if (!name) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
model: 'tms_Label',
|
|
19
|
+
record: { name },
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Tags = Tags;
|
|
25
|
+
//# sourceMappingURL=tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../src/converters/zendesk/tags.ts"],"names":[],"mappings":";;;AAGA,qCAA0C;AAE1C,MAAa,IAAK,SAAQ,yBAAgB;IAA1C;;QACW,sBAAiB,GAAoC,CAAC,WAAW,CAAC,CAAC;IAgB9E,CAAC;IAdC,KAAK,CAAC,OAAO,CACX,MAAqB;;QAErB,MAAM,IAAI,GAAG,MAAA,MAAM,CAAC,MAAM,CAAC,IAAI,0CAAE,IAAI,CAAC;QACtC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;QACT,CAAC;QACD,OAAO;YACL;gBACE,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,EAAC,IAAI,EAAC;aACf;SACF,CAAC;IACJ,CAAC;CACF;AAjBD,oBAiBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ZendeskConverter } from './common';
|
|
4
|
+
export declare class TicketFields extends ZendeskConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TicketFields = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class TicketFields extends common_1.ZendeskConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TicketFields = TicketFields;
|
|
15
|
+
//# sourceMappingURL=ticket_fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticket_fields.js","sourceRoot":"","sources":["../../../src/converters/zendesk/ticket_fields.ts"],"names":[],"mappings":";;;AAGA,qCAA0C;AAE1C,MAAa,YAAa,SAAQ,yBAAgB;IAAlD;;QACW,sBAAiB,GAAoC,EAAE,CAAC;IAQnE,CAAC;IANC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AATD,oCASC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
|
+
import { ZendeskConverter } from './common';
|
|
4
|
+
export declare class TicketMetrics extends ZendeskConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TicketMetrics = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
class TicketMetrics extends common_1.ZendeskConverter {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.destinationModels = [];
|
|
9
|
+
}
|
|
10
|
+
async convert(record, ctx) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TicketMetrics = TicketMetrics;
|
|
15
|
+
//# sourceMappingURL=ticket_metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticket_metrics.js","sourceRoot":"","sources":["../../../src/converters/zendesk/ticket_metrics.ts"],"names":[],"mappings":";;;AAGA,qCAA0C;AAE1C,MAAa,aAAc,SAAQ,yBAAgB;IAAnD;;QACW,sBAAiB,GAAoC,EAAE,CAAC;IAQnE,CAAC;IANC,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;QAElB,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AATD,sCASC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext, StreamName } from '../converter';
|
|
3
|
+
import { ZendeskConverter } from './common';
|
|
4
|
+
export declare class Tickets extends ZendeskConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
get dependencies(): ReadonlyArray<StreamName>;
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
private toStatusCategory;
|
|
9
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tickets = void 0;
|
|
4
|
+
const faros_js_client_1 = require("faros-js-client");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
class Tickets extends common_1.ZendeskConverter {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.destinationModels = [
|
|
11
|
+
'tms_Task',
|
|
12
|
+
'tms_TaskAssignment',
|
|
13
|
+
'tms_TaskDependency',
|
|
14
|
+
'tms_TaskTag',
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
get dependencies() {
|
|
18
|
+
return [common_1.TicketMetricsStream, common_1.TicketFieldsStream];
|
|
19
|
+
}
|
|
20
|
+
async convert(record, ctx) {
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
22
|
+
const ticket = record.record.data;
|
|
23
|
+
const ticketId = ticket.id;
|
|
24
|
+
const taskKey = { uid: (0, lodash_1.toString)(ticketId), source: this.streamName.source };
|
|
25
|
+
const recs = [];
|
|
26
|
+
const allMetrics = ctx.getAll(common_1.TicketMetricsStream.asString);
|
|
27
|
+
const metricsRecord = Object.values(allMetrics).find((v) => v.record.data.ticket_id === ticketId);
|
|
28
|
+
const metrics = (_a = metricsRecord === null || metricsRecord === void 0 ? void 0 : metricsRecord.record) === null || _a === void 0 ? void 0 : _a.data;
|
|
29
|
+
const ticketFields = ctx.getAll(common_1.TicketFieldsStream.asString);
|
|
30
|
+
const customStatusRecord = Object.values(ticketFields).find((v) => v.record.data.type === 'custom_status');
|
|
31
|
+
const customStatuses = (_c = (_b = customStatusRecord === null || customStatusRecord === void 0 ? void 0 : customStatusRecord.record) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.custom_statuses;
|
|
32
|
+
const customStatus = customStatuses === null || customStatuses === void 0 ? void 0 : customStatuses.find((v) => v.id === ticket.custom_status_id);
|
|
33
|
+
const statusLabel = customStatus === null || customStatus === void 0 ? void 0 : customStatus.agent_label;
|
|
34
|
+
const additionalFields = [];
|
|
35
|
+
for (const field of (_d = ticket.fields) !== null && _d !== void 0 ? _d : []) {
|
|
36
|
+
const fieldsRecord = ctx.get(common_1.TicketFieldsStream.asString, field.id);
|
|
37
|
+
const fieldName = (_f = (_e = fieldsRecord === null || fieldsRecord === void 0 ? void 0 : fieldsRecord.record) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.title;
|
|
38
|
+
if (!fieldName)
|
|
39
|
+
continue;
|
|
40
|
+
additionalFields.push({ name: fieldName, value: field.value });
|
|
41
|
+
}
|
|
42
|
+
const resolution = (metrics === null || metrics === void 0 ? void 0 : metrics.solved_at)
|
|
43
|
+
? {
|
|
44
|
+
resolvedAt: faros_js_client_1.Utils.toDate(metrics === null || metrics === void 0 ? void 0 : metrics.solved_at),
|
|
45
|
+
resolutionStatus: ticket.status,
|
|
46
|
+
}
|
|
47
|
+
: {};
|
|
48
|
+
// TODO - Add handle for additional fields
|
|
49
|
+
const task = {
|
|
50
|
+
...taskKey,
|
|
51
|
+
...resolution,
|
|
52
|
+
name: ticket.subject,
|
|
53
|
+
description: faros_js_client_1.Utils.cleanAndTruncate(ticket.description),
|
|
54
|
+
url: ticket.url,
|
|
55
|
+
type: {
|
|
56
|
+
category: 'SupportCase',
|
|
57
|
+
detail: ticket.type,
|
|
58
|
+
},
|
|
59
|
+
status: this.toStatusCategory(ticket.status, statusLabel),
|
|
60
|
+
priority: ticket.priority,
|
|
61
|
+
createdAt: faros_js_client_1.Utils.toDate(ticket.created_at),
|
|
62
|
+
updatedAt: faros_js_client_1.Utils.toDate(ticket.updated_at),
|
|
63
|
+
// TODO - Enable when due_at is released
|
|
64
|
+
// dueAt: Utils.toDate(ticket.due_at),
|
|
65
|
+
statusChangedAt: faros_js_client_1.Utils.toDate(metrics === null || metrics === void 0 ? void 0 : metrics.status_updated_at),
|
|
66
|
+
creator: ticket.submitter_id
|
|
67
|
+
? { uid: (0, lodash_1.toString)(ticket.submitter_id), source: this.source }
|
|
68
|
+
: null,
|
|
69
|
+
additionalFields,
|
|
70
|
+
};
|
|
71
|
+
recs.push({ model: 'tms_Task', record: task });
|
|
72
|
+
if (ticket.assignee_id) {
|
|
73
|
+
recs.push({
|
|
74
|
+
model: 'tms_TaskAssignment',
|
|
75
|
+
record: {
|
|
76
|
+
task: taskKey,
|
|
77
|
+
assignee: {
|
|
78
|
+
uid: (0, lodash_1.toString)(ticket.assignee_id),
|
|
79
|
+
source: this.source,
|
|
80
|
+
},
|
|
81
|
+
assignedAt: faros_js_client_1.Utils.toDate(metrics === null || metrics === void 0 ? void 0 : metrics.assigned_at),
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
for (const tag of (_g = ticket.tags) !== null && _g !== void 0 ? _g : []) {
|
|
86
|
+
const label = { name: tag };
|
|
87
|
+
recs.push({
|
|
88
|
+
model: 'tms_TaskTag',
|
|
89
|
+
record: { label, task: taskKey },
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// Tickets created as a followup to this ticket
|
|
93
|
+
for (const id of (_h = ticket.followup_ids) !== null && _h !== void 0 ? _h : []) {
|
|
94
|
+
recs.push({
|
|
95
|
+
model: 'tms_TaskDependency',
|
|
96
|
+
record: {
|
|
97
|
+
dependentTask: { uid: (0, lodash_1.toString)(id), source: this.source },
|
|
98
|
+
fulfillingTask: taskKey,
|
|
99
|
+
dependencyType: { category: 'CreatedBy' },
|
|
100
|
+
fulfillingType: { category: 'Created' },
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return recs;
|
|
105
|
+
}
|
|
106
|
+
toStatusCategory(status, label) {
|
|
107
|
+
const detail = label !== null && label !== void 0 ? label : status;
|
|
108
|
+
switch ((0, lodash_1.toLower)(status)) {
|
|
109
|
+
case 'new':
|
|
110
|
+
return { category: 'Todo', detail };
|
|
111
|
+
case 'open':
|
|
112
|
+
case 'pending':
|
|
113
|
+
case 'hold':
|
|
114
|
+
return { category: 'InProgress', detail };
|
|
115
|
+
case 'solved':
|
|
116
|
+
case 'closed':
|
|
117
|
+
return { category: 'Done', detail };
|
|
118
|
+
default:
|
|
119
|
+
return { category: 'Custom', detail };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.Tickets = Tickets;
|
|
124
|
+
//# sourceMappingURL=tickets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tickets.js","sourceRoot":"","sources":["../../../src/converters/zendesk/tickets.ts"],"names":[],"mappings":";;;AACA,qDAAsC;AACtC,mCAAyC;AAQzC,qCAIkB;AAElB,MAAa,OAAQ,SAAQ,yBAAgB;IAA7C;;QACW,sBAAiB,GAAoC;YAC5D,UAAU;YACV,oBAAoB;YACpB,oBAAoB;YACpB,aAAa;SACd,CAAC;IAiIJ,CAAC;IA/HC,IAAa,YAAY;QACvB,OAAO,CAAC,4BAAmB,EAAE,2BAAkB,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAqB,EACrB,GAAkB;;QAElB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,EAAC,GAAG,EAAE,IAAA,iBAAQ,EAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAC,CAAC;QAC1E,MAAM,IAAI,GAAG,EAAE,CAAC;QAEhB,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,4BAAmB,CAAC,QAAQ,CAAC,CAAC;QAC5D,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAClD,CAAC,CAAC,EAAE,EAAE,CAAC,C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BAAgB,CACtB,MAAc,EACd,KAAc;QAEd,MAAM,MAAM,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,MAAM,CAAC;QAC/B,QAAQ,IAAA,gBAAO,EAAC,MAAM,CAAC,EAAE,CAAC;YACxB,KAAK,KAAK;gBACR,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC;YACpC,KAAK,MAAM,CAAC;YACZ,KAAK,SAAS,CAAC;YACf,KAAK,MAAM;gBACT,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAC,CAAC;YAC1C,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ;gBACX,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC;YACpC;gBACE,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AAvID,0BAuIC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { DestinationModel, DestinationRecord } from '../converter';
|
|
3
|
+
import { ZendeskConverter } from './common';
|
|
4
|
+
export declare class Users extends ZendeskConverter {
|
|
5
|
+
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
|
+
convert(record: AirbyteRecord): Promise<ReadonlyArray<DestinationRecord>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Users = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const common_1 = require("./common");
|
|
6
|
+
class Users extends common_1.ZendeskConverter {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.destinationModels = ['tms_User'];
|
|
10
|
+
}
|
|
11
|
+
async convert(record) {
|
|
12
|
+
const user = record.record.data;
|
|
13
|
+
if (!user.id) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
model: 'tms_User',
|
|
19
|
+
record: {
|
|
20
|
+
uid: (0, lodash_1.toString)(user.id),
|
|
21
|
+
name: user.name,
|
|
22
|
+
emailAddress: user.email,
|
|
23
|
+
inactive: user.active === false || user.suspended ? true : false,
|
|
24
|
+
source: this.source,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.Users = Users;
|
|
31
|
+
//# sourceMappingURL=users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../../src/converters/zendesk/users.ts"],"names":[],"mappings":";;;AACA,mCAAgC;AAGhC,qCAA0C;AAE1C,MAAa,KAAM,SAAQ,yBAAgB;IAA3C;;QACW,sBAAiB,GAAoC,CAAC,UAAU,CAAC,CAAC;IAsB7E,CAAC;IApBC,KAAK,CAAC,OAAO,CACX,MAAqB;QAErB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO;YACL;gBACE,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE;oBACN,GAAG,EAAE,IAAA,iBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;oBACtB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,YAAY,EAAE,IAAI,CAAC,KAAK;oBACxB,QAAQ,EAAE,IAAI,CAAC,MAAM,KAAK,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;oBAChE,MAAM,EAAE,IAAI,CAAC,MAAM;iBACpB;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAvBD,sBAuBC"}
|