@pipedream/qualetics 0.0.1 → 0.1.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.
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import qualetics from "../../qualetics.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "qualetics-run-data-machine",
|
|
5
|
+
name: "Run Data Machine",
|
|
6
|
+
description: "Initiates a previously designed data machine within Qualetics, executing the specific analytical tasks it was built for. [See the documentation](https://docs.qualetics.com/data-machines)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
qualetics,
|
|
11
|
+
dataMachineId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
qualetics,
|
|
14
|
+
"dataMachineId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
input: {
|
|
18
|
+
type: "string",
|
|
19
|
+
label: "Input",
|
|
20
|
+
description: "Input for the data machine",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
async run({ $ }) {
|
|
24
|
+
const response = await this.qualetics.initiateDataMachine({
|
|
25
|
+
$,
|
|
26
|
+
params: {
|
|
27
|
+
id: this.dataMachineId,
|
|
28
|
+
},
|
|
29
|
+
data: JSON.stringify({
|
|
30
|
+
input: this.input,
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
if (response?.status === "Completed") {
|
|
34
|
+
$.export("$summary", `Successfully initiated Data Machine with ID: ${this.dataMachineId}`);
|
|
35
|
+
}
|
|
36
|
+
return response;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import qualetics from "../../qualetics.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "qualetics-send-data",
|
|
5
|
+
name: "Send Data",
|
|
6
|
+
description: "Send an event with data to the system. [See the documentation](https://docs.qualetics.com/rest-api-integration-to-send-data)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
qualetics,
|
|
11
|
+
actor: {
|
|
12
|
+
type: "object",
|
|
13
|
+
label: "Actor",
|
|
14
|
+
description: "Actor data to send. Example: `{\"type\":\"User\",\"id\":\"js1234\"}`",
|
|
15
|
+
},
|
|
16
|
+
action: {
|
|
17
|
+
type: "object",
|
|
18
|
+
label: "Action",
|
|
19
|
+
description: "Action data to send. Example: `{\"type\":\"ButtonClick\"}`",
|
|
20
|
+
},
|
|
21
|
+
context: {
|
|
22
|
+
type: "object",
|
|
23
|
+
label: "Context",
|
|
24
|
+
description: "Context data to send. Example: `{\"type\":\"Button\",\"name\":\"Button1\"}`",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
parseObj(obj) {
|
|
29
|
+
if (typeof obj === "string") {
|
|
30
|
+
return JSON.parse(obj);
|
|
31
|
+
}
|
|
32
|
+
return obj;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
async run({ $ }) {
|
|
36
|
+
const response = await this.qualetics.sendData({
|
|
37
|
+
$,
|
|
38
|
+
data: JSON.stringify({
|
|
39
|
+
actor: this.parseObj(this.actor),
|
|
40
|
+
action: this.parseObj(this.action),
|
|
41
|
+
context: this.parseObj(this.context),
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
if (response?.Status === "Success") {
|
|
45
|
+
$.export("$summary", "Successfully sent data.");
|
|
46
|
+
}
|
|
47
|
+
return response;
|
|
48
|
+
},
|
|
49
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/qualetics",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Pipedream Qualetics Components",
|
|
5
5
|
"main": "qualetics.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^1.6.0"
|
|
14
17
|
}
|
|
15
18
|
}
|
package/qualetics.app.mjs
CHANGED
|
@@ -1,11 +1,48 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
|
|
1
3
|
export default {
|
|
2
4
|
type: "app",
|
|
3
5
|
app: "qualetics",
|
|
4
|
-
propDefinitions: {
|
|
6
|
+
propDefinitions: {
|
|
7
|
+
dataMachineId: {
|
|
8
|
+
type: "string",
|
|
9
|
+
label: "Data Machine ID",
|
|
10
|
+
description: "The ID of the Data Machine to initiate",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
5
13
|
methods: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
_makeRequest(opts = {}) {
|
|
15
|
+
const {
|
|
16
|
+
$ = this,
|
|
17
|
+
...otherOpts
|
|
18
|
+
} = opts;
|
|
19
|
+
return axios($, {
|
|
20
|
+
...otherOpts,
|
|
21
|
+
headers: {
|
|
22
|
+
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
initiateDataMachine(opts = {}) {
|
|
28
|
+
return this._makeRequest({
|
|
29
|
+
method: "POST",
|
|
30
|
+
url: "https://mlapi.qualetics.com/api/datamachine/init",
|
|
31
|
+
...opts,
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
sendData({
|
|
35
|
+
params, ...opts
|
|
36
|
+
}) {
|
|
37
|
+
return this._makeRequest({
|
|
38
|
+
method: "POST",
|
|
39
|
+
url: "https://mq.qualetics.com/api/sendmessage",
|
|
40
|
+
params: {
|
|
41
|
+
...params,
|
|
42
|
+
"client_id": `${this.$auth.app_prefix}`,
|
|
43
|
+
},
|
|
44
|
+
...opts,
|
|
45
|
+
});
|
|
9
46
|
},
|
|
10
47
|
},
|
|
11
|
-
};
|
|
48
|
+
};
|