Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
27 changes: 18 additions & 9 deletions components/monday/actions/common/common-create-item.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import {
capitalizeWord, getColumnOptions,
} from "../../common/utils.mjs";
import monday from "../../monday.app.mjs";

export default {
Expand All @@ -11,7 +14,7 @@ export default {
}),
],
type: "string[]",
description: "Select columns to fill",
description: "Select which item columns to set values for",
reloadProps: true,
},
},
Expand All @@ -20,26 +23,32 @@ export default {
if (!this.columns) {
return props;
}
const columnData = await this.monday.listColumns({
boardId: +this.boardId,
});
for (const column of this.columns) {
let description;
if (column === "status") {
description = "Value for status. [Status Index Value Map](https://view.monday.com/1073554546-ad9f20a427a16e67ded630108994c11b?r=use1)";
} else if (column === "person") {
description = "The ID of the person/user to add to item";
let description, options;
options = getColumnOptions(columnData, column);
if (column === "person") {
description = "The ID of a person/user";
} else if (column === "date4") {
description = "Enter date of item in YYYY-MM-DD format. Eg. `2022-09-02`";
description = "A date string in `YYYY-MM-DD` format, e.g. `2022-09-02`";
} else if (options) {
description = `Select a value from the list for column "${column}".`;
} else {
description = `Value for column ${column}. See the [Column Type Reference](https://developer.monday.com/api-reference/docs/column-types-reference) to learn more about entering column type values.`;
description = `Value for column "${column}". See the [Column Type Reference](https://developer.monday.com/api-reference/reference/column-types-reference) to learn more about entering column type values.`;
}
props[column] = {
type: "string",
label: column,
label: capitalizeWord(column),
description,
options,
};
}
return props;
},
methods: {
capitalizeWord,
getEmailValue(value) {
let email = value;
if (typeof value === "string") {
Expand Down
4 changes: 2 additions & 2 deletions components/monday/actions/create-board/create-board.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import monday from "../../monday.app.mjs";
export default {
key: "monday-create-board",
name: "Create Board",
description: "Creates a new board. [See the documentation](https://api.developer.monday.com/docs/boards#create-a-board)",
description: "Creates a new board. [See the documentation](https://developer.monday.com/api-reference/reference/boards#create-a-board)",
type: "action",
version: "0.0.7",
version: "0.0.8",
props: {
monday,
boardName: {
Expand Down
63 changes: 39 additions & 24 deletions components/monday/actions/create-column/create-column.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import constants from "../../common/constants.mjs";
import monday from "../../monday.app.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
key: "monday-create-column",
name: "Create Column",
description: "Creates a column. [See the documentation](https://developer.monday.com/api-reference/reference/columns#create-a-column)",
type: "action",
version: "0.0.8",
version: "0.1.0",
props: {
monday,
boardId: {
Expand All @@ -18,45 +19,63 @@ export default {
title: {
type: "string",
label: "Title",
description: "The new column's title.",
description: "The title of the new column",
},
columnType: {
type: "string",
label: "Column Type",
description: "The new column's title",
description: "The type of the new column",
options: constants.COLUMN_TYPE_OPTIONS,
reloadProps: true,
},
description: {
type: "string",
label: "Description",
description: "The column's description.",
description: "The description of the new column",
optional: true,
},
},
async additionalProps() {
const props = {};
const defaults = {
type: "string",
label: "Defaults",
description: "The new column's defaults. For use with column types `status` or `dropdown`. [See the documentation](https://developer.monday.com/api-reference/reference/columns#create-a-status-or-dropdown-column-with-custom-labels) for additional information.",
optional: true,
};
if (this.columnType === "status") {
props.defaults = {
...defaults,
default: "{\"labels\":{\"1\":\"Option1\",\"2\":\"Option2\",\"3\":\"Option3\",\"4\": \"Option4\"}}",
};
}
if (this.columnType === "dropdown") {
if ([
"status",
"dropdown",
].includes(this.columnType)) {
props.defaults = {
...defaults,
default: "{\"settings\":{\"labels\":[{\"id\":1,\"name\":\"Option1\"}, {\"id\":2,\"name\":\"Option2\"}, {\"id\":3,\"name\":\"Option3\"}]}}",
type: "string",
label: "Custom Labels (Defaults)",
description: "The new column's custom labels (defaults). For use with column types `status` or `dropdown`. Should be an object in the format `{ \"1\": \"Technology\", \"2\": \"Marketing\" }` where each key is the label ID and each value is the label text. [See the documentation](https://developer.monday.com/api-reference/reference/columns#create-a-status-or-dropdown-column-with-custom-labels) for more information.",
optional: true,
};
}
return props;
},
async run({ $ }) {
let { defaults } = this;
if (defaults) {
try {
if (this.columnType === "status") {
defaults = JSON.stringify({
labels: JSON.parse(defaults),
});
} else if (this.columnType === "dropdown") {
const obj = JSON.parse(defaults);
defaults = JSON.stringify({
settings: {
labels: Object.entries(obj).map(([
id,
name,
]) => ({
id: Number(id),
name,
})),
},
});
}
} catch (err) {
throw new ConfigurationError(`Error parsing \`Custom Labels\` as JSON: "${err}"`);
}
}
const {
data,
errors,
Expand All @@ -66,11 +85,7 @@ export default {
boardId: +this.boardId,
title: this.title,
columnType: this.columnType,
defaults: this.defaults
? typeof this.defaults !== "string"
? JSON.stringify(this.defaults)
: this.defaults
: undefined,
defaults,
description: this.description,
});

Expand Down
4 changes: 2 additions & 2 deletions components/monday/actions/create-group/create-group.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import monday from "../../monday.app.mjs";
export default {
key: "monday-create-group",
name: "Create Group",
description: "Creates a new group in a specific board. [See the documentation](https://api.developer.monday.com/docs/groups-queries#create-a-group)",
description: "Creates a new group in a specific board. [See the documentation](https://developer.monday.com/api-reference/reference/groups#create-a-group)",
type: "action",
version: "0.0.8",
version: "0.0.9",
props: {
monday,
boardId: {
Expand Down
4 changes: 2 additions & 2 deletions components/monday/actions/create-item/create-item.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export default {
...commonCreateItem,
key: "monday-create-item",
name: "Create Item",
description: "Creates an item. [See the documentation](https://api.developer.monday.com/docs/items-queries#create-an-item)",
description: "Creates an item. [See the documentation](https://developer.monday.com/api-reference/reference/items#create-an-item)",
type: "action",
version: "0.0.10",
version: "0.1.0",
props: {
monday,
boardId: {
Expand Down
4 changes: 2 additions & 2 deletions components/monday/actions/create-subitem/create-subitem.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
name: "Create Subitem",
description: "Creates a subitem. [See the documentation](https://developer.monday.com/api-reference/reference/subitems#create-a-subitem)",
type: "action",
version: "0.0.3",
version: "0.1.0",
props: {
monday,
boardId: {
Expand All @@ -26,7 +26,7 @@ export default {
}),
],
optional: false,
description: "The parent item's unique identifier",
description: "Select a parent item or provide an item ID",
},
itemName: {
propDefinition: [
Expand Down
4 changes: 2 additions & 2 deletions components/monday/actions/create-update/create-update.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Create an Update",
description: "Creates a new update. [See the documentation](https://developer.monday.com/api-reference/reference/updates#create-an-update)",
type: "action",
version: "0.0.10",
version: "0.0.11",
props: {
monday,
updateBody: {
Expand All @@ -33,7 +33,7 @@ export default {
},
parentId: {
label: "Parent Update ID",
description: "The parent post identifier",
description: "Select a parent update or provide an update ID",
propDefinition: [
monday,
"updateId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export default {
...common,
key: "monday-get-column-values",
name: "Get Column Values",
description: "Return values of a specific column or columns for a board item. [See the documentation](https://developer.monday.com/api-reference/docs/column-values-v2)",
version: "0.0.5",
description: "Return values of specific column(s) for a board item. [See the documentation](https://developer.monday.com/api-reference/reference/column-values-v2)",
version: "0.0.6",
type: "action",
props: {
...common.props,
Expand All @@ -29,7 +29,7 @@ export default {
],
type: "string[]",
label: "Columns",
description: "Return data from the specified column(s)",
description: "Select the column(s) to return data from",
optional: true,
},
},
Expand All @@ -49,7 +49,7 @@ export default {
throw new Error(response.errors[0].message);
}

$.export("$summary", `Successfully retrieved column values for item with ID ${this.itemId}.`);
$.export("$summary", `Successfully retrieved column values for item with ID ${this.itemId}`);

return this.formatColumnValues(response.data.items);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { getColumnOptions } from "../../common/utils.mjs";
import common from "../common/column-values.mjs";

export default {
...common,
key: "monday-get-items-by-column-value",
name: "Get Items By Column Value",
description: "Searches a column for items matching a value. [See the documentation](https://developer.monday.com/api-reference/docs/items-page-by-column-values)",
version: "0.0.5",
description: "Searches a column for items matching a value. [See the documentation](https://developer.monday.com/api-reference/reference/items-page-by-column-values)",
version: "0.1.0",
type: "action",
props: {
...common.props,
Expand All @@ -18,12 +19,26 @@ export default {
}),
],
description: "The column to search",
reloadProps: true,
},
value: {
type: "string",
label: "Value",
description: "The value to serach for. [See documentation](https://developer.monday.com/api-reference/docs/items-by-column-values#supported-limited-support-and-unsupported-columns) for additional information about column values.",
},
},
async additionalProps() {
const columnData = await this.monday.listColumns({
boardId: +this.boardId,
});

const options = getColumnOptions(columnData, this.columnId, true);

return {
value: {
type: "string",
label: "Value",
description: `The value to search for.${options
? ""
: " [See the documentation](https://developer.monday.com/api-reference/reference/items-page-by-column-values#supported-and-unsupported-columns) for additional information about column values"} `,
options,
},
};
},
async run({ $ }) {
const response = await this.monday.getItemsByColumnValue({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
import { axios } from "@pipedream/platform";
import fs from "fs";
import FormData from "form-data";
import { getColumnOptions } from "../../common/utils.mjs";

export default {
...common,
key: "monday-update-column-values",
name: "Update Column Values",
description: "Update multiple column values of an item. [See the documentation](https://developer.monday.com/api-reference/docs/columns#change-multiple-column-values)",
version: "0.0.5",
description: "Update multiple column values of an item. [See the documentation](https://developer.monday.com/api-reference/reference/columns#change-multiple-column-values)",
version: "0.1.0",
type: "action",
props: {
...common.props,
updateInfoBox: {

Check warning on line 16 in components/monday/actions/update-column-values/update-column-values.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop updateInfoBox must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 16 in components/monday/actions/update-column-values/update-column-values.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop updateInfoBox must have a description. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "See the [Column types reference](https://developer.monday.com/api-reference/reference/column-types-reference) to find the proper data structures for supported column types",
},
boardId: {

Check warning on line 21 in components/monday/actions/update-column-values/update-column-values.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop boardId must have a label. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 21 in components/monday/actions/update-column-values/update-column-values.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop boardId must have a description. See https://pipedream.com/docs/components/guidelines/#props
...common.props.boardId,
description: "The board's unique identifier. See the [Column types reference](https://developer.monday.com/api-reference/docs/column-types-reference) to find the proper data structures for supported column types.",
reloadProps: true,
},
itemId: {
Expand All @@ -30,17 +35,22 @@
},
async additionalProps() {
const props = {};
if (this.boardId) {
const columns = await this.getColumns(this.boardId);
const { boardId } = this;
if (boardId) {
const columns = await this.monday.listColumns({
boardId: +boardId,
});
for (const column of columns) {
props[column.id] = {
const id = column.id;
props[id] = {
type: "string",
label: column.title,
description: `The value for column ${column.title}`,
description: `The value for the "${column.title}" column (\`${id}\`)`,
optional: true,
options: getColumnOptions(columns, id),
};
if (column.type === "file") {
props[column.id].description += ". The path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp).";
props[column.id].description += ". The path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)";
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import monday from "../../monday.app.mjs";
export default {
key: "monday-update-item-name",
name: "Update Item Name",
description: "Update an item's name. [See the documentation](https://api.developer.monday.com/docs/item-name)",
description: "Update an item's name. [See the documentation](https://developer.monday.com/api-reference/reference/columns#change-multiple-column-values)",
type: "action",
version: "0.0.9",
version: "0.0.10",
props: {
monday,
boardId: {
Expand Down
Loading
Loading