-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/
Copy pathcreate-pipeline.mjs
48 lines (46 loc) · 1.3 KB
/
create-pipeline.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { ConfigurationError } from "@pipedream/platform";
import { parseObject } from "../../common/utils.mjs";
import vectorshift from "../../vectorshift.app.mjs";
export default {
key: "vectorshift-create-pipeline",
name: "Create Pipeline",
description: "Creates a new pipeline in VectorShift. [See the documentation](https://docs.vectorshift.ai)",
version: "0.0.1",
type: "action",
props: {
vectorshift,
name: {
type: "string",
label: "Pipeline Name",
description: "Name of the new pipeline",
},
config: {
type: "object",
label: "Pipeline Config",
description: "Configuration for the new pipeline",
},
description: {
type: "string",
label: "Description",
description: "Optional description of the new pipeline",
optional: true,
},
},
async run({ $ }) {
try {
const response = await this.vectorshift.createPipeline({
$,
data: {
name: this.name,
config: parseObject(this.config),
description: this.description,
},
});
$.export("$summary", `Created pipeline with ID ${response.id}`);
return response;
} catch ({ message }) {
const parsedError = JSON.parse(message).error;
throw new ConfigurationError(parsedError);
}
},
};