Skip to content

Commit fcf3693

Browse files
committed
Implement Hex app with comprehensive actions and constants
- Added prop definitions for project, run, user, group, and connection IDs in hex.app.mjs. - Introduced new actions: create, edit, delete groups; create, update, list data connections; run projects; and get project runs and run status. - Added utility functions for parsing objects and constants for sharing options and run statuses. - Updated package version to 0.1.0 and added dependencies. - Enhanced documentation links for actions and methods.
1 parent 54291be commit fcf3693

File tree

15 files changed

+1263
-7
lines changed

15 files changed

+1263
-7
lines changed
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
import { parseObject } from "../../common/utils.mjs";
2+
import hex from "../../hex.app.mjs";
3+
4+
export default {
5+
key: "hex-create-data-connection",
6+
name: "Create Data Connection",
7+
description: "Create a data connection. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/CreateDataConnection)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
type: "action",
15+
props: {
16+
hex,
17+
sharingWorkspacePublic: {
18+
propDefinition: [
19+
hex,
20+
"sharingWorkspacePublic",
21+
],
22+
},
23+
sharingWorkspaceGuests: {
24+
propDefinition: [
25+
hex,
26+
"sharingWorkspaceGuests",
27+
],
28+
},
29+
sharingWorkspaceMembers: {
30+
propDefinition: [
31+
hex,
32+
"sharingWorkspaceMembers",
33+
],
34+
},
35+
groups: {
36+
propDefinition: [
37+
hex,
38+
"groups",
39+
],
40+
},
41+
schemaRefreshAccess: {
42+
propDefinition: [
43+
hex,
44+
"schemaRefreshAccess",
45+
],
46+
},
47+
schemaRefreshSchedule: {
48+
propDefinition: [
49+
hex,
50+
"schemaRefreshSchedule",
51+
],
52+
},
53+
schemaFilters: {
54+
propDefinition: [
55+
hex,
56+
"schemaFilters",
57+
],
58+
},
59+
allowWritebackCells: {
60+
propDefinition: [
61+
hex,
62+
"allowWritebackCells",
63+
],
64+
},
65+
includeMagic: {
66+
propDefinition: [
67+
hex,
68+
"includeMagic",
69+
],
70+
},
71+
connectViaSsh: {
72+
propDefinition: [
73+
hex,
74+
"connectViaSsh",
75+
],
76+
},
77+
description: {
78+
propDefinition: [
79+
hex,
80+
"description",
81+
],
82+
},
83+
connectionDetails: {
84+
propDefinition: [
85+
hex,
86+
"connectionDetails",
87+
],
88+
},
89+
type: {
90+
propDefinition: [
91+
hex,
92+
"type",
93+
],
94+
},
95+
name: {
96+
propDefinition: [
97+
hex,
98+
"name",
99+
],
100+
},
101+
},
102+
async run({ $ }) {
103+
const response = await this.hex.createDataConnection({
104+
$,
105+
data: {
106+
sharing: {
107+
workspace: {
108+
public: this.sharingWorkspacePublic,
109+
guests: this.sharingWorkspaceGuests,
110+
members: this.sharingWorkspaceMembers,
111+
},
112+
},
113+
schemaRefreshAccess: this.schemaRefreshAccess,
114+
schemaRefreshSchedule:
115+
this.schemaRefreshSchedule && parseObject(this.schemaRefreshSchedule),
116+
schemaFilters: this.schemaFilters && parseObject(this.schemaFilters),
117+
allowWritebackCells: this.allowWritebackCells,
118+
includeMagic: this.includeMagic,
119+
connectViaSsh: this.connectViaSsh,
120+
description: this.description,
121+
connectionDetails: this.connectionDetails && parseObject(this.connectionDetails),
122+
type: this.type,
123+
name: this.name,
124+
},
125+
});
126+
127+
$.export("$summary", `Successfully created group with ID: ${response.id}`);
128+
return response;
129+
},
130+
};
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { parseObject } from "../../common/utils.mjs";
2+
import hex from "../../hex.app.mjs";
3+
4+
export default {
5+
key: "hex-create-group",
6+
name: "Create Group",
7+
description: "Create a group to manage users. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/CreateGroup)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
type: "action",
15+
props: {
16+
hex,
17+
name: {
18+
type: "string",
19+
label: "Name",
20+
description: "The name of the group.",
21+
},
22+
users: {
23+
propDefinition: [
24+
hex,
25+
"userId",
26+
],
27+
type: "string[]",
28+
label: "User IDs",
29+
description: "A list of user IDs to add to the group.",
30+
optional: true,
31+
},
32+
},
33+
async run({ $ }) {
34+
const response = await this.hex.createGroup({
35+
$,
36+
data: {
37+
name: this.name,
38+
members: {
39+
users: this.users && parseObject(this.users)?.map((user) => ({
40+
id: user,
41+
})),
42+
},
43+
},
44+
});
45+
46+
$.export("$summary", `Successfully created group with ID: ${response.id}`);
47+
return response;
48+
},
49+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import hex from "../../hex.app.mjs";
3+
4+
export default {
5+
key: "hex-deactivate-user",
6+
name: "Deactivate User",
7+
description: "Deactivate a user. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/DeactivateUser)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
type: "action",
15+
props: {
16+
hex,
17+
userId: {
18+
propDefinition: [
19+
hex,
20+
"userId",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
try {
26+
const response = await this.hex.deactivateUser({
27+
$,
28+
userId: this.userId,
29+
});
30+
31+
$.export("$summary", `Successfully deactivated user with ID: ${this.userId}`);
32+
return response;
33+
} catch ({ response }) {
34+
throw new ConfigurationError(response.data.reason);
35+
}
36+
},
37+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import hex from "../../hex.app.mjs";
2+
3+
export default {
4+
key: "hex-delete-group",
5+
name: "Delete Group",
6+
description: "Delete a group to manage users. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/DeleteGroup)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
hex,
16+
groupId: {
17+
propDefinition: [
18+
hex,
19+
"groupId",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.hex.deleteGroup({
25+
$,
26+
groupId: this.groupId,
27+
});
28+
29+
$.export("$summary", `Successfully deleted group with ID: ${this.groupId}`);
30+
return response;
31+
},
32+
};
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
import { parseObject } from "../../common/utils.mjs";
2+
import hex from "../../hex.app.mjs";
3+
4+
export default {
5+
key: "hex-edit-data-connection",
6+
name: "Edit Data Connection",
7+
description: "Edit a specific data connection. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/EditDataConnection)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
type: "action",
15+
props: {
16+
hex,
17+
connectionId: {
18+
propDefinition: [
19+
hex,
20+
"connectionId",
21+
],
22+
},
23+
sharingWorkspacePublic: {
24+
propDefinition: [
25+
hex,
26+
"sharingWorkspacePublic",
27+
],
28+
},
29+
sharingWorkspaceGuests: {
30+
propDefinition: [
31+
hex,
32+
"sharingWorkspaceGuests",
33+
],
34+
},
35+
sharingWorkspaceMembers: {
36+
propDefinition: [
37+
hex,
38+
"sharingWorkspaceMembers",
39+
],
40+
},
41+
groups: {
42+
propDefinition: [
43+
hex,
44+
"groups",
45+
],
46+
},
47+
schemaRefreshAccess: {
48+
propDefinition: [
49+
hex,
50+
"schemaRefreshAccess",
51+
],
52+
},
53+
schemaRefreshSchedule: {
54+
propDefinition: [
55+
hex,
56+
"schemaRefreshSchedule",
57+
],
58+
},
59+
schemaFilters: {
60+
propDefinition: [
61+
hex,
62+
"schemaFilters",
63+
],
64+
},
65+
allowWritebackCells: {
66+
propDefinition: [
67+
hex,
68+
"allowWritebackCells",
69+
],
70+
},
71+
includeMagic: {
72+
propDefinition: [
73+
hex,
74+
"includeMagic",
75+
],
76+
},
77+
connectViaSsh: {
78+
propDefinition: [
79+
hex,
80+
"connectViaSsh",
81+
],
82+
},
83+
description: {
84+
propDefinition: [
85+
hex,
86+
"description",
87+
],
88+
},
89+
connectionDetails: {
90+
propDefinition: [
91+
hex,
92+
"connectionDetails",
93+
],
94+
optional: true,
95+
},
96+
name: {
97+
propDefinition: [
98+
hex,
99+
"name",
100+
],
101+
optional: true,
102+
},
103+
},
104+
async run({ $ }) {
105+
const response = await this.hex.updateDataConnection({
106+
$,
107+
connectionId: this.connectionId,
108+
data: {
109+
sharing: {
110+
workspace: {
111+
public: this.sharingWorkspacePublic,
112+
guests: this.sharingWorkspaceGuests,
113+
members: this.sharingWorkspaceMembers,
114+
},
115+
},
116+
schemaRefreshAccess: this.schemaRefreshAccess,
117+
schemaRefreshSchedule:
118+
this.schemaRefreshSchedule && parseObject(this.schemaRefreshSchedule),
119+
schemaFilters: this.schemaFilters && parseObject(this.schemaFilters),
120+
allowWritebackCells: this.allowWritebackCells,
121+
includeMagic: this.includeMagic,
122+
connectViaSsh: this.connectViaSsh,
123+
description: this.description,
124+
connectionDetails: this.connectionDetails && parseObject(this.connectionDetails),
125+
name: this.name,
126+
},
127+
});
128+
129+
$.export("$summary", `Successfully created group with ID: ${response.id}`);
130+
return response;
131+
},
132+
};

0 commit comments

Comments
 (0)