Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
27 changes: 27 additions & 0 deletions apps/sim/blocks/blocks/google_sheets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,33 @@ export const GoogleSheetsBlock: BlockConfig<GoogleSheetsResponse> = {
title: 'Range',
type: 'short-input',
placeholder: 'Sheet name and cell range (e.g., Sheet1!A1:D10)',
wandConfig: {
enabled: true,
prompt: `Generate a valid Google Sheets range based on the user's description.

### VALID FORMATS
1. Sheet name only (for appending to end): Sheet1
2. Full range (for reading/writing specific cells): Sheet1!A1:D10

### RANGE RULES
- Sheet names with spaces must be quoted: 'My Sheet'!A1:B10
- Column letters are uppercase: A, B, C, ... Z, AA, AB, etc.
- Row numbers start at 1 (not 0)
- Range format: SheetName!StartCell:EndCell (e.g., Sheet1!A2:C10)
- For a single column: Sheet1!A:A
- For a single row: Sheet1!1:1

### EXAMPLES
- "the first sheet" -> Sheet1
- "data sheet from A1 to E100" -> 'Data Sheet'!A1:E100
- "append to orders sheet" -> Orders
- "cells A1 through C50 on Sheet2" -> Sheet2!A1:C50
- "column A of inventory" -> Inventory!A:A
- "just the headers row" -> Sheet1!1:1

Return ONLY the range string - no explanations, no quotes around the entire output, no extra text.`,
placeholder: 'Describe the range (e.g., "all data from Sheet1" or "A1 to D50")...',
},
},
// Write-specific Fields
{
Expand Down
78 changes: 78 additions & 0 deletions apps/sim/blocks/blocks/microsoft_excel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,33 @@ export const MicrosoftExcelBlock: BlockConfig<MicrosoftExcelResponse> = {
type: 'short-input',
placeholder: 'Sheet name and cell range (e.g., Sheet1!A1:D10)',
condition: { field: 'operation', value: ['read', 'write', 'update'] },
wandConfig: {
enabled: true,
prompt: `Generate a valid Microsoft Excel range based on the user's description.

### FORMAT (REQUIRED)
SheetName!StartCell:EndCell

Excel ALWAYS requires the full range format with both sheet name and cell range.

### RANGE RULES
- Sheet names with spaces must be quoted: 'My Sheet'!A1:B10
- Column letters are uppercase: A, B, C, ... Z, AA, AB, etc.
- Row numbers start at 1 (not 0)
- For entire columns: Sheet1!A:Z
- For entire rows: Sheet1!1:100

### EXAMPLES
- "the first sheet" -> Sheet1!A1:Z1000
- "data sheet from A1 to E100" -> 'Data Sheet'!A1:E100
- "cells A1 through C50 on Sheet2" -> Sheet2!A1:C50
- "column A of inventory" -> Inventory!A:A
- "just the headers row on Sheet1" -> Sheet1!1:1
- "all data on sales sheet" -> 'Sales'!A1:Z1000

Return ONLY the range string - no explanations, no quotes around the entire output, no extra text.`,
placeholder: 'Describe the range (e.g., "A1 to D50 on Sheet1")...',
},
},
{
id: 'tableName',
Expand All @@ -95,6 +122,22 @@ export const MicrosoftExcelBlock: BlockConfig<MicrosoftExcelResponse> = {
'Enter values as JSON array of arrays (e.g., [["A1", "B1"], ["A2", "B2"]]) or an array of objects (e.g., [{"name":"John", "age":30}, {"name":"Jane", "age":25}])',
condition: { field: 'operation', value: 'write' },
required: true,
wandConfig: {
enabled: true,
prompt: `Generate Microsoft Excel data as a JSON array based on the user's description.

Format options:
1. Array of arrays: [["Header1", "Header2"], ["Value1", "Value2"]]
2. Array of objects: [{"column1": "value1", "column2": "value2"}]

Examples:
- "sales data with product and revenue columns" -> [["Product", "Revenue"], ["Widget A", 1500], ["Widget B", 2300]]
- "list of employees with name and email" -> [{"name": "John Doe", "email": "[email protected]"}, {"name": "Jane Smith", "email": "[email protected]"}]

Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
placeholder: 'Describe the data you want to write...',
generationType: 'json-object',
},
},
{
id: 'valueInputOption',
Expand All @@ -114,6 +157,22 @@ export const MicrosoftExcelBlock: BlockConfig<MicrosoftExcelResponse> = {
'Enter values as JSON array of arrays (e.g., [["A1", "B1"], ["A2", "B2"]]) or an array of objects (e.g., [{"name":"John", "age":30}, {"name":"Jane", "age":25}])',
condition: { field: 'operation', value: 'update' },
required: true,
wandConfig: {
enabled: true,
prompt: `Generate Microsoft Excel data as a JSON array based on the user's description.

Format options:
1. Array of arrays: [["Header1", "Header2"], ["Value1", "Value2"]]
2. Array of objects: [{"column1": "value1", "column2": "value2"}]

Examples:
- "update with new prices" -> [["Product", "Price"], ["Widget A", 29.99], ["Widget B", 49.99]]
- "quarterly targets" -> [{"Q1": 10000, "Q2": 12000, "Q3": 15000, "Q4": 18000}]

Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
placeholder: 'Describe the data you want to update...',
generationType: 'json-object',
},
},
{
id: 'valueInputOption',
Expand All @@ -133,6 +192,25 @@ export const MicrosoftExcelBlock: BlockConfig<MicrosoftExcelResponse> = {
'Enter values as JSON array of arrays (e.g., [["A1", "B1"], ["A2", "B2"]]) or an array of objects (e.g., [{"name":"John", "age":30}, {"name":"Jane", "age":25}])',
condition: { field: 'operation', value: 'table_add' },
required: true,
wandConfig: {
enabled: true,
prompt: `Generate Microsoft Excel table row data as a JSON array based on the user's description.

Format options:
1. Array of arrays: [["Value1", "Value2"], ["Value3", "Value4"]]
2. Array of objects: [{"column1": "value1", "column2": "value2"}]

Note: When adding to an existing table, do NOT include headers - only data rows.

Examples:
- "add new sales record" -> [["2024-01-15", "Widget Pro", 5, 249.99]]
- "append customer info" -> [{"name": "Acme Corp", "contact": "John Smith", "status": "Active"}]
- "add multiple rows with name, age, city" -> [["Alice", 28, "NYC"], ["Bob", 35, "LA"]]

Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
placeholder: 'Describe the data you want to add to the table...',
generationType: 'json-object',
},
},
],
tools: {
Expand Down
155 changes: 149 additions & 6 deletions apps/sim/blocks/blocks/sharepoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,108 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
type: 'short-input',
placeholder: "Template (e.g., 'genericList')",
condition: { field: 'operation', value: 'create_list' },
wandConfig: {
enabled: true,
prompt: `Generate a SharePoint list template name based on the user's description.

### AVAILABLE TEMPLATES
- genericList - Standard list for general data (default)
- documentLibrary - For storing and managing documents
- survey - For creating surveys and polls
- links - For storing hyperlinks
- announcements - For news and announcements
- contacts - For contact information (name, email, phone)
- events - For calendar events and scheduling
- tasks - For task tracking and project management
- discussionBoard - For team discussions and forums
- pictureLibrary - For storing images and photos
- issue - For issue/bug tracking

### EXAMPLES
- "I want to track tasks" -> tasks
- "store documents" -> documentLibrary
- "team announcements" -> announcements
- "contact list" -> contacts
- "calendar events" -> events
- "general data" -> genericList
- "bug tracking" -> issue
- "photo gallery" -> pictureLibrary

Return ONLY the template name - no explanations, no quotes, no extra text.`,
placeholder: 'Describe what kind of list you need...',
},
},

{
id: 'pageContent',
title: 'Page Content',
id: 'columnDefinitions',
title: 'Column Definitions',
type: 'long-input',
placeholder: 'Provide page content',
placeholder: 'Optional: Define custom columns as JSON array',
condition: { field: 'operation', value: ['create_list'] },
Comment on lines +168 to 172
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field is named columnDefinitions in the UI but gets mapped to pageContent in the transform function (line 471). This creates a disconnect between the field name users see and the actual parameter name sent to the API. Consider either:

  1. Keeping the field ID as pageContent and updating just the title/placeholder to be more descriptive
  2. Or update the SharePoint tool/API to accept columnDefinitions as the parameter name instead of pageContent

This improves maintainability by keeping field IDs aligned with parameter names.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/sharepoint.ts
Line: 168:172

Comment:
The field is named `columnDefinitions` in the UI but gets mapped to `pageContent` in the transform function (line 471). This creates a disconnect between the field name users see and the actual parameter name sent to the API. Consider either:
1. Keeping the field ID as `pageContent` and updating just the title/placeholder to be more descriptive
2. Or update the SharePoint tool/API to accept `columnDefinitions` as the parameter name instead of `pageContent`

This improves maintainability by keeping field IDs aligned with parameter names.

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

wandConfig: {
enabled: true,
prompt: `Generate a JSON array of SharePoint list column definitions based on the user's description.

### FORMAT
A JSON array of column definition objects. Each column needs at minimum a "name" and column type properties.

### COLUMN TYPES AND PROPERTIES

**Text Column:**
{"name": "ColumnName", "text": {}}
- For single line of text

**Multi-line Text:**
{"name": "ColumnName", "text": {"allowMultipleLines": true}}

**Number Column:**
{"name": "ColumnName", "number": {}}
- Optional: "minimum", "maximum", "decimalPlaces"

**DateTime Column:**
{"name": "ColumnName", "dateTime": {"format": "dateOnly"}}
- format: "dateOnly" or "dateTime"

**Boolean (Yes/No):**
{"name": "ColumnName", "boolean": {}}

**Choice Column:**
{"name": "ColumnName", "choice": {"choices": ["Option1", "Option2", "Option3"]}}

**Person Column:**
{"name": "ColumnName", "personOrGroup": {}}

**Currency:**
{"name": "ColumnName", "currency": {"locale": "en-US"}}

### EXAMPLES

"add columns for status (choice: Active, Completed, On Hold), due date, and priority number"
-> [
{"name": "Status", "choice": {"choices": ["Active", "Completed", "On Hold"]}},
{"name": "DueDate", "dateTime": {"format": "dateOnly"}},
{"name": "Priority", "number": {"minimum": 1, "maximum": 5}}
]

"text column for description, yes/no for completed, date for start"
-> [
{"name": "Description", "text": {"allowMultipleLines": true}},
{"name": "Completed", "boolean": {}},
{"name": "StartDate", "dateTime": {"format": "dateOnly"}}
]

"assignee (person), budget (currency), category (choice: Marketing, Sales, Engineering)"
-> [
{"name": "Assignee", "personOrGroup": {}},
{"name": "Budget", "currency": {"locale": "en-US"}},
{"name": "Category", "choice": {"choices": ["Marketing", "Sales", "Engineering"]}}
]

Return ONLY the JSON array - no explanations, no markdown, no extra text.`,
placeholder:
'Describe the columns you want to add (e.g., "status dropdown, due date, priority number")...',
generationType: 'json-object',
},
},
{
id: 'listDescription',
Expand All @@ -164,9 +258,50 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
id: 'listItemFields',
title: 'List Item Fields',
type: 'long-input',
placeholder: 'Enter list item fields',
placeholder:
'Enter list item fields as JSON (e.g., {"Title": "My Item", "Status": "Active"})',
canonicalParamId: 'listItemFields',
condition: { field: 'operation', value: ['update_list', 'add_list_items'] },
wandConfig: {
enabled: true,
prompt: `Generate a JSON object for SharePoint list item fields based on the user's description.

### FORMAT
A JSON object where keys are column internal names and values are the data to set.

### RULES
- Use the column's internal name (often same as display name, but spaces become _x0020_)
- Common field names: Title, Status, Description, Priority, DueDate, AssignedTo, Category
- Date fields should use ISO 8601 format: "2024-01-15" or "2024-01-15T10:30:00Z"
- Number fields should be numeric, not strings
- Boolean fields use true/false
- Choice fields use the exact choice value as a string
- Person fields use the person's email or ID

### READ-ONLY FIELDS (automatically filtered out)
Id, UniqueId, GUID, Created, Modified, Author, Editor, ContentTypeId

### EXAMPLES

"set title to Project Alpha and status to In Progress"
-> {"Title": "Project Alpha", "Status": "In Progress"}

"update priority to high and due date to next Friday"
-> {"Priority": "High", "DueDate": "2024-01-19"}

"add task with title Review Document, assigned to [email protected]"
-> {"Title": "Review Document", "AssignedToLookupId": "[email protected]"}

"create contact with name John Smith, email [email protected], phone 555-1234"
-> {"Title": "John Smith", "Email": "[email protected]", "WorkPhone": "555-1234"}

"set completed to true and notes to Task finished successfully"
-> {"Completed": true, "Notes": "Task finished successfully"}

Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
placeholder: 'Describe the fields and values you want to set...',
generationType: 'json-object',
},
},

// Upload File operation fields
Expand Down Expand Up @@ -267,6 +402,7 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
includeItems,
uploadFiles,
files,
columnDefinitions,
...others
} = rest as any

Expand Down Expand Up @@ -314,7 +450,7 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {

// Handle file upload files parameter
const fileParam = uploadFiles || files
const baseParams = {
const baseParams: Record<string, any> = {
credential,
siteId: effectiveSiteId || undefined,
pageSize: others.pageSize ? Number.parseInt(others.pageSize as string, 10) : undefined,
Expand All @@ -331,6 +467,10 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
baseParams.files = fileParam
}

if (columnDefinitions) {
baseParams.pageContent = columnDefinitions
}

return baseParams
},
},
Expand All @@ -339,7 +479,10 @@ export const SharepointBlock: BlockConfig<SharepointResponse> = {
operation: { type: 'string', description: 'Operation to perform' },
credential: { type: 'string', description: 'Microsoft account credential' },
pageName: { type: 'string', description: 'Page name' },
pageContent: { type: 'string', description: 'Page content' },
columnDefinitions: {
type: 'string',
description: 'Column definitions for list creation (JSON array)',
},
pageTitle: { type: 'string', description: 'Page title' },
pageId: { type: 'string', description: 'Page ID' },
siteSelector: { type: 'string', description: 'Site selector' },
Expand Down
32 changes: 32 additions & 0 deletions apps/sim/blocks/blocks/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,38 @@ Return ONLY the PostgREST filter expression - no explanations, no markdown, no e
type: 'short-input',
placeholder: 'column_name (add DESC for descending)',
condition: { field: 'operation', value: 'query' },
wandConfig: {
enabled: true,
prompt: `Generate a Supabase order by clause based on the user's description.

### FORMAT
column_name [ASC|DESC]

### RULES
- Column name only: sorts ascending by default
- Add DESC after column name for descending order
- Add ASC after column name for ascending order (explicit)
- Column names are case-sensitive and should match your database schema

### COMMON PATTERNS
- Newest first: created_at DESC
- Oldest first: created_at ASC
- Alphabetical: name
- Reverse alphabetical: name DESC
- Highest value first: price DESC
- Lowest value first: price ASC

### EXAMPLES
- "sort by start time newest first" -> start_time DESC
- "order by name alphabetically" -> name
- "sort by created date oldest first" -> created_at ASC
- "highest scores first" -> score DESC
- "sort by updated timestamp descending" -> updated_at DESC
- "order by email" -> email

Return ONLY the order by expression - no explanations, no extra text.`,
placeholder: 'Describe how to sort (e.g., "newest first by created_at")...',
},
},
// Optional limit for query operation
{
Expand Down
Loading