- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
New Components - zoho-sheet #14633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    New Components - zoho-sheet #14633
Changes from all commits
      Commits
    
    
            Show all changes
          
          
            5 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      b476fcf
              
                zoho_sheet init
              
              
                luancazarine 18316f9
              
                [Components] zoho_sheet #14584
              
              
                luancazarine d3f0fd6
              
                pnpm update
              
              
                luancazarine 0120350
              
                Update components/zoho_sheet/sources/common/base.mjs
              
              
                luancazarine 09f21ac
              
                Merge branch 'master' into issue-14584
              
              
                luancazarine File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
This file was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import zohoSheet from "../../zoho_sheet.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "zoho_sheet-create-row", | ||
| name: "Create Row", | ||
| description: "Creates a new row in the specified worksheet. [See the documentation](https://www.zoho.com/sheet/help/api/v2/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| zohoSheet, | ||
| workbookId: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "workbookId", | ||
| ], | ||
| }, | ||
| worksheet: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "worksheet", | ||
| ({ workbookId }) => ({ | ||
| workbookId, | ||
| }), | ||
| ], | ||
| }, | ||
| headerRow: { | ||
| type: "integer", | ||
| label: "Header Row", | ||
| description: "Default value is 1. This can be mentioned if the table header is not in the first row of the worksheet.", | ||
| optional: true, | ||
| }, | ||
| data: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "data", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.zohoSheet.createRow({ | ||
| $, | ||
| workbookId: this.workbookId, | ||
| data: { | ||
| worksheet_id: this.worksheet, | ||
| header_row: this.headerRow || 1, | ||
| json_data: JSON.stringify(parseObject(this.data)), | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully created a row in the worksheet: ${response.sheet_name}`); | ||
| return response; | ||
| }, | ||
| }; | ||
        
          
          
            88 changes: 88 additions & 0 deletions
          
          88 
        
  components/zoho_sheet/actions/search-delete-row/search-delete-row.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import zohoSheet from "../../zoho_sheet.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "zoho_sheet-search-delete-row", | ||
| name: "Search and Delete Row", | ||
| description: "Searches for a row based on provided criteria and deletes it. [See the documentation](https://www.zoho.com/sheet/help/api/v2/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| zohoSheet, | ||
| workbookId: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "workbookId", | ||
| ], | ||
| }, | ||
| worksheet: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "worksheet", | ||
| ({ workbookId }) => ({ | ||
| workbookId, | ||
| }), | ||
| ], | ||
| }, | ||
| headerRow: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "headerRow", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| criteria: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "criteria", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| rowArray: { | ||
| type: "integer[]", | ||
| label: "Row Array", | ||
| description: "Array of row indexs, which needs to be deleted.", | ||
| optional: true, | ||
| }, | ||
| firstMatchOnly: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "firstMatchOnly", | ||
| ], | ||
| }, | ||
| isCaseSensitive: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "isCaseSensitive", | ||
| ], | ||
| }, | ||
| deleteRows: { | ||
| type: "boolean", | ||
| label: "Delete Rows", | ||
| description: "If true it will delete the rows completely, otherwise the records are only erased by default.", | ||
| default: false, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| if (!this.criteria && !this.rowArray) { | ||
| throw new ConfigurationError("You must provide at least **Criteria** or **Row Array** to process this request."); | ||
| } | ||
| const response = await this.zohoSheet.deleteRow({ | ||
| $, | ||
| workbookId: this.workbookId, | ||
| data: { | ||
| worksheet_id: this.worksheet, | ||
| header_row: this.headerRow, | ||
| criteria: this.criteria, | ||
| row_array: JSON.stringify(parseObject(this.rowArray)), | ||
| first_match_only: this.firstMatchOnly, | ||
| is_case_sensitive: this.isCaseSensitive, | ||
| delete_rows: this.deleteRows, | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", `Row matching criteria deleted successfully from worksheet ${this.worksheet}`); | ||
| return response; | ||
| }, | ||
| }; | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import zohoSheet from "../../zoho_sheet.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "zoho_sheet-update-row", | ||
| name: "Update Row", | ||
| description: "Finds a specific row by its index and updates its content. [See the documentation](https://www.zoho.com/sheet/help/api/v2/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| zohoSheet, | ||
| workbookId: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "workbookId", | ||
| ], | ||
| }, | ||
| worksheet: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "worksheet", | ||
| ({ workbookId }) => ({ | ||
| workbookId, | ||
| }), | ||
| ], | ||
| }, | ||
| headerRow: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "headerRow", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| criteria: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "criteria", | ||
| ], | ||
| description: "If criteria is not set all available rows will get updated. Mention the criteria as described above.", | ||
| optional: true, | ||
| }, | ||
| firstMatchOnly: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "firstMatchOnly", | ||
| ], | ||
| description: "If true and if there are multiple records on the specified criteria, records will be updated for first match alone. Otherwise, all the matched records will be updated.", | ||
| }, | ||
| isCaseSensitive: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "isCaseSensitive", | ||
| ], | ||
| }, | ||
| data: { | ||
| propDefinition: [ | ||
| zohoSheet, | ||
| "data", | ||
| ], | ||
| type: "object", | ||
| description: "The JSON data that needs to be updated. Example:{\"Month\":\"May\",\"Amount\":50}", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.zohoSheet.updateRow({ | ||
| $, | ||
| workbookId: this.workbookId, | ||
| data: { | ||
| worksheet_id: this.worksheet, | ||
| header_row: this.headerRow, | ||
| criteria: this.criteria, | ||
| first_match_only: this.firstMatchOnly, | ||
| is_case_sensitive: this.isCaseSensitive, | ||
| data: JSON.stringify(parseObject(this.data)), | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully updated ${response.no_of_affected_rows} row(s) in worksheet ${this.worksheet}`); | ||
| return response; | ||
| }, | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| }; | ||
This file was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| export const parseObject = (obj) => { | ||
| if (!obj) return undefined; | ||
|  | ||
| if (Array.isArray(obj)) { | ||
| return obj.map((item) => { | ||
| if (typeof item === "string") { | ||
| try { | ||
| return JSON.parse(item); | ||
| } catch (e) { | ||
| return item; | ||
| } | ||
| } | ||
| return item; | ||
| }); | ||
| } | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| if (typeof obj === "string") { | ||
| try { | ||
| return JSON.parse(obj); | ||
| } catch (e) { | ||
| return obj; | ||
| } | ||
| } | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| return obj; | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| { | ||
| "name": "@pipedream/zoho_sheet", | ||
| "version": "0.0.3", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Zoho Sheet Components", | ||
| "main": "dist/app/zoho_sheet.app.mjs", | ||
| "main": "zoho_sheet.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "zoho_sheet" | ||
| ], | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "homepage": "https://pipedream.com/apps/zoho_sheet", | ||
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import zohoSheet from "../../zoho_sheet.app.mjs"; | ||
|  | ||
| export default { | ||
| props: { | ||
| zohoSheet, | ||
| http: "$.interface.http", | ||
| db: "$.service.db", | ||
| serviceName: { | ||
| type: "string", | ||
| label: "Service Name", | ||
| description: "The name of the webhook.", | ||
| }, | ||
| }, | ||
| methods: { | ||
| getExtraData() { | ||
| return {}; | ||
| }, | ||
| }, | ||
| hooks: { | ||
| async activate() { | ||
| await this.zohoSheet.createWebhook({ | ||
| data: { | ||
| service_name: this.serviceName.replace(/\s/g, ""), | ||
| target_url: this.http.endpoint, | ||
| event: this.getEvent(), | ||
| ...this.getExtraData(), | ||
| }, | ||
| }); | ||
| }, | ||
| async deactivate() { | ||
| await this.zohoSheet.deleteWebhook({ | ||
| data: { | ||
| target_url: this.http.endpoint, | ||
| ...this.getExtraData(), | ||
| }, | ||
| }); | ||
| }, | ||
| }, | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| async run({ body }) { | ||
| const ts = Date.parse(new Date()); | ||
| this.$emit(body, { | ||
| id: `${ts}`, | ||
| summary: this.getSummary(body), | ||
| ts: ts, | ||
| }); | ||
| }, | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| }; | ||
        
          
          
            54 changes: 54 additions & 0 deletions
          
          54 
        
  components/zoho_sheet/sources/new-or-updated-row-instant/new-or-updated-row-instant.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import common from "../common/base.mjs"; | ||
| import sampleEmit from "./test-event.mjs"; | ||
|  | ||
| export default { | ||
| ...common, | ||
| key: "zoho_sheet-new-or-updated-row-instant", | ||
| name: "New or Updated Row (Instant)", | ||
| description: "Emit new event whenever a row is added or modified.", | ||
| version: "0.0.1", | ||
| type: "source", | ||
| dedupe: "unique", | ||
| props: { | ||
| ...common.props, | ||
| workbookId: { | ||
| propDefinition: [ | ||
| common.props.zohoSheet, | ||
| "workbookId", | ||
| ], | ||
| }, | ||
| worksheetId: { | ||
| propDefinition: [ | ||
| common.props.zohoSheet, | ||
| "worksheet", | ||
| ({ workbookId }) => ({ | ||
| workbookId, | ||
| }), | ||
| ], | ||
| withLabel: true, | ||
| }, | ||
| alert: { | ||
| type: "alert", | ||
| alertType: "info", | ||
| content: "**New row** will be triggered only after the entire row is completed.", | ||
| }, | ||
| }, | ||
| methods: { | ||
| ...common.methods, | ||
| getEvent() { | ||
| return "update_worksheet"; | ||
| }, | ||
| getExtraData() { | ||
| return { | ||
| resource_id: this.workbookId, | ||
| worksheet_id: this.worksheetId.value, | ||
| }; | ||
| }, | ||
| getSummary({ updated_rows }) { | ||
| return `Row ${updated_rows[0].row_type === "NEW" | ||
| ? "created" | ||
| : "updated"} in worksheet ${this.worksheetId.label}`; | ||
| }, | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| }, | ||
| sampleEmit, | ||
|         
                  luancazarine marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| }; | ||
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.