runline 0.2.1 → 0.2.2
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/dist/plugins/actionNetwork/src/index.js +118 -25
- package/dist/plugins/activeCampaign/src/index.js +184 -38
- package/dist/plugins/adalo/src/index.js +40 -8
- package/dist/plugins/affinity/src/index.js +100 -20
- package/dist/plugins/agileCrm/src/index.js +115 -27
- package/dist/plugins/airtable/src/index.js +94 -19
- package/dist/plugins/airtop/src/index.js +266 -62
- package/dist/plugins/apiTemplateIo/src/index.js +25 -5
- package/dist/plugins/asana/src/index.js +195 -41
- package/dist/plugins/autopilot/src/index.js +39 -8
- package/dist/plugins/bambooHr/src/index.js +109 -22
- package/dist/plugins/bannerbear/src/index.js +36 -8
- package/dist/plugins/baserow/src/index.js +35 -7
- package/dist/plugins/beeminder/src/index.js +198 -40
- package/dist/plugins/bitly/src/index.js +46 -10
- package/dist/plugins/bitwarden/src/index.js +167 -36
- package/dist/plugins/box/src/index.js +172 -37
- package/dist/plugins/brandfetch/src/index.js +5 -1
- package/dist/plugins/brevo/src/index.js +136 -29
- package/dist/plugins/bubble/src/index.js +76 -17
- package/dist/plugins/chargebee/src/index.js +35 -7
- package/dist/plugins/circleci/src/index.js +50 -10
- package/dist/plugins/ciscoWebex/src/index.js +131 -27
- package/dist/plugins/clearbit/src/index.js +76 -17
- package/dist/plugins/clickup/src/index.js +500 -107
- package/dist/plugins/clockify/src/index.js +229 -47
- package/dist/plugins/cloudflare/src/index.js +28 -6
- package/dist/plugins/cockpit/src/index.js +54 -12
- package/dist/plugins/coda/src/index.js +81 -19
- package/dist/plugins/coingecko/src/index.js +157 -33
- package/dist/plugins/contentful/src/index.js +85 -17
- package/dist/plugins/convertkit/src/index.js +74 -18
- package/dist/plugins/copper/src/index.js +59 -11
- package/dist/plugins/cortex/src/index.js +55 -13
- package/dist/plugins/currents/src/index.js +310 -71
- package/dist/plugins/customerIo/src/index.js +112 -23
- package/dist/plugins/databricks/src/index.js +549 -115
- package/dist/plugins/deepl/src/index.js +26 -6
- package/dist/plugins/demio/src/index.js +56 -11
- package/dist/plugins/dhl/src/index.js +16 -3
- package/dist/plugins/discord/src/index.js +141 -31
- package/dist/plugins/discourse/src/index.js +136 -31
- package/dist/plugins/disqus/src/index.js +96 -20
- package/dist/plugins/docker/src/index.js +20 -4
- package/dist/plugins/drift/src/index.js +19 -5
- package/dist/plugins/dropbox/src/index.js +139 -30
- package/dist/plugins/dropcontact/src/index.js +21 -4
- package/dist/plugins/egoi/src/index.js +61 -15
- package/dist/plugins/elasticsearch/src/index.js +59 -13
- package/dist/plugins/emelia/src/index.js +95 -19
- package/dist/plugins/erpnext/src/index.js +74 -15
- package/dist/plugins/facebookGraph/src/index.js +52 -11
- package/dist/plugins/freshdesk/src/index.js +220 -48
- package/dist/plugins/freshservice/src/index.js +39 -9
- package/dist/plugins/freshworksCrm/src/index.js +58 -12
- package/dist/plugins/getresponse/src/index.js +87 -18
- package/dist/plugins/ghost/src/index.js +114 -26
- package/dist/plugins/github/src/index.js +483 -109
- package/dist/plugins/gitlab/src/index.js +193 -45
- package/dist/plugins/gong/src/index.js +68 -14
- package/dist/plugins/gotify/src/index.js +43 -9
- package/dist/plugins/gotowebinar/src/index.js +233 -47
- package/dist/plugins/grafana/src/index.js +92 -21
- package/dist/plugins/graphql/src/index.js +38 -8
- package/dist/plugins/grist/src/index.js +52 -10
- package/dist/plugins/hackernews/src/index.js +32 -6
- package/dist/plugins/halopsa/src/index.js +131 -26
- package/dist/plugins/harvest/src/index.js +182 -42
- package/dist/plugins/helpscout/src/index.js +153 -31
- package/dist/plugins/highlevel/src/index.js +291 -58
- package/dist/plugins/homeAssistant/src/index.js +124 -26
- package/dist/plugins/hubspot/src/index.js +163 -29
- package/dist/plugins/humanticAi/src/index.js +54 -5
- package/dist/plugins/hunter/src/index.js +21 -4
- package/dist/plugins/intercom/src/index.js +95 -20
- package/dist/plugins/iterable/src/index.js +96 -20
- package/dist/plugins/jenkins/src/index.js +75 -17
- package/dist/plugins/jira/src/index.js +193 -43
- package/dist/plugins/keap/src/index.js +222 -56
- package/dist/plugins/kobotoolbox/src/index.js +113 -25
- package/dist/plugins/lemlist/src/index.js +79 -18
- package/dist/plugins/linear/src/index.js +86 -19
- package/dist/plugins/lingvanex/src/index.js +38 -8
- package/dist/plugins/linkedin/src/index.js +37 -8
- package/dist/plugins/lonescale/src/index.js +41 -9
- package/dist/plugins/magento/src/index.js +98 -27
- package/dist/plugins/mailcheck/src/index.js +11 -2
- package/dist/plugins/mailchimp/src/index.js +193 -42
- package/dist/plugins/mailerlite/src/index.js +61 -12
- package/dist/plugins/mailgun/src/index.js +39 -7
- package/dist/plugins/mailjet/src/index.js +141 -30
- package/dist/plugins/mandrill/src/index.js +67 -14
- package/dist/plugins/marketstack/src/index.js +56 -10
- package/dist/plugins/matrix/src/index.js +97 -20
- package/dist/plugins/mattermost/src/index.js +124 -26
- package/dist/plugins/mautic/src/index.js +129 -26
- package/dist/plugins/medium/src/index.js +64 -13
- package/dist/plugins/messagebird/src/index.js +80 -15
- package/dist/plugins/metabase/src/index.js +57 -12
- package/dist/plugins/misp/src/index.js +135 -33
- package/dist/plugins/mocean/src/index.js +33 -7
- package/dist/plugins/monday/src/index.js +97 -23
- package/dist/plugins/monicaCrm/src/index.js +112 -23
- package/dist/plugins/msg91/src/index.js +11 -2
- package/dist/plugins/nasa/src/index.js +108 -21
- package/dist/plugins/netlify/src/index.js +28 -6
- package/dist/plugins/netscalerAdc/src/index.js +144 -29
- package/dist/plugins/nextcloud/src/index.js +103 -20
- package/dist/plugins/nocodb/src/index.js +57 -11
- package/dist/plugins/notion/src/index.js +148 -37
- package/dist/plugins/npm/src/index.js +59 -12
- package/dist/plugins/odoo/src/index.js +102 -20
- package/dist/plugins/okta/src/index.js +50 -10
- package/dist/plugins/oneSimpleApi/src/index.js +84 -17
- package/dist/plugins/onfleet/src/index.js +139 -32
- package/dist/plugins/openThesaurus/src/index.js +46 -9
- package/dist/plugins/openweathermap/src/index.js +31 -6
- package/dist/plugins/oura/src/index.js +36 -7
- package/dist/plugins/paddle/src/index.js +80 -17
- package/dist/plugins/pagerduty/src/index.js +53 -12
- package/dist/plugins/paypal/src/index.js +51 -11
- package/dist/plugins/peekalink/src/index.js +12 -3
- package/dist/plugins/phantombuster/src/index.js +39 -8
- package/dist/plugins/philipsHue/src/index.js +64 -13
- package/dist/plugins/pipedrive/src/index.js +167 -45
- package/dist/plugins/plivo/src/index.js +43 -8
- package/dist/plugins/postbin/src/index.js +9 -2
- package/dist/plugins/posthog/src/index.js +50 -13
- package/dist/plugins/profitwell/src/index.js +24 -5
- package/dist/plugins/pushbullet/src/index.js +45 -9
- package/dist/plugins/pushcut/src/index.js +31 -6
- package/dist/plugins/pushover/src/index.js +51 -10
- package/dist/plugins/quickbase/src/index.js +66 -13
- package/dist/plugins/quickbooks/src/index.js +86 -19
- package/dist/plugins/quickchart/src/index.js +35 -7
- package/dist/plugins/raindrop/src/index.js +54 -13
- package/dist/plugins/reddit/src/index.js +73 -18
- package/dist/plugins/rocketchat/src/index.js +47 -9
- package/dist/plugins/rundeck/src/index.js +26 -5
- package/dist/plugins/salesforce/src/index.js +161 -31
- package/dist/plugins/salesmate/src/index.js +75 -16
- package/dist/plugins/securityScorecard/src/index.js +73 -15
- package/dist/plugins/segment/src/index.js +21 -4
- package/dist/plugins/sendgrid/src/index.js +102 -24
- package/dist/plugins/sendy/src/index.js +54 -11
- package/dist/plugins/sentry/src/index.js +174 -34
- package/dist/plugins/servicenow/src/index.js +120 -27
- package/dist/plugins/shopify/src/index.js +53 -12
- package/dist/plugins/signl4/src/index.js +16 -3
- package/dist/plugins/slack/src/index.js +407 -105
- package/dist/plugins/sms77/src/index.js +26 -5
- package/dist/plugins/splunk/src/index.js +186 -45
- package/dist/plugins/spotify/src/index.js +265 -66
- package/dist/plugins/stackby/src/index.js +18 -6
- package/dist/plugins/storyblok/src/index.js +57 -11
- package/dist/plugins/strapi/src/index.js +63 -12
- package/dist/plugins/strava/src/index.js +58 -13
- package/dist/plugins/stripe/src/index.js +143 -30
- package/dist/plugins/supabase/src/index.js +49 -10
- package/dist/plugins/syncromsp/src/index.js +245 -67
- package/dist/plugins/tapfiliate/src/index.js +57 -14
- package/dist/plugins/telegram/src/index.js +202 -39
- package/dist/plugins/thehive/src/index.js +271 -66
- package/dist/plugins/thehiveProject/src/index.js +457 -89
- package/dist/plugins/todoist/src/index.js +326 -77
- package/dist/plugins/travisci/src/index.js +35 -8
- package/dist/plugins/trello/src/index.js +204 -46
- package/dist/plugins/twake/src/index.js +10 -2
- package/dist/plugins/twilio/src/index.js +56 -11
- package/dist/plugins/twist/src/index.js +241 -48
- package/dist/plugins/twitter/src/index.js +128 -30
- package/dist/plugins/unleashedSoftware/src/index.js +30 -6
- package/dist/plugins/uplead/src/index.js +9 -2
- package/dist/plugins/uproc/src/index.js +31 -6
- package/dist/plugins/uptimerobot/src/index.js +119 -25
- package/dist/plugins/urlscanio/src/index.js +25 -6
- package/dist/plugins/vero/src/index.js +68 -13
- package/dist/plugins/vonage/src/index.js +32 -6
- package/dist/plugins/wekan/src/index.js +297 -52
- package/dist/plugins/woocommerce/src/index.js +57 -12
- package/dist/plugins/wordpress/src/index.js +94 -18
- package/dist/plugins/xero/src/index.js +79 -13
- package/dist/plugins/yourls/src/index.js +33 -6
- package/dist/plugins/zammad/src/index.js +139 -36
- package/dist/plugins/zendesk/src/index.js +201 -48
- package/dist/plugins/zoho/src/index.js +88 -21
- package/dist/plugins/zoom/src/index.js +41 -7
- package/dist/plugins/zulip/src/index.js +101 -20
- package/package.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
function getConn(ctx) {
|
|
2
2
|
const c = ctx.connection.config;
|
|
3
|
-
return {
|
|
3
|
+
return {
|
|
4
|
+
url: c.url.replace(/\/$/, ""),
|
|
5
|
+
apiKey: c.apiKey,
|
|
6
|
+
};
|
|
4
7
|
}
|
|
5
8
|
async function api(conn, method, endpoint, body, qs) {
|
|
6
9
|
const url = new URL(`${conn.url}/api${endpoint}`);
|
|
@@ -10,7 +13,13 @@ async function api(conn, method, endpoint, body, qs) {
|
|
|
10
13
|
url.searchParams.set(k, String(v));
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
|
-
const init = {
|
|
16
|
+
const init = {
|
|
17
|
+
method,
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${conn.apiKey}`,
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
14
23
|
if (body && Object.keys(body).length > 0)
|
|
15
24
|
init.body = JSON.stringify(body);
|
|
16
25
|
const res = await fetch(url.toString(), init);
|
|
@@ -22,121 +31,317 @@ export default function thehive(rl) {
|
|
|
22
31
|
rl.setName("thehive");
|
|
23
32
|
rl.setVersion("0.1.0");
|
|
24
33
|
rl.setConnectionSchema({
|
|
25
|
-
url: {
|
|
26
|
-
|
|
34
|
+
url: {
|
|
35
|
+
type: "string",
|
|
36
|
+
required: true,
|
|
37
|
+
description: "TheHive instance URL",
|
|
38
|
+
env: "THEHIVE_URL",
|
|
39
|
+
},
|
|
40
|
+
apiKey: {
|
|
41
|
+
type: "string",
|
|
42
|
+
required: true,
|
|
43
|
+
description: "TheHive API key",
|
|
44
|
+
env: "THEHIVE_API_KEY",
|
|
45
|
+
},
|
|
27
46
|
});
|
|
28
47
|
// ── Alert ───────────────────────────────────────────
|
|
29
|
-
rl.registerAction("alert.create", {
|
|
30
|
-
|
|
48
|
+
rl.registerAction("alert.create", {
|
|
49
|
+
description: "Create an alert",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
title: { type: "string", required: true },
|
|
52
|
+
description: { type: "string", required: true },
|
|
53
|
+
severity: { type: "number", required: true, description: "1-4" },
|
|
54
|
+
type: { type: "string", required: true },
|
|
55
|
+
source: { type: "string", required: true },
|
|
56
|
+
sourceRef: { type: "string", required: true },
|
|
57
|
+
tlp: { type: "number", required: false },
|
|
58
|
+
tags: { type: "string", required: false, description: "Comma-separated" },
|
|
59
|
+
},
|
|
31
60
|
async execute(input, ctx) {
|
|
32
61
|
const p = input;
|
|
33
62
|
const body = { ...p, date: Date.now() };
|
|
34
63
|
if (p.tags)
|
|
35
|
-
body.tags = p.tags.split(",").map(t => t.trim());
|
|
64
|
+
body.tags = p.tags.split(",").map((t) => t.trim());
|
|
36
65
|
return api(getConn(ctx), "POST", "/alert", body);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
rl.registerAction("alert.get", {
|
|
69
|
+
description: "Get an alert by ID",
|
|
70
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
71
|
+
async execute(input, ctx) {
|
|
72
|
+
return api(getConn(ctx), "GET", `/alert/${input.id}`);
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
rl.registerAction("alert.list", {
|
|
76
|
+
description: "List alerts",
|
|
77
|
+
inputSchema: { limit: { type: "number", required: false } },
|
|
41
78
|
async execute(input, ctx) {
|
|
42
79
|
const p = (input ?? {});
|
|
43
80
|
const body = { query: [{ _name: "listAlert" }] };
|
|
44
81
|
if (p.limit)
|
|
45
82
|
body.query.push({ _name: "page", from: 0, to: p.limit });
|
|
46
83
|
return api(getConn(ctx), "POST", "/v1/query", body, { name: "alerts" });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
async execute(input, ctx) {
|
|
56
|
-
|
|
57
|
-
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
rl.registerAction("alert.update", {
|
|
87
|
+
description: "Update an alert",
|
|
88
|
+
inputSchema: {
|
|
89
|
+
id: { type: "string", required: true },
|
|
90
|
+
data: { type: "object", required: true },
|
|
91
|
+
},
|
|
92
|
+
async execute(input, ctx) {
|
|
93
|
+
const p = input;
|
|
94
|
+
return api(getConn(ctx), "PATCH", `/alert/${p.id}`, p.data);
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
rl.registerAction("alert.markAsRead", {
|
|
98
|
+
description: "Mark an alert as read",
|
|
99
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
100
|
+
async execute(input, ctx) {
|
|
101
|
+
return api(getConn(ctx), "POST", `/alert/${input.id}/markAsRead`);
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
rl.registerAction("alert.markAsUnread", {
|
|
105
|
+
description: "Mark an alert as unread",
|
|
106
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
107
|
+
async execute(input, ctx) {
|
|
108
|
+
return api(getConn(ctx), "POST", `/alert/${input.id}/markAsUnread`);
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
rl.registerAction("alert.promote", {
|
|
112
|
+
description: "Promote an alert to a case",
|
|
113
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
114
|
+
async execute(input, ctx) {
|
|
115
|
+
return api(getConn(ctx), "POST", `/alert/${input.id}/createCase`);
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
rl.registerAction("alert.merge", {
|
|
119
|
+
description: "Merge an alert into an existing case",
|
|
120
|
+
inputSchema: {
|
|
121
|
+
alertId: { type: "string", required: true },
|
|
122
|
+
caseId: { type: "string", required: true },
|
|
123
|
+
},
|
|
124
|
+
async execute(input, ctx) {
|
|
125
|
+
const p = input;
|
|
126
|
+
return api(getConn(ctx), "POST", `/alert/${p.alertId}/merge/${p.caseId}`);
|
|
127
|
+
},
|
|
128
|
+
});
|
|
58
129
|
// ── Case ────────────────────────────────────────────
|
|
59
|
-
rl.registerAction("case.create", {
|
|
60
|
-
|
|
130
|
+
rl.registerAction("case.create", {
|
|
131
|
+
description: "Create a case",
|
|
132
|
+
inputSchema: {
|
|
133
|
+
title: { type: "string", required: true },
|
|
134
|
+
description: { type: "string", required: true },
|
|
135
|
+
severity: { type: "number", required: true },
|
|
136
|
+
tlp: { type: "number", required: false },
|
|
137
|
+
tags: { type: "string", required: false, description: "Comma-separated" },
|
|
138
|
+
owner: { type: "string", required: false },
|
|
139
|
+
},
|
|
61
140
|
async execute(input, ctx) {
|
|
62
141
|
const p = input;
|
|
63
142
|
const body = { ...p, startDate: Date.now() };
|
|
64
143
|
if (p.tags)
|
|
65
|
-
body.tags = p.tags.split(",").map(t => t.trim());
|
|
144
|
+
body.tags = p.tags.split(",").map((t) => t.trim());
|
|
66
145
|
return api(getConn(ctx), "POST", "/case", body);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
rl.registerAction("case.get", {
|
|
149
|
+
description: "Get a case",
|
|
150
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
151
|
+
async execute(input, ctx) {
|
|
152
|
+
return api(getConn(ctx), "GET", `/case/${input.id}`);
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
rl.registerAction("case.list", {
|
|
156
|
+
description: "List cases",
|
|
157
|
+
inputSchema: { limit: { type: "number", required: false } },
|
|
71
158
|
async execute(input, ctx) {
|
|
72
159
|
const p = (input ?? {});
|
|
73
160
|
const body = { query: [{ _name: "listCase" }] };
|
|
74
161
|
if (p.limit)
|
|
75
162
|
body.query.push({ _name: "page", from: 0, to: p.limit });
|
|
76
163
|
return api(getConn(ctx), "POST", "/v1/query", body, { name: "cases" });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
rl.registerAction("case.update", {
|
|
167
|
+
description: "Update a case",
|
|
168
|
+
inputSchema: {
|
|
169
|
+
id: { type: "string", required: true },
|
|
170
|
+
data: { type: "object", required: true },
|
|
171
|
+
},
|
|
172
|
+
async execute(input, ctx) {
|
|
173
|
+
const p = input;
|
|
174
|
+
return api(getConn(ctx), "PATCH", `/case/${p.id}`, p.data);
|
|
175
|
+
},
|
|
176
|
+
});
|
|
80
177
|
// ── Observable ──────────────────────────────────────
|
|
81
|
-
rl.registerAction("observable.create", {
|
|
82
|
-
|
|
178
|
+
rl.registerAction("observable.create", {
|
|
179
|
+
description: "Create an observable on a case",
|
|
180
|
+
inputSchema: {
|
|
181
|
+
caseId: { type: "string", required: true },
|
|
182
|
+
dataType: { type: "string", required: true },
|
|
183
|
+
data: { type: "string", required: true },
|
|
184
|
+
message: { type: "string", required: false },
|
|
185
|
+
tlp: { type: "number", required: false },
|
|
186
|
+
ioc: { type: "boolean", required: false },
|
|
187
|
+
sighted: { type: "boolean", required: false },
|
|
188
|
+
},
|
|
83
189
|
async execute(input, ctx) {
|
|
84
190
|
const { caseId, ...body } = input;
|
|
85
191
|
return api(getConn(ctx), "POST", `/case/${caseId}/artifact`, body);
|
|
86
|
-
}
|
|
87
|
-
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
rl.registerAction("observable.get", {
|
|
195
|
+
description: "Get an observable",
|
|
196
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
88
197
|
async execute(input, ctx) {
|
|
89
|
-
return api(getConn(ctx), "POST", "/v1/query", {
|
|
90
|
-
|
|
91
|
-
|
|
198
|
+
return api(getConn(ctx), "POST", "/v1/query", {
|
|
199
|
+
query: [
|
|
200
|
+
{
|
|
201
|
+
_name: "getObservable",
|
|
202
|
+
idOrName: input.id,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
}, { name: "get-observable" });
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
rl.registerAction("observable.list", {
|
|
209
|
+
description: "List observables for a case",
|
|
210
|
+
inputSchema: {
|
|
211
|
+
caseId: { type: "string", required: true },
|
|
212
|
+
limit: { type: "number", required: false },
|
|
213
|
+
},
|
|
92
214
|
async execute(input, ctx) {
|
|
93
215
|
const p = input;
|
|
94
|
-
const body = {
|
|
216
|
+
const body = {
|
|
217
|
+
query: [
|
|
218
|
+
{ _name: "getCase", idOrName: p.caseId },
|
|
219
|
+
{ _name: "observables" },
|
|
220
|
+
],
|
|
221
|
+
};
|
|
95
222
|
if (p.limit)
|
|
96
223
|
body.query.push({ _name: "page", from: 0, to: p.limit });
|
|
97
|
-
return api(getConn(ctx), "POST", "/v1/query", body, {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
224
|
+
return api(getConn(ctx), "POST", "/v1/query", body, {
|
|
225
|
+
name: "observables",
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
rl.registerAction("observable.update", {
|
|
230
|
+
description: "Update an observable",
|
|
231
|
+
inputSchema: {
|
|
232
|
+
id: { type: "string", required: true },
|
|
233
|
+
data: { type: "object", required: true },
|
|
234
|
+
},
|
|
235
|
+
async execute(input, ctx) {
|
|
236
|
+
const p = input;
|
|
237
|
+
return api(getConn(ctx), "PATCH", `/case/artifact/${p.id}`, p.data);
|
|
238
|
+
},
|
|
239
|
+
});
|
|
101
240
|
// ── Task ────────────────────────────────────────────
|
|
102
|
-
rl.registerAction("task.create", {
|
|
103
|
-
|
|
241
|
+
rl.registerAction("task.create", {
|
|
242
|
+
description: "Create a task on a case",
|
|
243
|
+
inputSchema: {
|
|
244
|
+
caseId: { type: "string", required: true },
|
|
245
|
+
title: { type: "string", required: true },
|
|
246
|
+
status: {
|
|
247
|
+
type: "string",
|
|
248
|
+
required: false,
|
|
249
|
+
description: "Waiting, InProgress, Completed, Cancel",
|
|
250
|
+
},
|
|
251
|
+
flag: { type: "boolean", required: false },
|
|
252
|
+
},
|
|
104
253
|
async execute(input, ctx) {
|
|
105
254
|
const { caseId, ...body } = input;
|
|
106
255
|
return api(getConn(ctx), "POST", `/case/${caseId}/task`, body);
|
|
107
|
-
}
|
|
108
|
-
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
rl.registerAction("task.get", {
|
|
259
|
+
description: "Get a task",
|
|
260
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
109
261
|
async execute(input, ctx) {
|
|
110
|
-
return api(getConn(ctx), "POST", "/v1/query", {
|
|
111
|
-
|
|
112
|
-
|
|
262
|
+
return api(getConn(ctx), "POST", "/v1/query", {
|
|
263
|
+
query: [
|
|
264
|
+
{
|
|
265
|
+
_name: "getTask",
|
|
266
|
+
idOrName: input.id,
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
}, { name: "get-task" });
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
rl.registerAction("task.list", {
|
|
273
|
+
description: "List tasks for a case",
|
|
274
|
+
inputSchema: {
|
|
275
|
+
caseId: { type: "string", required: true },
|
|
276
|
+
limit: { type: "number", required: false },
|
|
277
|
+
},
|
|
113
278
|
async execute(input, ctx) {
|
|
114
279
|
const p = input;
|
|
115
|
-
const body = {
|
|
280
|
+
const body = {
|
|
281
|
+
query: [{ _name: "getCase", idOrName: p.caseId }, { _name: "tasks" }],
|
|
282
|
+
};
|
|
116
283
|
if (p.limit)
|
|
117
284
|
body.query.push({ _name: "page", from: 0, to: p.limit });
|
|
118
|
-
return api(getConn(ctx), "POST", "/v1/query", body, {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
285
|
+
return api(getConn(ctx), "POST", "/v1/query", body, {
|
|
286
|
+
name: "case-tasks",
|
|
287
|
+
});
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
rl.registerAction("task.update", {
|
|
291
|
+
description: "Update a task",
|
|
292
|
+
inputSchema: {
|
|
293
|
+
id: { type: "string", required: true },
|
|
294
|
+
data: { type: "object", required: true },
|
|
295
|
+
},
|
|
296
|
+
async execute(input, ctx) {
|
|
297
|
+
const p = input;
|
|
298
|
+
return api(getConn(ctx), "PATCH", `/case/task/${p.id}`, p.data);
|
|
299
|
+
},
|
|
300
|
+
});
|
|
122
301
|
// ── Log ─────────────────────────────────────────────
|
|
123
|
-
rl.registerAction("log.create", {
|
|
124
|
-
|
|
302
|
+
rl.registerAction("log.create", {
|
|
303
|
+
description: "Create a log entry on a task",
|
|
304
|
+
inputSchema: {
|
|
305
|
+
taskId: { type: "string", required: true },
|
|
306
|
+
message: { type: "string", required: true },
|
|
307
|
+
status: { type: "string", required: false, description: "Ok, Deleted" },
|
|
308
|
+
},
|
|
125
309
|
async execute(input, ctx) {
|
|
126
310
|
const { taskId, ...body } = input;
|
|
127
311
|
body.startDate = Date.now();
|
|
128
312
|
return api(getConn(ctx), "POST", `/case/task/${taskId}/log`, body);
|
|
129
|
-
}
|
|
130
|
-
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
rl.registerAction("log.get", {
|
|
316
|
+
description: "Get a log entry",
|
|
317
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
131
318
|
async execute(input, ctx) {
|
|
132
|
-
return api(getConn(ctx), "POST", "/v1/query", {
|
|
133
|
-
|
|
134
|
-
|
|
319
|
+
return api(getConn(ctx), "POST", "/v1/query", {
|
|
320
|
+
query: [
|
|
321
|
+
{
|
|
322
|
+
_name: "getLog",
|
|
323
|
+
idOrName: input.id,
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
}, { name: "get-log" });
|
|
327
|
+
},
|
|
328
|
+
});
|
|
329
|
+
rl.registerAction("log.list", {
|
|
330
|
+
description: "List logs for a task",
|
|
331
|
+
inputSchema: {
|
|
332
|
+
taskId: { type: "string", required: true },
|
|
333
|
+
limit: { type: "number", required: false },
|
|
334
|
+
},
|
|
135
335
|
async execute(input, ctx) {
|
|
136
336
|
const p = input;
|
|
137
|
-
const body = {
|
|
337
|
+
const body = {
|
|
338
|
+
query: [{ _name: "getTask", idOrName: p.taskId }, { _name: "logs" }],
|
|
339
|
+
};
|
|
138
340
|
if (p.limit)
|
|
139
341
|
body.query.push({ _name: "page", from: 0, to: p.limit });
|
|
140
|
-
return api(getConn(ctx), "POST", "/v1/query", body, {
|
|
141
|
-
|
|
342
|
+
return api(getConn(ctx), "POST", "/v1/query", body, {
|
|
343
|
+
name: "case-task-logs",
|
|
344
|
+
});
|
|
345
|
+
},
|
|
346
|
+
});
|
|
142
347
|
}
|