@pipedream/form_io 0.0.2 → 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.
- package/README.md +11 -0
- package/actions/create-form/create-form.mjs +101 -0
- package/actions/create-form-action/create-form-action.mjs +89 -0
- package/actions/create-role/create-role.mjs +49 -0
- package/actions/create-submission/create-submission.mjs +48 -0
- package/actions/delete-form/delete-form.mjs +33 -0
- package/actions/delete-form-action/delete-form-action.mjs +45 -0
- package/actions/delete-role/delete-role.mjs +33 -0
- package/actions/delete-submission/delete-submission.mjs +45 -0
- package/actions/get-form/get-form.mjs +33 -0
- package/actions/get-form-action/get-form-action.mjs +45 -0
- package/actions/get-role/get-role.mjs +33 -0
- package/actions/get-submission/get-submission.mjs +45 -0
- package/actions/list-form-actions/list-form-actions.mjs +67 -0
- package/actions/list-forms/list-forms.mjs +79 -0
- package/actions/list-roles/list-roles.mjs +59 -0
- package/actions/list-submissions/list-submissions.mjs +87 -0
- package/actions/update-form/update-form.mjs +113 -0
- package/actions/update-form-action/update-form-action.mjs +93 -0
- package/actions/update-role/update-role.mjs +76 -0
- package/actions/update-submission/update-submission.mjs +64 -0
- package/common/constants.mjs +24 -0
- package/common/utils.mjs +75 -0
- package/form_io.app.mjs +378 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
The Form.io API empowers developers to manage forms and submissions on Pipedream, enabling the automation of workflows that require data collection and processing. With Form.io on Pipedream, you can create, update, and fetch forms, as well as handle form submissions. This is ideal for tasks like dynamically generating forms based on user input, streamlining data collection processes, and integrating form data with other services for further analysis or action.
|
|
4
|
+
|
|
5
|
+
# Example Use Cases
|
|
6
|
+
|
|
7
|
+
- **Form Submission Trigger to Slack Notification**: When a new form submission is received in Form.io, trigger a Pipedream workflow to send a custom alert to a Slack channel, informing the team about the submission details.
|
|
8
|
+
|
|
9
|
+
- **Dynamic Form Creation and Data Storage**: Automatically create a new form in Form.io using a Pipedream workflow whenever a specific event occurs (like a new product launch), and store the form data in a Pipedream data store for later use or analysis.
|
|
10
|
+
|
|
11
|
+
- **Form Data to Google Sheets Integration**: Use Pipedream to send new Form.io submissions to Google Sheets. Each submission can be added as a new row in a sheet, providing easy access for non-technical team members to review and process the data.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
import { parseJson } from "../../common/utils.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "form_io-create-form",
|
|
6
|
+
name: "Create Form",
|
|
7
|
+
description: "Create a form or resource in Form.io. Use **List Forms** to review existing forms. The `components` prop is a JSON-string array of Form.io component schema objects. [See the documentation](https://apidocs.form.io/#c864243f-1ff5-409b-912f-de5670be9130).",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
ai: "optimized",
|
|
11
|
+
annotations: {
|
|
12
|
+
readOnlyHint: false,
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
openWorldHint: true,
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
formIo,
|
|
18
|
+
title: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
formIo,
|
|
21
|
+
"title",
|
|
22
|
+
],
|
|
23
|
+
description: "The human-readable title of the form (e.g. `Contact Form`).",
|
|
24
|
+
},
|
|
25
|
+
name: {
|
|
26
|
+
propDefinition: [
|
|
27
|
+
formIo,
|
|
28
|
+
"name",
|
|
29
|
+
],
|
|
30
|
+
description: "The machine name of the form (e.g. `contactform`).",
|
|
31
|
+
},
|
|
32
|
+
path: {
|
|
33
|
+
propDefinition: [
|
|
34
|
+
formIo,
|
|
35
|
+
"path",
|
|
36
|
+
],
|
|
37
|
+
description: "The URL path for the form (e.g. `contactform`).",
|
|
38
|
+
},
|
|
39
|
+
type: {
|
|
40
|
+
propDefinition: [
|
|
41
|
+
formIo,
|
|
42
|
+
"type",
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
components: {
|
|
46
|
+
propDefinition: [
|
|
47
|
+
formIo,
|
|
48
|
+
"components",
|
|
49
|
+
],
|
|
50
|
+
description: "JSON-string array of Form.io component schema objects. Example: `[{\"type\":\"textfield\",\"key\":\"name\",\"label\":\"Name\",\"input\":true}]`. Parsed with JSON.parse() before sending.",
|
|
51
|
+
},
|
|
52
|
+
display: {
|
|
53
|
+
propDefinition: [
|
|
54
|
+
formIo,
|
|
55
|
+
"display",
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
tags: {
|
|
59
|
+
propDefinition: [
|
|
60
|
+
formIo,
|
|
61
|
+
"tags",
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
settings: {
|
|
65
|
+
propDefinition: [
|
|
66
|
+
formIo,
|
|
67
|
+
"settings",
|
|
68
|
+
],
|
|
69
|
+
description: "JSON-string object of form settings. Example: `{\"theme\":\"default\"}`.",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
async run({ $ }) {
|
|
73
|
+
const {
|
|
74
|
+
title,
|
|
75
|
+
name,
|
|
76
|
+
path,
|
|
77
|
+
type,
|
|
78
|
+
components,
|
|
79
|
+
display,
|
|
80
|
+
tags,
|
|
81
|
+
settings,
|
|
82
|
+
} = this;
|
|
83
|
+
|
|
84
|
+
const response = await this.formIo.createForm({
|
|
85
|
+
$,
|
|
86
|
+
data: {
|
|
87
|
+
title,
|
|
88
|
+
name,
|
|
89
|
+
path,
|
|
90
|
+
type,
|
|
91
|
+
components: parseJson(components, "components", "array"),
|
|
92
|
+
display,
|
|
93
|
+
tags,
|
|
94
|
+
settings: parseJson(settings, "settings", "object"),
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
$.export("$summary", `Created form "${response.title}" (${response._id})`);
|
|
99
|
+
return response;
|
|
100
|
+
},
|
|
101
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
import { parseJson } from "../../common/utils.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "form_io-create-form-action",
|
|
6
|
+
name: "Create Form Action",
|
|
7
|
+
description: "Attach an action (e.g. email, webhook, save) to a Form.io form. Use **List Forms** to find the form ID and **List Form Actions** to review existing actions. The `settings` prop is a JSON-string object specific to the action type. Example: `actionType` `webhook`, `title` `Notify endpoint`, `handler` `[after]`, `method` `[create]`, `settings` `{\"url\":\"https://example.com/hook\",\"method\":\"post\"}` → returns the new action with its `_id`. [See the documentation](https://apidocs.form.io/#b3435953-c007-48d9-9f4c-a8e2ee717419).",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
ai: "optimized",
|
|
11
|
+
annotations: {
|
|
12
|
+
readOnlyHint: false,
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
openWorldHint: true,
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
formIo,
|
|
18
|
+
formId: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
formIo,
|
|
21
|
+
"formId",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
actionType: {
|
|
25
|
+
type: "string",
|
|
26
|
+
label: "Action Type",
|
|
27
|
+
description: "The Form.io action type to attach — e.g. `webhook`, `email`, `save`, `login`, `role`. This selects which built-in action runs; it is NOT a display label (use `title` for that).",
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
formIo,
|
|
32
|
+
"title",
|
|
33
|
+
],
|
|
34
|
+
description: "The human-readable title of the action.",
|
|
35
|
+
},
|
|
36
|
+
handler: {
|
|
37
|
+
propDefinition: [
|
|
38
|
+
formIo,
|
|
39
|
+
"handler",
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
method: {
|
|
43
|
+
propDefinition: [
|
|
44
|
+
formIo,
|
|
45
|
+
"method",
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
priority: {
|
|
49
|
+
propDefinition: [
|
|
50
|
+
formIo,
|
|
51
|
+
"priority",
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
settings: {
|
|
55
|
+
propDefinition: [
|
|
56
|
+
formIo,
|
|
57
|
+
"settings",
|
|
58
|
+
],
|
|
59
|
+
description: "JSON-string object of action-specific settings. Example: `{\"transport\":\"default\",\"from\":\"noreply@example.com\",\"to\":\"admin@example.com\",\"subject\":\"New submission\"}`. Parsed from a JSON string before sending.",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
async run({ $ }) {
|
|
63
|
+
const {
|
|
64
|
+
formId,
|
|
65
|
+
actionType,
|
|
66
|
+
title,
|
|
67
|
+
handler,
|
|
68
|
+
method,
|
|
69
|
+
priority,
|
|
70
|
+
settings,
|
|
71
|
+
} = this;
|
|
72
|
+
|
|
73
|
+
const response = await this.formIo.createFormAction({
|
|
74
|
+
$,
|
|
75
|
+
formId,
|
|
76
|
+
data: {
|
|
77
|
+
name: actionType,
|
|
78
|
+
title,
|
|
79
|
+
handler,
|
|
80
|
+
method,
|
|
81
|
+
priority,
|
|
82
|
+
settings: parseJson(settings, "settings", "object"),
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
$.export("$summary", `Created form action "${response.title}" (${response._id})`);
|
|
87
|
+
return response;
|
|
88
|
+
},
|
|
89
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-create-role",
|
|
5
|
+
name: "Create Role",
|
|
6
|
+
description: "Create a role in the Form.io project. Use **List Roles** to review existing roles. Example: title `Reviewer`, description `Can review submissions` → returns the new role with its `_id`. [See the documentation](https://apidocs.form.io/#5123aaee-8a9d-42f0-b46f-0bd73b0477dd).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
title: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"title",
|
|
21
|
+
],
|
|
22
|
+
description: "The title of the role (e.g. `Manager`).",
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
formIo,
|
|
27
|
+
"description",
|
|
28
|
+
],
|
|
29
|
+
description: "A description of the role.",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
async run({ $ }) {
|
|
33
|
+
const {
|
|
34
|
+
title,
|
|
35
|
+
description,
|
|
36
|
+
} = this;
|
|
37
|
+
|
|
38
|
+
const response = await this.formIo.createRole({
|
|
39
|
+
$,
|
|
40
|
+
data: {
|
|
41
|
+
title,
|
|
42
|
+
description,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
$.export("$summary", `Created role "${response.title}" (${response._id})`);
|
|
47
|
+
return response;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
import { parseJson } from "../../common/utils.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "form_io-create-submission",
|
|
6
|
+
name: "Create Submission",
|
|
7
|
+
description: "Create a submission for a Form.io form. Use **List Forms** to find the form ID. The `data` prop is a JSON-string object of field key-value pairs matching the form's component keys. [See the documentation](https://apidocs.form.io/#fe0e1c46-ec0b-9141-fa11-db6e165fdcbd).",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
ai: "optimized",
|
|
11
|
+
annotations: {
|
|
12
|
+
readOnlyHint: false,
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
openWorldHint: true,
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
formIo,
|
|
18
|
+
formId: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
formIo,
|
|
21
|
+
"formId",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
data: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
formIo,
|
|
27
|
+
"data",
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
async run({ $ }) {
|
|
32
|
+
const {
|
|
33
|
+
formId,
|
|
34
|
+
data,
|
|
35
|
+
} = this;
|
|
36
|
+
|
|
37
|
+
const response = await this.formIo.createSubmission({
|
|
38
|
+
$,
|
|
39
|
+
formId,
|
|
40
|
+
data: {
|
|
41
|
+
data: parseJson(data, "data", "object"),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
$.export("$summary", `Created submission ${response._id} for form ${formId}`);
|
|
46
|
+
return response;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-delete-form",
|
|
5
|
+
name: "Delete Form",
|
|
6
|
+
description: "Permanently delete a form or resource from Form.io. Use **List Forms** to find the form ID. This is irreversible. [See the documentation](https://apidocs.form.io/#1e1a35ef-1456-4dd0-9b4e-62416759a73d).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: true,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
formId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"formId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
const response = await this.formIo.deleteForm({
|
|
26
|
+
$,
|
|
27
|
+
formId: this.formId,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
$.export("$summary", `Deleted form ${this.formId}`);
|
|
31
|
+
return response;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-delete-form-action",
|
|
5
|
+
name: "Delete Form Action",
|
|
6
|
+
description: "Permanently remove an action attached to a Form.io form. Use **List Form Actions** to find the action ID. This is irreversible. [See the documentation](https://apidocs.form.io/#994dc489-e530-4920-9389-813ba2ac9005).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: true,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
formId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"formId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
actionId: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
formIo,
|
|
26
|
+
"actionId",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const {
|
|
32
|
+
formId,
|
|
33
|
+
actionId,
|
|
34
|
+
} = this;
|
|
35
|
+
|
|
36
|
+
const response = await this.formIo.deleteFormAction({
|
|
37
|
+
$,
|
|
38
|
+
formId,
|
|
39
|
+
actionId,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
$.export("$summary", `Deleted form action ${actionId}`);
|
|
43
|
+
return response;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-delete-role",
|
|
5
|
+
name: "Delete Role",
|
|
6
|
+
description: "Permanently delete a role from the Form.io project. Obtain the role ID from **List Roles** (it is the role's 24-character hex `_id`, e.g. `64f8a1b2c3d4e5f60718293a`). This is irreversible. [See the documentation](https://apidocs.form.io/#df393393-6262-4c3a-8a5d-d3abb3182409).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: true,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
roleId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"roleId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
const response = await this.formIo.deleteRole({
|
|
26
|
+
$,
|
|
27
|
+
roleId: this.roleId,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
$.export("$summary", `Deleted role ${this.roleId}`);
|
|
31
|
+
return response;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-delete-submission",
|
|
5
|
+
name: "Delete Submission",
|
|
6
|
+
description: "Permanently delete a submission from a Form.io form. Use **List Submissions** to find the submission ID. This is irreversible. [See the documentation](https://apidocs.form.io/#080c6368-e029-c581-951b-a993bc02578a).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: true,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
formId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"formId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
submissionId: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
formIo,
|
|
26
|
+
"submissionId",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const {
|
|
32
|
+
formId,
|
|
33
|
+
submissionId,
|
|
34
|
+
} = this;
|
|
35
|
+
|
|
36
|
+
const response = await this.formIo.deleteSubmission({
|
|
37
|
+
$,
|
|
38
|
+
formId,
|
|
39
|
+
submissionId,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
$.export("$summary", `Deleted submission ${submissionId}`);
|
|
43
|
+
return response;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-get-form",
|
|
5
|
+
name: "Get Form",
|
|
6
|
+
description: "Retrieve a single form or resource by its ID from Form.io. Use **List Forms** to find the form ID. [See the documentation](https://apidocs.form.io/#fc94dbcd-7ac6-4d0f-9824-f7979bb6e67f).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
formId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"formId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
const response = await this.formIo.getForm({
|
|
26
|
+
$,
|
|
27
|
+
formId: this.formId,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
$.export("$summary", `Retrieved form "${response.title}" (${response._id})`);
|
|
31
|
+
return response;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-get-form-action",
|
|
5
|
+
name: "Get Form Action",
|
|
6
|
+
description: "Retrieve a single action attached to a Form.io form. Use **List Form Actions** to find the action ID. [See the documentation](https://apidocs.form.io/#72821b94-cc96-41b4-b271-cb5d9e9261cd).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
formId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"formId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
actionId: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
formIo,
|
|
26
|
+
"actionId",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const {
|
|
32
|
+
formId,
|
|
33
|
+
actionId,
|
|
34
|
+
} = this;
|
|
35
|
+
|
|
36
|
+
const response = await this.formIo.getFormAction({
|
|
37
|
+
$,
|
|
38
|
+
formId,
|
|
39
|
+
actionId,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
$.export("$summary", `Retrieved form action "${response.title}" (${response._id})`);
|
|
43
|
+
return response;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-get-role",
|
|
5
|
+
name: "Get Role",
|
|
6
|
+
description: "Retrieve a single role by its ID from the Form.io project. Obtain the role ID from **List Roles** (it is the role's 24-character hex `_id`, e.g. `64f8a1b2c3d4e5f60718293a`). [See the documentation](https://apidocs.form.io/#df393393-6262-4c3a-8a5d-d3abb3182409).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
roleId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"roleId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
const response = await this.formIo.getRole({
|
|
26
|
+
$,
|
|
27
|
+
roleId: this.roleId,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
$.export("$summary", `Retrieved role "${response.title}" (${response._id})`);
|
|
31
|
+
return response;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-get-submission",
|
|
5
|
+
name: "Get Submission",
|
|
6
|
+
description: "Retrieve a single submission for a Form.io form. Use **List Forms** to find the form ID and **List Submissions** to find the submission ID. [See the documentation](https://apidocs.form.io/#bc4aaf65-ee01-9c85-005f-ac7b433612d8).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
formId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"formId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
submissionId: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
formIo,
|
|
26
|
+
"submissionId",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const {
|
|
32
|
+
formId,
|
|
33
|
+
submissionId,
|
|
34
|
+
} = this;
|
|
35
|
+
|
|
36
|
+
const response = await this.formIo.getSubmission({
|
|
37
|
+
$,
|
|
38
|
+
formId,
|
|
39
|
+
submissionId,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
$.export("$summary", `Retrieved submission ${response._id}`);
|
|
43
|
+
return response;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import formIo from "../../form_io.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "form_io-list-form-actions",
|
|
5
|
+
name: "List Form Actions",
|
|
6
|
+
description: "List all actions attached to a Form.io form. Use **List Forms** to find the form ID. Form.io returns up to `limit` records (default 10); if you receive a full page there may be more — raise `limit` (up to 1000) or page with `skip` to retrieve them all. [See the documentation](https://apidocs.form.io/#3f2531ad-bd2e-4e8e-889f-1bce44ce9651).",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
ai: "optimized",
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
formIo,
|
|
17
|
+
formId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
formIo,
|
|
20
|
+
"formId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
limit: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
formIo,
|
|
26
|
+
"limit",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
skip: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
formIo,
|
|
32
|
+
"skip",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
sort: {
|
|
36
|
+
propDefinition: [
|
|
37
|
+
formIo,
|
|
38
|
+
"sort",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
async run({ $ }) {
|
|
43
|
+
const {
|
|
44
|
+
formId,
|
|
45
|
+
limit,
|
|
46
|
+
skip,
|
|
47
|
+
sort,
|
|
48
|
+
} = this;
|
|
49
|
+
|
|
50
|
+
const response = await this.formIo.listFormActions({
|
|
51
|
+
$,
|
|
52
|
+
formId,
|
|
53
|
+
params: {
|
|
54
|
+
limit,
|
|
55
|
+
skip,
|
|
56
|
+
sort,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const actions = Array.isArray(response)
|
|
61
|
+
? response
|
|
62
|
+
: response?.data ?? [];
|
|
63
|
+
|
|
64
|
+
$.export("$summary", `Retrieved ${actions.length} form action(s)`);
|
|
65
|
+
return response;
|
|
66
|
+
},
|
|
67
|
+
};
|