AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(tables): improve the step forms (#15287)
Talal Jaber0ba4be0d1a3e
diff --git a/packages/pieces/core/tables/package.json b/packages/pieces/core/tables/package.jsonindex 868a0da3ca1..7e3c0cc0537 100644--- a/packages/pieces/core/tables/package.json+++ b/packages/pieces/core/tables/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-tables",- "version": "0.5.1",+ "version": "0.5.2","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {diff --git a/packages/pieces/core/tables/src/i18n/translation.json b/packages/pieces/core/tables/src/i18n/translation.jsonindex 0d5a7002af5..6c17e8bfa13 100644--- a/packages/pieces/core/tables/src/i18n/translation.json+++ b/packages/pieces/core/tables/src/i18n/translation.json@@ -7,35 +7,35 @@"Get Record": "Get Record","Find Records": "Find Records","Clear Table": "Clear Table",- "Insert one or more new records to a table.": "Insert one or more new records to a table.",- "Delete record(s) from a table": "Delete record(s) from a table",- "Update values in an existing record": "Update values in an existing record",- "Get single record by its id.": "Get single record by its id.",- "Find records in a table with filters.": "Find records in a table with filters.",- "Delete all records from a table": "Delete all records from a table",+ "Download Table": "Download Table","Create a new table, optionally with fields.": "Create a new table, optionally with fields.","Delete a table and all of its records.": "Delete a table and all of its records.",- "Fields": "Fields",- "The columns to create. Leave empty to create a table with no fields.": "The columns to create. Leave empty to create a table with no fields.",- "Field Name": "Field Name",- "Type": "Type",- "Options": "Options",- "Comma-separated options, used only when Type is Single Select.": "Comma-separated options, used only when Type is Single Select.",- "Records (Raw)": "Records (Raw)",- "Advanced: provide records as a JSON array of objects keyed by field name, e.g. [{\"Name\":\"John\",\"Age\":30}]. Use this when the table is selected dynamically (its columns are unknown at build time). When set, this overrides the Records form above.": "Advanced: provide records as a JSON array of objects keyed by field name, e.g. [{\"Name\":\"John\",\"Age\":30}]. Use this when the table is selected dynamically (its columns are unknown at build time). When set, this overrides the Records form above.",+ "Insert one or more new records into a table.": "Insert one or more new records into a table.",+ "Delete record(s) from a table.": "Delete record(s) from a table.",+ "Update values in an existing record.": "Update values in an existing record.",+ "Get a single record by its ID.": "Get a single record by its ID.",+ "Find records in a table with filters.": "Find records in a table with filters.",+ "Delete all records from a table.": "Delete all records from a table.",+ "Export a table as a CSV file.": "Export a table as a CSV file.","Table Name": "Table Name",- "Records": "Records",- "Records IDs": "Records IDs",- "Record ID": "Record ID",+ "Fields": "Fields",+ "Table": "Table","Values": "Values",- "Limit": "Limit",+ "Records as JSON": "Records as JSON",+ "Record IDs": "Record IDs",+ "Record ID": "Record ID","Filters": "Filters",- "The records to create.": "The records to create.",- "The IDs of the records to delete": "The IDs of the records to delete",- "The ID of the record to do the action on.": "The ID of the record to do the action on.",- "The values to update. Leave empty to keep current value.": "The values to update. Leave empty to keep current value.",- "Maximum number of records to return (default no limit).": "Maximum number of records to return (default no limit).",- "Filter conditions to apply": "Filter conditions to apply",+ "Limit": "Limit",+ "Include Headers": "Include Headers",+ "The columns to create. Leave empty to create a table with no fields.": "The columns to create. Leave empty to create a table with no fields.",+ "One entry per record to insert.": "One entry per record to insert.",+ "Array of objects keyed by field name. Overrides the form above.": "Array of objects keyed by field name. Overrides the form above.",+ "Usually mapped from a Find Records step or a table trigger.": "Usually mapped from a Find Records step or a table trigger.",+ "Usually comes from a Find Records step or a table trigger.": "Usually comes from a Find Records step or a table trigger.",+ "Leave a field empty to keep its current value.": "Leave a field empty to keep its current value.",+ "All conditions must match. Empty returns every record.": "All conditions must match. Empty returns every record.",+ "Maximum records to return. Empty returns all records.": "Maximum records to return. Empty returns all records.",+ "Adds the column names as the first row of the CSV.": "Adds the column names as the first row of the CSV.","New Record Created": "New Record Created","Record Updated": "Record Updated","Record Deleted": "Record Deleted",diff --git a/packages/pieces/core/tables/src/index.ts b/packages/pieces/core/tables/src/index.tsindex ec7cf27281c..5e71702df78 100644--- a/packages/pieces/core/tables/src/index.ts+++ b/packages/pieces/core/tables/src/index.ts@@ -17,7 +17,7 @@ export const tables = createPiece({displayName: 'Tables',logoUrl: 'https://cdn.activepieces.com/pieces/new-core/tables.svg',categories: [PieceCategory.CORE],- minimumSupportedRelease: '0.80.0',+ minimumSupportedRelease: '0.88.2',authors: ['amrdb'],auth: PieceAuth.None(),actions: [createTable, deleteTable, createRecords, deleteRecord, updateRecord, getRecord, findRecords, clearTable, downloadTable],diff --git a/packages/pieces/core/tables/src/lib/actions/clear-table.ts b/packages/pieces/core/tables/src/lib/actions/clear-table.tsindex c3d21935311..7649ed047f3 100644--- a/packages/pieces/core/tables/src/lib/actions/clear-table.ts+++ b/packages/pieces/core/tables/src/lib/actions/clear-table.ts@@ -8,7 +8,7 @@ export const clearTable = createAction({name: 'tables-clear-table',classification: 'DESTRUCTIVE',displayName: 'Clear Table',- description: 'Delete all records from a table',+ description: 'Delete all records from a table.',aiMetadata: { description: 'Removes every record from an Activepieces Table while leaving the table and its field/column definitions intact. Pick this to empty a table before reloading it; use Delete Record(s) to remove specific rows by ID, or Delete Table to drop the table itself. Requires the table ID and deletes all rows with no filter or confirmation step; idempotent, since the table ends up empty no matter how many times it runs.', idempotent: true },auth: PieceAuth.None(),props: {diff --git a/packages/pieces/core/tables/src/lib/actions/create-records.ts b/packages/pieces/core/tables/src/lib/actions/create-records.tsindex bc204d53757..23623fb1e0b 100644--- a/packages/pieces/core/tables/src/lib/actions/create-records.ts+++ b/packages/pieces/core/tables/src/lib/actions/create-records.ts@@ -1,4 +1,4 @@-import { createAction, MarkdownVariant, PieceAuth, Property } from '@activepieces/pieces-framework';+import { createAction, DynamicPropsValue, MarkdownVariant, PieceAuth, Property } from '@activepieces/pieces-framework';import { AuthenticationType, httpClient, HttpMethod, propsValidation } from '@activepieces/pieces-common';import { CreateRecordsRequest } from '@activepieces/pieces-framework';import { tablesCommon } from '../common';@@ -9,21 +9,26 @@ export const createRecords = createAction({name: 'tables-create-records',classification: 'WRITE',displayName: 'Create Record(s)',- description: 'Insert one or more new records to a table.',+ description: 'Insert one or more new records into a table.',aiMetadata: { description: 'Inserts one or more new rows into an Activepieces Table via either a per-field form built from the columns of the selected table, or a raw JSON array of objects keyed by column name that overrides the form, for when the table is chosen dynamically at runtime. Use Update Record instead to change a row that already exists. Requires a table ID, and any value whose key does not match a real column is silently dropped; not idempotent, since every call appends new records with new IDs.', idempotent: false },auth: PieceAuth.None(),props: {table_id: tablesCommon.table_id,values: Property.DynamicProperties({auth: PieceAuth.None(),- displayName: 'Records',- description: 'The records to create.',+ displayName: 'Values',+ description: 'One entry per record to insert.',required: true,refreshers: ['table_id'],- props: async ({ table_id }, context) => {+ props: async ({ table_id }, context): Promise<DynamicPropsValue> => {const tableExternalId = table_id as unknown as string;if ((tableExternalId ?? '').toString().length === 0) {- return {};+ return {+ markdown: Property.MarkDown({+ value: 'Select a table to load its fields.',+ variant: MarkdownVariant.INFO,+ }),+ };}try {const tableId = await tablesCommon.convertTableExternalIdToId(tableExternalId, context);@@ -36,7 +41,7 @@ export const createRecords = createAction({return {values: Property.Array({displayName: 'Records',- description: 'Add one or more records to insert',+ description: 'Add one or more records to insert.',required: true,properties: fields,}),@@ -45,7 +50,7 @@ export const createRecords = createAction({return {markdown: Property.MarkDown({value:- "Couldn't load the fields for this table. If it's selected dynamically (e.g. from a previous step), use the \"Records (Raw)\" field below to provide records as JSON.",+ "Couldn't load the fields for this table. If the table is chosen dynamically (e.g. from a previous step), open Advanced and fill in Records as JSON.",variant: MarkdownVariant.INFO,}),};@@ -53,10 +58,10 @@ export const createRecords = createAction({},}),records: Property.Json({- displayName: 'Records (Raw)',- description:- 'Advanced: provide records as a JSON array of objects keyed by field name, e.g. [{"Name":"John","Age":30}]. Use this when the table is selected dynamically (its columns are unknown at build time). When set, this overrides the Records form above.',+ displayName: 'Records as JSON',+ description: 'Array of objects keyed by field name. Overrides the form above.',required: false,+ advanced: true,}),},outputSchema: createRecordsActionOutputSchema,diff --git a/packages/pieces/core/tables/src/lib/actions/create-table.ts b/packages/pieces/core/tables/src/lib/actions/create-table.tsindex 845d5d47b69..70185d1eda9 100644--- a/packages/pieces/core/tables/src/lib/actions/create-table.ts+++ b/packages/pieces/core/tables/src/lib/actions/create-table.ts@@ -15,6 +15,7 @@ export const createTable = createAction({name: Property.ShortText({displayName: 'Table Name',required: true,+ placeholder: 'Customers',}),fields: Property.Array({displayName: 'Fields',@@ -24,6 +25,7 @@ export const createTable = createAction({name: Property.ShortText({displayName: 'Field Name',required: true,+ placeholder: 'Email',}),type: Property.StaticDropdown({displayName: 'Type',@@ -41,8 +43,9 @@ export const createTable = createAction({}),options: Property.ShortText({displayName: 'Options',- description: 'Comma-separated options, used only when Type is Single Select.',+ description: 'Only used when Type is Single Select.',required: false,+ placeholder: 'Low, Medium, High',}),},}),diff --git a/packages/pieces/core/tables/src/lib/actions/delete-record.ts b/packages/pieces/core/tables/src/lib/actions/delete-record.tsindex 93e53d4618b..6daaa9cea7c 100644--- a/packages/pieces/core/tables/src/lib/actions/delete-record.ts+++ b/packages/pieces/core/tables/src/lib/actions/delete-record.ts@@ -8,15 +8,15 @@ export const deleteRecord = createAction({name: 'tables-delete-record',classification: 'DESTRUCTIVE',displayName: 'Delete Record(s)',- description: 'Delete record(s) from a table',+ description: 'Delete record(s) from a table.',aiMetadata: { description: 'Deletes one or more rows from an Activepieces Table by record ID, accepting a list of IDs in a single call. Pick this to remove specific known rows; use Clear Table to empty a table wholesale, or Delete Table to drop the table along with its schema. Requires the table ID plus the record IDs, which come from Find Records or a table trigger payload, and cannot delete by filter or field value; idempotent.', idempotent: true },auth: PieceAuth.None(),props: {table_id: tablesCommon.table_id,records_ids: Property.Array({- displayName: 'Records IDs',+ displayName: 'Record IDs',required: true,- description: 'The IDs of the records to delete'+ description: 'Usually mapped from a Find Records step or a table trigger.'}),},outputSchema: deleteRecordActionOutputSchema,diff --git a/packages/pieces/core/tables/src/lib/actions/download-table.ts b/packages/pieces/core/tables/src/lib/actions/download-table.tsindex b2e2c3d04c3..10915f8d141 100644--- a/packages/pieces/core/tables/src/lib/actions/download-table.ts+++ b/packages/pieces/core/tables/src/lib/actions/download-table.ts@@ -23,9 +23,8 @@ export const downloadTable = createAction({table_id: tablesCommon.table_id,include_headers: Property.Checkbox({displayName: 'Include Headers',- description:- 'Whether to include column headers as the first row of the CSV.',- required: true,+ description: 'Adds the column names as the first row of the CSV.',+ required: false,defaultValue: true,}),},diff --git a/packages/pieces/core/tables/src/lib/actions/find-records.ts b/packages/pieces/core/tables/src/lib/actions/find-records.tsindex 9fa3a3ab547..ba14cb9ac9e 100644--- a/packages/pieces/core/tables/src/lib/actions/find-records.ts+++ b/packages/pieces/core/tables/src/lib/actions/find-records.ts@@ -1,4 +1,4 @@-import { createAction, PieceAuth, Property } from '@activepieces/pieces-framework';+import { createAction, DynamicPropsValue, MarkdownVariant, PieceAuth, Property } from '@activepieces/pieces-framework';import { tablesCommon } from '../common';import { AuthenticationType, httpClient, HttpMethod, propsValidation } from '@activepieces/pieces-common';import { FieldType, Filter, FilterOperator, ListRecordsRequest, PopulatedRecord, SeekPage } from '@activepieces/pieces-framework';@@ -21,25 +21,19 @@ export const findRecords = createAction({auth: PieceAuth.None(),props: {table_id: tablesCommon.table_id,- limit: Property.Number({- displayName: 'Limit',- description: 'Maximum number of records to return (default no limit).',- required: false,- }),filters: Property.DynamicProperties({auth: PieceAuth.None(),displayName: 'Filters',- description: 'Filter conditions to apply',+ description: 'All conditions must match. Empty returns every record.',required: false,refreshers: ['table_id'],- props: async (propsValue, context) => {+ props: async (propsValue, context): Promise<DynamicPropsValue> => {const table_id = propsValue['table_id'];if (!table_id || typeof table_id !== 'string') {return {- filters: Property.Array({- displayName: 'Filters',- required: false,- properties: {},+ markdown: Property.MarkDown({+ value: 'Select a table to load its fields.',+ variant: MarkdownVariant.INFO,}),};}@@ -53,6 +47,7 @@ export const findRecords = createAction({return {filters: Property.Array({displayName: 'Filters',+ description: 'All conditions must match. Empty returns every record.',required: false,properties: {field: Property.StaticDropdown({@@ -71,11 +66,11 @@ export const findRecords = createAction({options: {options: [{ label: 'Equals', value: FilterOperator.EQ },- { label: 'Not Equals', value: FilterOperator.NEQ },- { label: 'Greater Than', value: FilterOperator.GT },- { label: 'Greater Than or Equal', value: FilterOperator.GTE },- { label: 'Less Than', value: FilterOperator.LT },- { label: 'Less Than or Equal', value: FilterOperator.LTE },+ { label: 'Not equals', value: FilterOperator.NEQ },+ { label: 'Greater than', value: FilterOperator.GT },+ { label: 'Greater than or equal', value: FilterOperator.GTE },+ { label: 'Less than', value: FilterOperator.LT },+ { label: 'Less than or equal', value: FilterOperator.LTE },{ label: 'Contains', value: FilterOperator.CO },{ label: 'Exists', value: FilterOperator.EXISTS },{ label: 'Does not exist', value: FilterOperator.NOT_EXISTS },@@ -84,6 +79,7 @@ export const findRecords = createAction({}),value: Property.ShortText({displayName: 'Value',+ description: 'Ignored for Exists and Does not exist.',required: false,}),},@@ -91,6 +87,12 @@ export const findRecords = createAction({};},}),+ limit: Property.Number({+ displayName: 'Limit',+ description: 'Maximum records to return. Empty returns all records.',+ required: false,+ advanced: true,+ }),},outputSchema: findRecordsActionOutputSchema,async run(context) {diff --git a/packages/pieces/core/tables/src/lib/actions/get-record.ts b/packages/pieces/core/tables/src/lib/actions/get-record.tsindex 337341854a5..8af7fbc9838 100644--- a/packages/pieces/core/tables/src/lib/actions/get-record.ts+++ b/packages/pieces/core/tables/src/lib/actions/get-record.ts@@ -1,4 +1,4 @@-import { createAction, PieceAuth, Property } from '@activepieces/pieces-framework';+import { createAction, PieceAuth } from '@activepieces/pieces-framework';import { tablesCommon } from '../common';import { AuthenticationType, httpClient, HttpMethod } from '@activepieces/pieces-common';import { PopulatedRecord } from '@activepieces/pieces-framework';@@ -9,7 +9,7 @@ export const getRecord = createAction({name: 'tables-get-record',classification: 'READ',displayName: 'Get Record',- description: 'Get single record by its id.',+ description: 'Get a single record by its ID.',aiMetadata: { description: 'Fetches one Activepieces Table record by its record ID and returns its cell values. Pick this when the exact record ID is already in hand, for example from a table trigger payload or an earlier Find Records step; use Find Records to look rows up by column value instead. Requires both the table ID and the record ID, and cannot search by column content; read-only and idempotent.', idempotent: true },auth: PieceAuth.None(),props: {diff --git a/packages/pieces/core/tables/src/lib/actions/update-record.ts b/packages/pieces/core/tables/src/lib/actions/update-record.tsindex d847c253c6f..3d35fa857d7 100644--- a/packages/pieces/core/tables/src/lib/actions/update-record.ts+++ b/packages/pieces/core/tables/src/lib/actions/update-record.ts@@ -1,4 +1,4 @@-import { createAction, PieceAuth, Property } from '@activepieces/pieces-framework';+import { createAction, DynamicPropsValue, MarkdownVariant, PieceAuth, Property } from '@activepieces/pieces-framework';import { tablesCommon } from '../common';import { AuthenticationType, httpClient, HttpMethod, propsValidation } from '@activepieces/pieces-common';import { PopulatedRecord, UpdateRecordRequest } from '@activepieces/pieces-framework';@@ -9,7 +9,7 @@ export const updateRecord = createAction({name: 'tables-update-record',classification: 'WRITE',displayName: 'Update Record',- description: 'Update values in an existing record',+ description: 'Update values in an existing record.',aiMetadata: { description: 'Overwrites cell values on one existing Activepieces Table record addressed by its record ID, changing only the columns supplied - blank values are skipped and keep whatever the record already holds. Pick this to modify a known row; use Create Record(s) to insert new rows, since this action only edits a record that already exists. Requires both the table ID and the record ID, and each value is validated against the type of its column; idempotent, since re-applying the same values leaves the record unchanged.', idempotent: true },auth: PieceAuth.None(),props: {@@ -18,15 +18,20 @@ export const updateRecord = createAction({values: Property.DynamicProperties({auth: PieceAuth.None(),displayName: 'Values',- description: 'The values to update. Leave empty to keep current value.',+ description: 'Leave a field empty to keep its current value.',required: true,refreshers: ['table_id'],- props: async ({ table_id }, context) => {+ props: async ({ table_id }, context): Promise<DynamicPropsValue> => {const tableExternalId = table_id as unknown as string;- const tableId = await tablesCommon.convertTableExternalIdToId(tableExternalId, context);- if ((tableId ?? '').toString().length === 0) {- return {};+ if ((tableExternalId ?? '').toString().length === 0) {+ return {+ markdown: Property.MarkDown({+ value: 'Select a table to load its fields.',+ variant: MarkdownVariant.INFO,+ }),+ };}+ const tableId = await tablesCommon.convertTableExternalIdToId(tableExternalId, context);return tablesCommon.createFieldProperties({ tableId, context });},diff --git a/packages/pieces/core/tables/src/lib/common/index.ts b/packages/pieces/core/tables/src/lib/common/index.tsindex d6cce3acf72..0260560d209 100644--- a/packages/pieces/core/tables/src/lib/common/index.ts+++ b/packages/pieces/core/tables/src/lib/common/index.ts@@ -32,10 +32,9 @@ const getFieldTypeText = (fieldType: FieldType) => {export const tablesCommon = {table_id: Property.Dropdown({auth: PieceAuth.None(),- displayName: 'Table Name',+ displayName: 'Table',required: true,refreshers: [],- refreshOnSearch: true,options: async (_propsValue, context) => {try {const tables = await fetchAllTables(context);@@ -62,7 +61,7 @@ export const tablesCommon = {record_id: Property.ShortText({displayName: 'Record ID',- description: 'The ID of the record to do the action on.',+ description: 'Usually comes from a Find Records step or a table trigger.',required: true,}),@@ -115,7 +114,7 @@ export const tablesCommon = {const tableFields = await this.getTableFields({ tableId, context });if (!Array.isArray(tableFields) || tableFields.length === 0) {fields['markdown'] = Property.MarkDown({- value: `We couldn't find any fields in the selected table. Please add fields to the table first.`,+ value: `This table has no fields yet. Add fields to the table first.`,variant: MarkdownVariant.INFO,});return fields;@@ -166,7 +165,7 @@ export const tablesCommon = {} catch (e) {console.error('Error fetching fields:', e);fields['markdown'] = Property.MarkDown({- value: `We couldn't find any fields in the selected table. Please add fields to the table first.`,+ value: `Couldn't load the fields of this table. Try again.`,variant: MarkdownVariant.INFO,});