Skip to content

Commit 12a5232

Browse files
committed
Merge remote-tracking branch 'origin/master' into ai-bug-fixes
2 parents 5cfd35b + 0ef5c8a commit 12a5232

File tree

94 files changed

+3086
-1143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+3086
-1143
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import burstyai from "../../burstyai.app.mjs";
2+
3+
export default {
4+
key: "burstyai-run-workflow",
5+
name: "Run Workflow",
6+
description: "Triggers an AI workflow on BurstyAI. [See the documentation](https://burstyai.readme.io/reference)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
burstyai,
11+
workflow: {
12+
type: "string",
13+
label: "Workflow ID",
14+
description: "The ID of the specific workflow to run. When viewing the workflow in BurstyAI, the ID is the last part of the URL. Example: `65e1cd00141fdc000195cb88`",
15+
},
16+
params: {
17+
type: "object",
18+
label: "Parameters",
19+
description: "Optional parameters for the workflow",
20+
optional: true,
21+
},
22+
waitForCompletion: {
23+
type: "boolean",
24+
label: "Wait For Completion",
25+
description: "Set to `true` to poll the API in 3-second intervals until the workflow is completed",
26+
optional: true,
27+
},
28+
},
29+
async run({ $ }) {
30+
let response = await this.burstyai.triggerWorkflow({
31+
$,
32+
workflow: this.workflow,
33+
data: {
34+
params: this.params || {},
35+
},
36+
});
37+
38+
const jobId = response;
39+
40+
if (this.waitForCompletion) {
41+
const timer = (ms) => new Promise((res) => setTimeout(res, ms));
42+
while (response?.jobStatus !== "END" && response?.jobStatus !== "ERROR") {
43+
response = await this.burstyai.getWorkflowExecutionResult({
44+
$,
45+
jobId,
46+
});
47+
await timer(3000);
48+
}
49+
}
50+
51+
if (response?.status === "END") {
52+
$.export("$summary", `Successfully triggered workflow ${this.workflow}`);
53+
}
54+
55+
return response;
56+
},
57+
};
Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,42 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "burstyai",
4-
propDefinitions: {},
56
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
7+
_baseUrl() {
8+
return "https://app.burstyai.com/burstyai";
9+
},
10+
_makeRequest(opts = {}) {
11+
const {
12+
$ = this,
13+
path,
14+
...otherOpts
15+
} = opts;
16+
return axios($, {
17+
...otherOpts,
18+
url: `${this._baseUrl()}${path}`,
19+
headers: {
20+
Authorization: `Bearer ${this.$auth.api_key}`,
21+
},
22+
});
23+
},
24+
triggerWorkflow({
25+
workflow, ...args
26+
}) {
27+
return this._makeRequest({
28+
method: "POST",
29+
path: `/aiflows/${workflow}/async_run`,
30+
...args,
31+
});
32+
},
33+
getWorkflowExecutionResult({
34+
jobId, ...args
35+
}) {
36+
return this._makeRequest({
37+
path: `/aiflowjobs/${jobId}/result`,
38+
...args,
39+
});
940
},
1041
},
11-
};
42+
};

