@pipedream/topdesk 0.1.0 → 0.3.0
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/actions/create-incident/create-incident.mjs +1 -1
- package/actions/get-incident/get-incident.mjs +1 -1
- package/actions/get-incident-actions-by-id/get-incident-actions-by-id.mjs +81 -0
- package/actions/get-incident-actions-by-number/get-incident-actions-by-number.mjs +91 -0
- package/actions/get-incident-progress-trail-by-id/get-incident-progress-trail-by-id.mjs +83 -0
- package/actions/get-incident-progress-trail-by-number/get-incident-progress-trail-by-number.mjs +93 -0
- package/actions/get-incidents/get-incidents.mjs +1 -1
- package/actions/get-knowledge-item-statuses/get-knowledge-item-statuses.mjs +1 -1
- package/actions/get-knowledge-items/get-knowledge-items.mjs +1 -1
- package/actions/update-incident/update-incident.mjs +1 -1
- package/package.json +2 -2
- package/sources/common/base-polling.mjs +99 -0
- package/sources/incident-updated/incident-updated.mjs +28 -0
- package/sources/new-incident-assignee/new-incident-assignee.mjs +52 -0
- package/sources/new-incident-created/new-incident-created.mjs +30 -0
- package/sources/new-incident-group-assigned/new-incident-group-assigned.mjs +52 -0
- package/sources/new-incident-memo-reply/new-incident-memo-reply.mjs +52 -0
- package/sources/new-incident-reply/new-incident-reply.mjs +52 -0
- package/sources/new-incident-status/new-incident-status.mjs +52 -0
- package/topdesk.app.mjs +61 -8
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "topdesk-create-incident",
|
|
5
5
|
name: "Create Incident",
|
|
6
6
|
description: "Creates a new incident. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/createIncident)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "topdesk-get-incident",
|
|
5
5
|
name: "Get Incident",
|
|
6
6
|
description: "Returns an incident by ID. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/getIncidentById)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import app from "../../topdesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "topdesk-get-incident-actions-by-id",
|
|
5
|
+
name: "Get Incident Actions By ID",
|
|
6
|
+
description: "Get incident actions by incident ID. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/progress%20trail%20%2F%20actions%20%2F%20requests/getIncidentActionsById)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
app,
|
|
11
|
+
incidentId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
app,
|
|
14
|
+
"incidentId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
maxResults: {
|
|
18
|
+
type: "integer",
|
|
19
|
+
label: "Max Results",
|
|
20
|
+
description: "Maximum number of actions to return",
|
|
21
|
+
optional: true,
|
|
22
|
+
},
|
|
23
|
+
inlineImages: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
app,
|
|
26
|
+
"inlineImages",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
forceImagesAsData: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
app,
|
|
32
|
+
"forceImagesAsData",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
nonApiAttachmentUrls: {
|
|
36
|
+
propDefinition: [
|
|
37
|
+
app,
|
|
38
|
+
"nonApiAttachmentUrls",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
annotations: {
|
|
43
|
+
readOnlyHint: true,
|
|
44
|
+
destructiveHint: false,
|
|
45
|
+
openWorldHint: true,
|
|
46
|
+
},
|
|
47
|
+
async run({ $ }) {
|
|
48
|
+
const {
|
|
49
|
+
app,
|
|
50
|
+
incidentId,
|
|
51
|
+
maxResults,
|
|
52
|
+
inlineImages,
|
|
53
|
+
forceImagesAsData,
|
|
54
|
+
nonApiAttachmentUrls,
|
|
55
|
+
} = this;
|
|
56
|
+
|
|
57
|
+
const results = [];
|
|
58
|
+
|
|
59
|
+
const paginator = app.paginate({
|
|
60
|
+
fn: app.getIncidentActionsById,
|
|
61
|
+
fnArgs: {
|
|
62
|
+
$,
|
|
63
|
+
incidentId,
|
|
64
|
+
params: {
|
|
65
|
+
inlineimages: inlineImages,
|
|
66
|
+
force_images_as_data: forceImagesAsData,
|
|
67
|
+
non_api_attachment_urls: nonApiAttachmentUrls,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
maxResults,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
for await (const action of paginator) {
|
|
74
|
+
results.push(action);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
$.export("$summary", `Successfully retrieved ${results.length} action(s) for incident ID \`${incidentId}\``);
|
|
78
|
+
|
|
79
|
+
return results;
|
|
80
|
+
},
|
|
81
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import app from "../../topdesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "topdesk-get-incident-actions-by-number",
|
|
5
|
+
name: "Get Incident Actions By Number",
|
|
6
|
+
description: "Get incident actions by incident number. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/progress%20trail%20%2F%20actions%20%2F%20requests/getIncidentActionsByNumber)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
app,
|
|
11
|
+
incidentNumber: {
|
|
12
|
+
label: "Incident Number",
|
|
13
|
+
description: "The number of the incident",
|
|
14
|
+
propDefinition: [
|
|
15
|
+
app,
|
|
16
|
+
"incidentId",
|
|
17
|
+
() => ({
|
|
18
|
+
mapper: (incident) => ({
|
|
19
|
+
label: incident.briefDescription
|
|
20
|
+
? `${incident.number} - ${incident.briefDescription}`
|
|
21
|
+
: incident.number,
|
|
22
|
+
value: incident.number,
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
maxResults: {
|
|
28
|
+
type: "integer",
|
|
29
|
+
label: "Max Results",
|
|
30
|
+
description: "Maximum number of actions to return",
|
|
31
|
+
optional: true,
|
|
32
|
+
},
|
|
33
|
+
inlineImages: {
|
|
34
|
+
propDefinition: [
|
|
35
|
+
app,
|
|
36
|
+
"inlineImages",
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
forceImagesAsData: {
|
|
40
|
+
propDefinition: [
|
|
41
|
+
app,
|
|
42
|
+
"forceImagesAsData",
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
nonApiAttachmentUrls: {
|
|
46
|
+
propDefinition: [
|
|
47
|
+
app,
|
|
48
|
+
"nonApiAttachmentUrls",
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
annotations: {
|
|
53
|
+
readOnlyHint: true,
|
|
54
|
+
destructiveHint: false,
|
|
55
|
+
openWorldHint: true,
|
|
56
|
+
},
|
|
57
|
+
async run({ $ }) {
|
|
58
|
+
const {
|
|
59
|
+
app,
|
|
60
|
+
incidentNumber,
|
|
61
|
+
maxResults,
|
|
62
|
+
inlineImages,
|
|
63
|
+
forceImagesAsData,
|
|
64
|
+
nonApiAttachmentUrls,
|
|
65
|
+
} = this;
|
|
66
|
+
|
|
67
|
+
const results = [];
|
|
68
|
+
|
|
69
|
+
const paginator = app.paginate({
|
|
70
|
+
fn: app.getIncidentActionsByNumber,
|
|
71
|
+
fnArgs: {
|
|
72
|
+
$,
|
|
73
|
+
number: incidentNumber,
|
|
74
|
+
params: {
|
|
75
|
+
inlineimages: inlineImages,
|
|
76
|
+
force_images_as_data: forceImagesAsData,
|
|
77
|
+
non_api_attachment_urls: nonApiAttachmentUrls,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
maxResults,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
for await (const action of paginator) {
|
|
84
|
+
results.push(action);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
$.export("$summary", `Successfully retrieved ${results.length} action(s) for incident number \`${incidentNumber}\``);
|
|
88
|
+
|
|
89
|
+
return results;
|
|
90
|
+
},
|
|
91
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import app from "../../topdesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "topdesk-get-incident-progress-trail-by-id",
|
|
5
|
+
name: "Get Incident Progress Trail By ID",
|
|
6
|
+
description: "Get incident progress trail by incident ID. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/progress%20trail%20%2F%20actions%20%2F%20requests/getIncidentProgressTrailById)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
app,
|
|
11
|
+
incidentId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
app,
|
|
14
|
+
"incidentId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
maxResults: {
|
|
18
|
+
type: "integer",
|
|
19
|
+
label: "Max Results",
|
|
20
|
+
description: "Maximum number of progress trail entries to return",
|
|
21
|
+
optional: true,
|
|
22
|
+
},
|
|
23
|
+
inlineImages: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
app,
|
|
26
|
+
"inlineImages",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
forceImagesAsData: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
app,
|
|
32
|
+
"forceImagesAsData",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
nonApiAttachmentUrls: {
|
|
36
|
+
propDefinition: [
|
|
37
|
+
app,
|
|
38
|
+
"nonApiAttachmentUrls",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
annotations: {
|
|
43
|
+
readOnlyHint: true,
|
|
44
|
+
destructiveHint: false,
|
|
45
|
+
openWorldHint: true,
|
|
46
|
+
},
|
|
47
|
+
async run({ $ }) {
|
|
48
|
+
const {
|
|
49
|
+
app,
|
|
50
|
+
incidentId,
|
|
51
|
+
maxResults,
|
|
52
|
+
inlineImages,
|
|
53
|
+
forceImagesAsData,
|
|
54
|
+
nonApiAttachmentUrls,
|
|
55
|
+
} = this;
|
|
56
|
+
|
|
57
|
+
const results = [];
|
|
58
|
+
|
|
59
|
+
const paginator = app.paginate({
|
|
60
|
+
fn: app.getIncidentProgressTrailById,
|
|
61
|
+
fnArgs: {
|
|
62
|
+
$,
|
|
63
|
+
incidentId,
|
|
64
|
+
params: {
|
|
65
|
+
inlineimages: inlineImages,
|
|
66
|
+
force_images_as_data: forceImagesAsData,
|
|
67
|
+
non_api_attachment_urls: nonApiAttachmentUrls,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
maxResults,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
for await (const entry of paginator) {
|
|
74
|
+
results.push(entry);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
$.export("$summary", `Successfully retrieved ${results.length} progress trail entr${results.length === 1
|
|
78
|
+
? "y"
|
|
79
|
+
: "ies"} for incident ID \`${incidentId}\``);
|
|
80
|
+
|
|
81
|
+
return results;
|
|
82
|
+
},
|
|
83
|
+
};
|
package/actions/get-incident-progress-trail-by-number/get-incident-progress-trail-by-number.mjs
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import app from "../../topdesk.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "topdesk-get-incident-progress-trail-by-number",
|
|
5
|
+
name: "Get Incident Progress Trail By Number",
|
|
6
|
+
description: "Get incident progress trail by incident number. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/progress%20trail%20%2F%20actions%20%2F%20requests/getIncidentProgressTrailByNumber)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
app,
|
|
11
|
+
incidentNumber: {
|
|
12
|
+
label: "Incident Number",
|
|
13
|
+
description: "The number of the incident",
|
|
14
|
+
propDefinition: [
|
|
15
|
+
app,
|
|
16
|
+
"incidentId",
|
|
17
|
+
() => ({
|
|
18
|
+
mapper: (incident) => ({
|
|
19
|
+
label: incident.briefDescription
|
|
20
|
+
? `${incident.number} - ${incident.briefDescription}`
|
|
21
|
+
: incident.number,
|
|
22
|
+
value: incident.number,
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
maxResults: {
|
|
28
|
+
type: "integer",
|
|
29
|
+
label: "Max Results",
|
|
30
|
+
description: "Maximum number of progress trail entries to return",
|
|
31
|
+
optional: true,
|
|
32
|
+
},
|
|
33
|
+
inlineImages: {
|
|
34
|
+
propDefinition: [
|
|
35
|
+
app,
|
|
36
|
+
"inlineImages",
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
forceImagesAsData: {
|
|
40
|
+
propDefinition: [
|
|
41
|
+
app,
|
|
42
|
+
"forceImagesAsData",
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
nonApiAttachmentUrls: {
|
|
46
|
+
propDefinition: [
|
|
47
|
+
app,
|
|
48
|
+
"nonApiAttachmentUrls",
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
annotations: {
|
|
53
|
+
readOnlyHint: true,
|
|
54
|
+
destructiveHint: false,
|
|
55
|
+
openWorldHint: true,
|
|
56
|
+
},
|
|
57
|
+
async run({ $ }) {
|
|
58
|
+
const {
|
|
59
|
+
app,
|
|
60
|
+
incidentNumber,
|
|
61
|
+
maxResults,
|
|
62
|
+
inlineImages,
|
|
63
|
+
forceImagesAsData,
|
|
64
|
+
nonApiAttachmentUrls,
|
|
65
|
+
} = this;
|
|
66
|
+
|
|
67
|
+
const results = [];
|
|
68
|
+
|
|
69
|
+
const paginator = app.paginate({
|
|
70
|
+
fn: app.getIncidentProgressTrailByNumber,
|
|
71
|
+
fnArgs: {
|
|
72
|
+
$,
|
|
73
|
+
number: incidentNumber,
|
|
74
|
+
params: {
|
|
75
|
+
inlineimages: inlineImages,
|
|
76
|
+
force_images_as_data: forceImagesAsData,
|
|
77
|
+
non_api_attachment_urls: nonApiAttachmentUrls,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
maxResults,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
for await (const entry of paginator) {
|
|
84
|
+
results.push(entry);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
$.export("$summary", `Successfully retrieved ${results.length} progress trail entr${results.length === 1
|
|
88
|
+
? "y"
|
|
89
|
+
: "ies"} for incident number \`${incidentNumber}\``);
|
|
90
|
+
|
|
91
|
+
return results;
|
|
92
|
+
},
|
|
93
|
+
};
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "topdesk-get-incidents",
|
|
5
5
|
name: "Get Incidents",
|
|
6
6
|
description: "Returns a list of incidents. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/getIncidents)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "topdesk-get-knowledge-item-statuses",
|
|
5
5
|
name: "Get Knowledge Item Statuses",
|
|
6
6
|
description: "Returns the list of possible Knowledge Item statuses. [See the documentation](https://developers.topdesk.com/explorer/?page=knowledge-base#/Searchlists/getStatuses)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "topdesk-get-knowledge-items",
|
|
5
5
|
name: "Get Knowledge Items",
|
|
6
6
|
description: "Returns a list of Knowledge Items. [See the documentation](https://developers.topdesk.com/explorer/?page=knowledge-base#/Knowledge%20Items/getKnowledgeItems)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "topdesk-update-incident",
|
|
5
5
|
name: "Update Incident",
|
|
6
6
|
description: "Updates an existing incident. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/patchIncident)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.3",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/topdesk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Pipedream TOPdesk Components",
|
|
5
5
|
"main": "topdesk.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@pipedream/platform": "^3.1.
|
|
16
|
+
"@pipedream/platform": "^3.1.1"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import topdesk from "../../topdesk.app.mjs";
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, ConfigurationError,
|
|
4
|
+
} from "@pipedream/platform";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
props: {
|
|
8
|
+
topdesk,
|
|
9
|
+
db: "$.service.db",
|
|
10
|
+
timer: {
|
|
11
|
+
type: "$.interface.timer",
|
|
12
|
+
default: {
|
|
13
|
+
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
_getLastTs() {
|
|
19
|
+
return this.db.get("lastTs") || 0;
|
|
20
|
+
},
|
|
21
|
+
_setLastTs(lastTs) {
|
|
22
|
+
this.db.set("lastTs", lastTs);
|
|
23
|
+
},
|
|
24
|
+
_getPreviousValue() {
|
|
25
|
+
return this.db.get("previousValue");
|
|
26
|
+
},
|
|
27
|
+
_setPreviousValue(previousValue) {
|
|
28
|
+
this.db.set("previousValue", previousValue);
|
|
29
|
+
},
|
|
30
|
+
getArgs() {
|
|
31
|
+
return {};
|
|
32
|
+
},
|
|
33
|
+
getTsField() {
|
|
34
|
+
return "modificationDate";
|
|
35
|
+
},
|
|
36
|
+
paginateResults() {
|
|
37
|
+
return false;
|
|
38
|
+
},
|
|
39
|
+
isRelevant() {
|
|
40
|
+
return true;
|
|
41
|
+
},
|
|
42
|
+
async getPaginatedResources(opts = {}) {
|
|
43
|
+
const results = this.topdesk.paginate(opts);
|
|
44
|
+
const items = [];
|
|
45
|
+
for await (const result of results) {
|
|
46
|
+
items.push(result);
|
|
47
|
+
}
|
|
48
|
+
return items;
|
|
49
|
+
},
|
|
50
|
+
async processEvents(max) {
|
|
51
|
+
const lastTs = this._getLastTs();
|
|
52
|
+
let maxTs = lastTs;
|
|
53
|
+
|
|
54
|
+
const resourceFn = this.getResourceFn();
|
|
55
|
+
const args = this.getArgs();
|
|
56
|
+
const tsField = this.getTsField();
|
|
57
|
+
|
|
58
|
+
const results = this.paginateResults()
|
|
59
|
+
? await this.getPaginatedResources({
|
|
60
|
+
fn: resourceFn,
|
|
61
|
+
fnArgs: args,
|
|
62
|
+
maxResults: max,
|
|
63
|
+
})
|
|
64
|
+
: [
|
|
65
|
+
await resourceFn(args),
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
if (!results.length) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
for (const result of results.reverse()) {
|
|
73
|
+
const ts = Date.parse(result[tsField]);
|
|
74
|
+
if (ts >= lastTs) {
|
|
75
|
+
maxTs = Math.max(ts, maxTs);
|
|
76
|
+
if (this.isRelevant(result)) {
|
|
77
|
+
this.$emit(result, this.generateMeta(result));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this._setLastTs(maxTs);
|
|
83
|
+
},
|
|
84
|
+
getResourceFn() {
|
|
85
|
+
throw new ConfigurationError("getResourceFn must be implemented");
|
|
86
|
+
},
|
|
87
|
+
generateMeta() {
|
|
88
|
+
throw new ConfigurationError("generateMeta must be implemented");
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
hooks: {
|
|
92
|
+
async deploy() {
|
|
93
|
+
await this.processEvents(10);
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
async run() {
|
|
97
|
+
await this.processEvents();
|
|
98
|
+
},
|
|
99
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import common from "../common/base-polling.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "topdesk-incident-updated",
|
|
6
|
+
name: "Incident Updated",
|
|
7
|
+
description: "Emit new event when an incident is updated. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/get_incidents)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getResourceFn() {
|
|
14
|
+
return this.topdesk.listIncidents;
|
|
15
|
+
},
|
|
16
|
+
paginateResults() {
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
generateMeta(incident) {
|
|
20
|
+
const ts = Date.parse(incident.modificationDate);
|
|
21
|
+
return {
|
|
22
|
+
id: `${incident.id}-${ts}`,
|
|
23
|
+
summary: `Incident Updated: ${incident.id}`,
|
|
24
|
+
ts,
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import common from "../common/base-polling.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "topdesk-new-incident-assignee",
|
|
6
|
+
name: "New Incident Assignee",
|
|
7
|
+
description: "Emit new event when an incident is assigned to a new user. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/get_incidents_id__id_)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
props: {
|
|
12
|
+
...common.props,
|
|
13
|
+
incidentId: {
|
|
14
|
+
propDefinition: [
|
|
15
|
+
common.props.topdesk,
|
|
16
|
+
"incidentId",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
...common.methods,
|
|
22
|
+
getResourceFn() {
|
|
23
|
+
return this.topdesk.getIncident;
|
|
24
|
+
},
|
|
25
|
+
getArgs() {
|
|
26
|
+
return {
|
|
27
|
+
incidentId: this.incidentId,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
getTsField() {
|
|
31
|
+
return "modificationDate";
|
|
32
|
+
},
|
|
33
|
+
paginateResults() {
|
|
34
|
+
return false;
|
|
35
|
+
},
|
|
36
|
+
isRelevant(incident) {
|
|
37
|
+
const previousValue = this._getPreviousValue();
|
|
38
|
+
if (incident.operator?.id !== previousValue) {
|
|
39
|
+
this._setPreviousValue(incident.operator?.id);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
},
|
|
44
|
+
generateMeta(incident) {
|
|
45
|
+
return {
|
|
46
|
+
id: incident.id,
|
|
47
|
+
summary: `New Incident Assignee: ${incident.operator?.name || `ID: ${incident.operator?.id}`}`,
|
|
48
|
+
ts: Date.parse(incident.modificationDate),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import common from "../common/base-polling.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "topdesk-new-incident-created",
|
|
6
|
+
name: "New Incident Created",
|
|
7
|
+
description: "Emit new event when a new incident is created. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/get_incidents)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getResourceFn() {
|
|
14
|
+
return this.topdesk.listIncidents;
|
|
15
|
+
},
|
|
16
|
+
getTsField() {
|
|
17
|
+
return "creationDate";
|
|
18
|
+
},
|
|
19
|
+
paginateResults() {
|
|
20
|
+
return true;
|
|
21
|
+
},
|
|
22
|
+
generateMeta(incident) {
|
|
23
|
+
return {
|
|
24
|
+
id: incident.id,
|
|
25
|
+
summary: `New Incident: ${incident.id}`,
|
|
26
|
+
ts: Date.parse(incident.creationDate),
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import common from "../common/base-polling.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "topdesk-new-incident-group-assigned",
|
|
6
|
+
name: "New Incident Group Assigned",
|
|
7
|
+
description: "Emit new event when an incident is assigned to a new group. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/get_incidents_id__id_)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
props: {
|
|
12
|
+
...common.props,
|
|
13
|
+
incidentId: {
|
|
14
|
+
propDefinition: [
|
|
15
|
+
common.props.topdesk,
|
|
16
|
+
"incidentId",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
...common.methods,
|
|
22
|
+
getResourceFn() {
|
|
23
|
+
return this.topdesk.getIncident;
|
|
24
|
+
},
|
|
25
|
+
getArgs() {
|
|
26
|
+
return {
|
|
27
|
+
incidentId: this.incidentId,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
getTsField() {
|
|
31
|
+
return "modificationDate";
|
|
32
|
+
},
|
|
33
|
+
paginateResults() {
|
|
34
|
+
return false;
|
|
35
|
+
},
|
|
36
|
+
isRelevant(incident) {
|
|
37
|
+
const previousValue = this._getPreviousValue();
|
|
38
|
+
if (incident.caller.department?.id !== previousValue) {
|
|
39
|
+
this._setPreviousValue(incident.caller.department?.id);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
},
|
|
44
|
+
generateMeta(incident) {
|
|
45
|
+
return {
|
|
46
|
+
id: incident.id,
|
|
47
|
+
summary: `New Incident Group Assigned: ${incident.caller.department?.name || `ID: ${incident.caller.department?.id}`}`,
|
|
48
|
+
ts: Date.parse(incident.modificationDate),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import common from "../common/base-polling.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "topdesk-new-incident-memo-reply",
|
|
6
|
+
name: "New Incident Memo Reply",
|
|
7
|
+
description: "Emit new event when a new memo reply is created. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/progress%20trail%20%2F%20actions%20%2F%20requests/get_incidents_id__id__progresstrail)",
|
|
8
|
+
version: "0.0.3",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
props: {
|
|
12
|
+
...common.props,
|
|
13
|
+
incidentId: {
|
|
14
|
+
propDefinition: [
|
|
15
|
+
common.props.topdesk,
|
|
16
|
+
"incidentId",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
...common.methods,
|
|
22
|
+
getResourceFn() {
|
|
23
|
+
return this.topdesk.getIncidentProgressTrailById;
|
|
24
|
+
},
|
|
25
|
+
getArgs() {
|
|
26
|
+
return {
|
|
27
|
+
incidentId: this.incidentId,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
getTsField() {
|
|
31
|
+
return "creationDate";
|
|
32
|
+
},
|
|
33
|
+
paginateResults() {
|
|
34
|
+
return true;
|
|
35
|
+
},
|
|
36
|
+
isRelevant(item) {
|
|
37
|
+
const previousValue = this._getPreviousValue();
|
|
38
|
+
if (item.memoText !== previousValue) {
|
|
39
|
+
this._setPreviousValue(item.memoText);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
},
|
|
44
|
+
generateMeta(item) {
|
|
45
|
+
return {
|
|
46
|
+
id: item.id,
|
|
47
|
+
summary: `New Incident Memo Reply: ${item.memoText}`,
|
|
48
|
+
ts: Date.parse(item.creationDate),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import common from "../common/base-polling.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "topdesk-new-incident-reply",
|
|
6
|
+
name: "New Incident Reply",
|
|
7
|
+
description: "Emit new event when a new incident reply is created. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/progress%20trail%20%2F%20actions%20%2F%20requests/get_incidents_id__id__progresstrail)",
|
|
8
|
+
version: "0.0.3",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
props: {
|
|
12
|
+
...common.props,
|
|
13
|
+
incidentId: {
|
|
14
|
+
propDefinition: [
|
|
15
|
+
common.props.topdesk,
|
|
16
|
+
"incidentId",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
...common.methods,
|
|
22
|
+
getResourceFn() {
|
|
23
|
+
return this.topdesk.getIncidentProgressTrailById;
|
|
24
|
+
},
|
|
25
|
+
getArgs() {
|
|
26
|
+
return {
|
|
27
|
+
incidentId: this.incidentId,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
getTsField() {
|
|
31
|
+
return "creationDate";
|
|
32
|
+
},
|
|
33
|
+
paginateResults() {
|
|
34
|
+
return true;
|
|
35
|
+
},
|
|
36
|
+
isRelevant(item) {
|
|
37
|
+
const previousValue = this._getPreviousValue();
|
|
38
|
+
if (item.plainText !== previousValue) {
|
|
39
|
+
this._setPreviousValue(item.plainText);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
},
|
|
44
|
+
generateMeta(item) {
|
|
45
|
+
return {
|
|
46
|
+
id: item.id,
|
|
47
|
+
summary: `New Incident Reply: ${item.plainText}`,
|
|
48
|
+
ts: Date.parse(item.creationDate),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import common from "../common/base-polling.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
key: "topdesk-new-incident-status",
|
|
6
|
+
name: "New Incident Status",
|
|
7
|
+
description: "Emit new event when an incident status is updated. [See the documentation](https://developers.topdesk.com/explorer/?page=incident#/incident/get_incidents_id__id_)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
type: "source",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
props: {
|
|
12
|
+
...common.props,
|
|
13
|
+
incidentId: {
|
|
14
|
+
propDefinition: [
|
|
15
|
+
common.props.topdesk,
|
|
16
|
+
"incidentId",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
...common.methods,
|
|
22
|
+
getResourceFn() {
|
|
23
|
+
return this.topdesk.getIncident;
|
|
24
|
+
},
|
|
25
|
+
getArgs() {
|
|
26
|
+
return {
|
|
27
|
+
incidentId: this.incidentId,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
getTsField() {
|
|
31
|
+
return "modificationDate";
|
|
32
|
+
},
|
|
33
|
+
paginateResults() {
|
|
34
|
+
return false;
|
|
35
|
+
},
|
|
36
|
+
isRelevant(incident) {
|
|
37
|
+
const previousValue = this._getPreviousValue();
|
|
38
|
+
if (incident.processingStatus?.id !== previousValue) {
|
|
39
|
+
this._setPreviousValue(incident.processingStatus?.id);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
},
|
|
44
|
+
generateMeta(incident) {
|
|
45
|
+
return {
|
|
46
|
+
id: incident.id,
|
|
47
|
+
summary: `New Incident Status: ${incident.processingStatus?.name || `ID: ${incident.processingStatus?.id}`}`,
|
|
48
|
+
ts: Date.parse(incident.modificationDate),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
package/topdesk.app.mjs
CHANGED
|
@@ -8,7 +8,15 @@ export default {
|
|
|
8
8
|
type: "string",
|
|
9
9
|
label: "Incident ID",
|
|
10
10
|
description: "The UUID of the incident",
|
|
11
|
-
async options({
|
|
11
|
+
async options({
|
|
12
|
+
prevContext,
|
|
13
|
+
mapper = (incident) => ({
|
|
14
|
+
label: incident.briefDescription
|
|
15
|
+
? `${incident.number} - ${incident.briefDescription}`
|
|
16
|
+
: incident.number,
|
|
17
|
+
value: incident.id,
|
|
18
|
+
}),
|
|
19
|
+
}) {
|
|
12
20
|
const { pageStart } = prevContext;
|
|
13
21
|
if (pageStart === null) {
|
|
14
22
|
return [];
|
|
@@ -20,12 +28,7 @@ export default {
|
|
|
20
28
|
},
|
|
21
29
|
});
|
|
22
30
|
return {
|
|
23
|
-
options: incidents?.map(
|
|
24
|
-
label: incident.briefDescription
|
|
25
|
-
? `${incident.number} - ${incident.briefDescription}`
|
|
26
|
-
: incident.number,
|
|
27
|
-
value: incident.id,
|
|
28
|
-
})) || [],
|
|
31
|
+
options: incidents?.map(mapper) || [],
|
|
29
32
|
context: {
|
|
30
33
|
pageStart: incidents.length === 100
|
|
31
34
|
? (pageStart || 0) + 100
|
|
@@ -465,6 +468,24 @@ export default {
|
|
|
465
468
|
description: "Optional fields tab 2 as a JSON object",
|
|
466
469
|
optional: true,
|
|
467
470
|
},
|
|
471
|
+
inlineImages: {
|
|
472
|
+
type: "boolean",
|
|
473
|
+
label: "Inline Images",
|
|
474
|
+
description: "Whether inline images should be returned",
|
|
475
|
+
optional: true,
|
|
476
|
+
},
|
|
477
|
+
forceImagesAsData: {
|
|
478
|
+
type: "boolean",
|
|
479
|
+
label: "Force Images As Data",
|
|
480
|
+
description: "Whether imageData should be forced to be returned as Base64 inline images instead of a URL. Only taken into account when inlineImages is true.",
|
|
481
|
+
optional: true,
|
|
482
|
+
},
|
|
483
|
+
nonApiAttachmentUrls: {
|
|
484
|
+
type: "boolean",
|
|
485
|
+
label: "Non API Attachment URLs",
|
|
486
|
+
description: "Whether links to attachments and bigger versions of inline images should be returned in a format that can be used by a browser (with cookie authentication) instead of by an API user",
|
|
487
|
+
optional: true,
|
|
488
|
+
},
|
|
468
489
|
},
|
|
469
490
|
methods: {
|
|
470
491
|
getUrl(path) {
|
|
@@ -651,6 +672,38 @@ export default {
|
|
|
651
672
|
...opts,
|
|
652
673
|
});
|
|
653
674
|
},
|
|
675
|
+
getIncidentActionsById({
|
|
676
|
+
incidentId, ...opts
|
|
677
|
+
} = {}) {
|
|
678
|
+
return this._makeRequest({
|
|
679
|
+
path: `/tas/api/incidents/id/${incidentId}/actions`,
|
|
680
|
+
...opts,
|
|
681
|
+
});
|
|
682
|
+
},
|
|
683
|
+
getIncidentActionsByNumber({
|
|
684
|
+
number, ...opts
|
|
685
|
+
} = {}) {
|
|
686
|
+
return this._makeRequest({
|
|
687
|
+
path: `/tas/api/incidents/number/${number}/actions`,
|
|
688
|
+
...opts,
|
|
689
|
+
});
|
|
690
|
+
},
|
|
691
|
+
getIncidentProgressTrailById({
|
|
692
|
+
incidentId, ...opts
|
|
693
|
+
} = {}) {
|
|
694
|
+
return this._makeRequest({
|
|
695
|
+
path: `/tas/api/incidents/id/${incidentId}/progresstrail`,
|
|
696
|
+
...opts,
|
|
697
|
+
});
|
|
698
|
+
},
|
|
699
|
+
getIncidentProgressTrailByNumber({
|
|
700
|
+
number, ...opts
|
|
701
|
+
} = {}) {
|
|
702
|
+
return this._makeRequest({
|
|
703
|
+
path: `/tas/api/incidents/number/${number}/progresstrail`,
|
|
704
|
+
...opts,
|
|
705
|
+
});
|
|
706
|
+
},
|
|
654
707
|
async *paginate({
|
|
655
708
|
fn,
|
|
656
709
|
fnArgs = {},
|
|
@@ -665,7 +718,7 @@ export default {
|
|
|
665
718
|
...fnArgs,
|
|
666
719
|
params: {
|
|
667
720
|
...fnArgs.params,
|
|
668
|
-
start
|
|
721
|
+
start,
|
|
669
722
|
page_size: (fnArgs.params?.page_size || 100),
|
|
670
723
|
},
|
|
671
724
|
});
|