Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { parseObject } from "../../common/utils.mjs";
import hex from "../../hex.app.mjs";

export default {
key: "hex-create-data-connection",
name: "Create Data Connection",
description: "Create a data connection. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/CreateDataConnection)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
hex,
sharingWorkspacePublic: {
propDefinition: [
hex,
"sharingWorkspacePublic",
],
},
sharingWorkspaceGuests: {
propDefinition: [
hex,
"sharingWorkspaceGuests",
],
},
sharingWorkspaceMembers: {
propDefinition: [
hex,
"sharingWorkspaceMembers",
],
},
groups: {
propDefinition: [
hex,
"groups",
],
},
schemaRefreshAccess: {
propDefinition: [
hex,
"schemaRefreshAccess",
],
},
schemaRefreshSchedule: {
propDefinition: [
hex,
"schemaRefreshSchedule",
],
},
schemaFilters: {
propDefinition: [
hex,
"schemaFilters",
],
},
allowWritebackCells: {
propDefinition: [
hex,
"allowWritebackCells",
],
},
includeMagic: {
propDefinition: [
hex,
"includeMagic",
],
},
connectViaSsh: {
propDefinition: [
hex,
"connectViaSsh",
],
},
description: {
propDefinition: [
hex,
"description",
],
},
connectionDetails: {
propDefinition: [
hex,
"connectionDetails",
],
},
type: {
propDefinition: [
hex,
"type",
],
},
name: {
propDefinition: [
hex,
"name",
],
},
},
async run({ $ }) {
const response = await this.hex.createDataConnection({
$,
data: {
sharing: {
workspace: {
public: this.sharingWorkspacePublic,
guests: this.sharingWorkspaceGuests,
members: this.sharingWorkspaceMembers,
},
},
schemaRefreshAccess: this.schemaRefreshAccess,
schemaRefreshSchedule:
this.schemaRefreshSchedule && parseObject(this.schemaRefreshSchedule),
schemaFilters: this.schemaFilters && parseObject(this.schemaFilters),
allowWritebackCells: this.allowWritebackCells,
includeMagic: this.includeMagic,
connectViaSsh: this.connectViaSsh,
description: this.description,
connectionDetails: this.connectionDetails && parseObject(this.connectionDetails),
type: this.type,
name: this.name,
},
});

$.export("$summary", `Successfully created group with ID: ${response.id}`);
return response;
},
};
49 changes: 49 additions & 0 deletions components/hex/actions/create-group/create-group.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { parseObject } from "../../common/utils.mjs";
import hex from "../../hex.app.mjs";

export default {
key: "hex-create-group",
name: "Create Group",
description: "Create a group to manage users. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/CreateGroup)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
hex,
name: {
type: "string",
label: "Name",
description: "The name of the group.",
},
users: {
propDefinition: [
hex,
"userId",
],
type: "string[]",
label: "User IDs",
description: "A list of user IDs to add to the group.",
optional: true,
},
},
async run({ $ }) {
const response = await this.hex.createGroup({
$,
data: {
name: this.name,
members: {
users: this.users && parseObject(this.users)?.map((user) => ({
id: user,
})),
},
},
});

$.export("$summary", `Successfully created group with ID: ${response.id}`);
return response;
},
};
37 changes: 37 additions & 0 deletions components/hex/actions/deactivate-user/deactivate-user.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ConfigurationError } from "@pipedream/platform";
import hex from "../../hex.app.mjs";

export default {
key: "hex-deactivate-user",
name: "Deactivate User",
description: "Deactivate a user. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/DeactivateUser)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
hex,
userId: {
propDefinition: [
hex,
"userId",
],
},
},
async run({ $ }) {
try {
const response = await this.hex.deactivateUser({
$,
userId: this.userId,
});

$.export("$summary", `Successfully deactivated user with ID: ${this.userId}`);
return response;
} catch ({ response }) {
throw new ConfigurationError(response.data.reason);
}
},
};
32 changes: 32 additions & 0 deletions components/hex/actions/delete-group/delete-group.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import hex from "../../hex.app.mjs";

export default {
key: "hex-delete-group",
name: "Delete Group",
description: "Delete a group to manage users. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/DeleteGroup)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
hex,
groupId: {
propDefinition: [
hex,
"groupId",
],
},
},
async run({ $ }) {
const response = await this.hex.deleteGroup({
$,
groupId: this.groupId,
});

$.export("$summary", `Successfully deleted group with ID: ${this.groupId}`);
return response;
},
};
132 changes: 132 additions & 0 deletions components/hex/actions/edit-data-connection/edit-data-connection.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import { parseObject } from "../../common/utils.mjs";
import hex from "../../hex.app.mjs";

export default {
key: "hex-edit-data-connection",
name: "Edit Data Connection",
description: "Edit a specific data connection. [See the documentation](https://learn.hex.tech/docs/api/api-reference#operation/EditDataConnection)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
hex,
connectionId: {
propDefinition: [
hex,
"connectionId",
],
},
sharingWorkspacePublic: {
propDefinition: [
hex,
"sharingWorkspacePublic",
],
},
sharingWorkspaceGuests: {
propDefinition: [
hex,
"sharingWorkspaceGuests",
],
},
sharingWorkspaceMembers: {
propDefinition: [
hex,
"sharingWorkspaceMembers",
],
},
groups: {
propDefinition: [
hex,
"groups",
],
},
schemaRefreshAccess: {
propDefinition: [
hex,
"schemaRefreshAccess",
],
},
schemaRefreshSchedule: {
propDefinition: [
hex,
"schemaRefreshSchedule",
],
},
schemaFilters: {
propDefinition: [
hex,
"schemaFilters",
],
},
allowWritebackCells: {
propDefinition: [
hex,
"allowWritebackCells",
],
},
includeMagic: {
propDefinition: [
hex,
"includeMagic",
],
},
connectViaSsh: {
propDefinition: [
hex,
"connectViaSsh",
],
},
description: {
propDefinition: [
hex,
"description",
],
},
connectionDetails: {
propDefinition: [
hex,
"connectionDetails",
],
optional: true,
},
name: {
propDefinition: [
hex,
"name",
],
optional: true,
},
},
async run({ $ }) {
const response = await this.hex.updateDataConnection({
$,
connectionId: this.connectionId,
data: {
sharing: {
workspace: {
public: this.sharingWorkspacePublic,
guests: this.sharingWorkspaceGuests,
members: this.sharingWorkspaceMembers,
},
},
schemaRefreshAccess: this.schemaRefreshAccess,
schemaRefreshSchedule:
this.schemaRefreshSchedule && parseObject(this.schemaRefreshSchedule),
schemaFilters: this.schemaFilters && parseObject(this.schemaFilters),
allowWritebackCells: this.allowWritebackCells,
includeMagic: this.includeMagic,
connectViaSsh: this.connectViaSsh,
description: this.description,
connectionDetails: this.connectionDetails && parseObject(this.connectionDetails),
name: this.name,
},
});

$.export("$summary", `Successfully created group with ID: ${response.id}`);
return response;
},
};
Loading