components/burstyai/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/burstyai",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream BurstyAI Components",
55
"main": "burstyai.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
15-
}
18+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import cliento from "../../cliento.app.mjs";
2+
3+
export default {
4+
key: "cliento-get-ref-data",
5+
name: "Get Reference Data",
6+
description: "Fetch services, resources and mappings for the booking widget. [See the documentation](https://developers.cliento.com/docs/rest-api#fetch-ref-data)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
cliento,
11+
},
12+
async run({ $ }) {
13+
const response = await this.cliento.fetchRefData({
14+
$,
15+
});
16+
$.export("$summary", "Successfully fetched reference data");
17+
return response;
18+
},
19+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import cliento from "../../cliento.app.mjs";
2+
3+
export default {
4+
key: "cliento-get-settings",
5+
name: "Fetch Settings",
6+
description: "Fetch settings and features for the booking widget. [See the documentation](https://developers.cliento.com/docs/rest-api#fetch-settings)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
cliento,
11+
},
12+
async run({ $ }) {
13+
const response = await this.cliento.fetchSettings({
14+
$,
15+
});
16+
$.export("$summary", "Successfully fetched settings");
17+
return response;
18+
},
19+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import cliento from "../../cliento.app.mjs";
2+
3+
export default {
4+
key: "cliento-get-slots",
5+
name: "Get Slots",
6+
description: "Fetch available slots for the given service, resource and dates. [See the documentation](https://developers.cliento.com/docs/rest-api#fetch-slots)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
cliento,
11+
fromDate: {
12+
propDefinition: [
13+
cliento,
14+
"fromDate",
15+
],
16+
},
17+
toDate: {
18+
propDefinition: [
19+
cliento,
20+
"toDate",
21+
],
22+
},
23+
resourceIds: {
24+
propDefinition: [
25+
cliento,
26+
"resourceIds",
27+
],
28+
},
29+
serviceIds: {
30+
propDefinition: [
31+
cliento,
32+
"serviceIds",
33+
],
34+
},
35+
},
36+
async run({ $ }) {
37+
const response = await this.cliento.fetchSlots({
38+
$,
39+
params: {
40+
fromDate: this.fromDate,
41+
toDate: this.toDate,
42+
resIds: this.resourceIds.join(),
43+
srvIds: this.serviceIds.join(),
44+
},
45+
});
46+
if (response?.length) {
47+
$.export("$summary", `Successfully fetched ${response.length} slot${response.length === 1
48+
? ""
49+
: "s"}`);
50+
}
51+
return response;
52+
},
53+
};

components/cliento/cliento.app.mjs

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,83 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "cliento",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
fromDate: {
8+
type: "string",
9+
label: "From Date",
10+
description: "The start date for the booking period (format: YYYY-MM-DD)",
11+
},
12+
toDate: {
13+
type: "string",
14+
label: "To Date",
15+
description: "The end date for the booking period (format: YYYY-MM-DD)",
16+
},
17+
resourceIds: {
18+
type: "string[]",
19+
label: "Resource IDs",
20+
description: "The IDs of the resources for the booking",
21+
async options() {
22+
const { resources } = await this.fetchRefData();
23+
return resources?.map(({
24+
id: value, name: label,
25+
}) => ({
26+
value,
27+
label,
28+
})) || [];
29+
},
30+
},
31+
serviceIds: {
32+
type: "string[]",
33+
label: "Service IDs",
34+
description: "The IDs of the services for the booking",
35+
async options() {
36+
const { services } = await this.fetchRefData();
37+
return services?.map(({
38+
serviceId: value, name: label,
39+
}) => ({
40+
value,
41+
label,
42+
})) || [];
43+
},
44+
},
45+
},
546
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
47+
_baseUrl() {
48+
return `https://cliento.com/api/v2/partner/cliento/${this.$auth.account_id}`;
49+
},
50+
_makeRequest(opts = {}) {
51+
const {
52+
$ = this,
53+
path,
54+
...otherOpts
55+
} = opts;
56+
return axios($, {
57+
...otherOpts,
58+
url: `${this._baseUrl()}${path}`,
59+
headers: {
60+
Accept: "application/json",
61+
},
62+
});
63+
},
64+
fetchSettings(opts = {}) {
65+
return this._makeRequest({
66+
path: "/settings/",
67+
...opts,
68+
});
69+
},
70+
fetchRefData(opts = {}) {
71+
return this._makeRequest({
72+
path: "/ref-data/",
73+
...opts,
74+
});
75+
},
76+
fetchSlots(opts = {}) {
77+
return this._makeRequest({
78+
path: "/resources/slots",
79+
...opts,
80+
});
981
},
1082
},
11-
};
83+
};

components/cliento/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/cliento",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Cliento Components",
55
"main": "cliento.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
15-
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "columns_ai",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};

components/columns_ai/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/columns_ai",
3+
"version": "0.0.1",
4+
"description": "Pipedream Columns Ai Components",
5+
"main": "columns_ai.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"columns_ai"
9+
],
10+
"homepage": "https://pipedream.com/apps/columns_ai",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}

0 commit comments

Comments
 (0)