- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
[Components] roamresearch - Added new components #14482
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
      
      
            jcortes
  merged 2 commits into
  PipedreamHQ:master
from
jcortes:roamresearch-new-generic-components-and-source
  
      
      
   
  Nov 5, 2024 
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            2 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    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 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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
        
          
          
            41 changes: 41 additions & 0 deletions
          
          41 
        
  components/roamresearch/actions/append-blocks/append-blocks.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,41 @@ | ||
| import utils from "../../common/utils.mjs"; | ||
| import app from "../../roamresearch.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "roamresearch-append-blocks", | ||
| name: "Append Blocks", | ||
| description: "Generic append blocks for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/kjnAseQ-K).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| location: { | ||
| type: "object", | ||
| label: "Location", | ||
| description: "The location to append the block to. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/kjnAseQ-K).", | ||
| }, | ||
| appendData: { | ||
| type: "string[]", | ||
| label: "Append Data", | ||
| description: "The data to append to the block. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/kjnAseQ-K).", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| location, | ||
| appendData, | ||
| } = this; | ||
|  | ||
| const response = await app.appendBlocks({ | ||
| $, | ||
| data: { | ||
| location, | ||
| ["append-data"]: utils.parseArray(appendData), | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", "Successfully ran append blocks."); | ||
| return response; | ||
| }, | ||
|         
                  jcortes 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
    
  
  
    
              
  
    
      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,45 @@ | ||
| import app from "../../roamresearch.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "roamresearch-pull-many", | ||
| name: "Pull Many", | ||
| description: "Generic pull many for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/mdnjFsqoA).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| eids: { | ||
| type: "string", | ||
| label: "Entity IDs", | ||
| description: "The entity IDs to pull. Eg. `[[:block/uid \"08-30-2022\"] [:block/uid \"08-31-2022\"]]`.", | ||
| }, | ||
| selector: { | ||
| type: "string", | ||
| label: "Selector", | ||
| description: "The selector to pull. Eg. `[:block/uid :node/title :block/string {:block/children [:block/uid :block/string]} {:block/refs [:node/title :block/string :block/uid]}]`.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| eids, | ||
| selector, | ||
| } = this; | ||
|  | ||
| const response = await app.pullMany({ | ||
| $, | ||
| data: { | ||
| eids, | ||
| selector, | ||
| }, | ||
| }); | ||
|  | ||
| if (!response.result) { | ||
| $.export("$summary", `Failed to pull many data for entity IDs: \`${eids}\`.`); | ||
| return response; | ||
| } | ||
|         
                  jcortes marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| $.export("$summary", "Successfully ran pull many."); | ||
| return response; | ||
| }, | ||
|         
                  jcortes 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,45 @@ | ||
| import app from "../../roamresearch.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "roamresearch-pull", | ||
| name: "Pull", | ||
| description: "Generic pull for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/mdnjFsqoA).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| eid: { | ||
| type: "string", | ||
| label: "Entity ID", | ||
| description: "The entity ID to pull. Eg. `[:block/uid \"08-30-2022\"]`.", | ||
| }, | ||
| selector: { | ||
| type: "string", | ||
| label: "Selector", | ||
| description: "The selector to pull. Eg. `[:block/uid :node/title :block/string {:block/children [:block/uid :block/string]} {:block/refs [:node/title :block/string :block/uid]}]`.", | ||
| }, | ||
| }, | ||
|         
                  jcortes marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| eid, | ||
| selector, | ||
| } = this; | ||
|  | ||
| const response = await app.pull({ | ||
| $, | ||
| data: { | ||
| eid, | ||
| selector, | ||
| }, | ||
| }); | ||
|  | ||
| if (!response.result) { | ||
| $.export("$summary", `Failed to pull data for entity ID: \`${eid}\`.`); | ||
| return response; | ||
| } | ||
|  | ||
| $.export("$summary", "Successfully ran pull."); | ||
| return response; | ||
| }, | ||
| }; | ||
  
    
      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,40 @@ | ||
| import app from "../../roamresearch.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "roamresearch-query", | ||
| name: "Query", | ||
| description: "Generic query for Roam Research pages. [See the documentation](https://roamresearch.com/#/app/developer-documentation/page/mdnjFsqoA).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| query: { | ||
| type: "string", | ||
| label: "Query", | ||
| description: "The query to run in Datalog language. Eg. `[:find ?block-uid ?block-str :in $ ?search-string :where [?b :block/uid ?block-uid] [?b :block/string ?block-str] [(clojure.string/includes? ?block-str ?search-string)]]`.", | ||
| }, | ||
| args: { | ||
| type: "string[]", | ||
| label: "Arguments", | ||
| description: "The arguments to pass to the query. Eg. `apple` as the firs argument.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| query, | ||
| args, | ||
| } = this; | ||
|  | ||
| const response = await app.query({ | ||
| $, | ||
| data: { | ||
| query, | ||
| args, | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", "Successfully ran query."); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      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
    
  
  
    
              
      
      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.