- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
New Components - clearly_defined #15455
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
                    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
        
          
          
            60 changes: 60 additions & 0 deletions
          
          60 
        
  components/clearly_defined/actions/create-definition/create-definition.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,60 @@ | ||
| import clearlyDefined from "../../clearly_defined.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "clearly_defined-create-definition", | ||
| name: "Create Definition", | ||
| description: "Request the creation of a resource. [See the documentation](https://api.clearlydefined.io/api-docs/#/definitions/post_definitions).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| clearlyDefined, | ||
| type: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "type", | ||
| ], | ||
| }, | ||
| provider: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "provider", | ||
| ], | ||
| }, | ||
| namespace: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "namespace", | ||
| ], | ||
| }, | ||
| name: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "name", | ||
| ], | ||
| }, | ||
| revision: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "revision", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const component = `${this.type}/${this.provider}/${this.namespace}/${this.name}${this.revision | ||
| ? "/" + this.revision | ||
| : ""}`; | ||
|  | ||
| const response = await this.clearlyDefined.createDefinition({ | ||
| $, | ||
| data: [ | ||
| component, | ||
| ], | ||
| }); | ||
|  | ||
| if (response && Object.keys(response).length > 0) { | ||
| $.export("$summary", "Successfully created definition"); | ||
| } | ||
|  | ||
| return response; | ||
| }, | ||
| }; | ||
        
          
          
            140 changes: 140 additions & 0 deletions
          
          140 
        
  components/clearly_defined/actions/get-definitions/get-definitions.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,140 @@ | ||
| import clearlyDefined from "../../clearly_defined.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "clearly_defined-get-definitions", | ||
| name: "Get Definitions", | ||
| description: "Gets the coordinates for all definitions that match the given pattern in the specified part of the definition. [See the documentation](https://api.clearlydefined.io/api-docs/#/definitions/get_definitions).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| clearlyDefined, | ||
| pattern: { | ||
| type: "string", | ||
| label: "Pattern", | ||
| description: "The string to search for in definition coordinates to get coordinate suggestions", | ||
| optional: true, | ||
| }, | ||
| type: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "type", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| provider: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "provider", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| namespace: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "namespace", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| name: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "name", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| license: { | ||
| type: "string", | ||
| label: "License", | ||
| description: "The SPDX license identifier", | ||
| optional: true, | ||
| }, | ||
| releasedAfter: { | ||
| type: "string", | ||
| label: "Released After", | ||
| description: "The minimum release date for the component. E.g. `2025-01-01`", | ||
| optional: true, | ||
| }, | ||
| releasedBefore: { | ||
| type: "string", | ||
| label: "Released Before", | ||
| description: "The maximum release date for the component. E.g. `2025-01-01`", | ||
| optional: true, | ||
| }, | ||
| minLicensedScore: { | ||
| type: "integer", | ||
| label: "Min Licensed Score", | ||
| description: "The minimum effective licensed score for the component", | ||
| optional: true, | ||
| }, | ||
| maxLicensedScore: { | ||
| type: "integer", | ||
| label: "Max Licensed Score", | ||
| description: "The maximum effective licensed score for the component", | ||
| optional: true, | ||
| }, | ||
| minDescribedScore: { | ||
| type: "integer", | ||
| label: "Min Described Score", | ||
| description: "The minimum effective described score for the component", | ||
| optional: true, | ||
| }, | ||
| maxDescribedScore: { | ||
| type: "integer", | ||
| label: "Max Described Score", | ||
| description: "The maximum effective described score for the component", | ||
| optional: true, | ||
| }, | ||
|         
                  michelle0927 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| sort: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "sort", | ||
| ], | ||
| }, | ||
| sortDirection: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "sortDirection", | ||
| ], | ||
| }, | ||
| continuationToken: { | ||
| type: "string", | ||
| label: "Continuation Token", | ||
| description: "Used for pagination. Seeded from the results of the previous query", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.clearlyDefined.getDefinitions({ | ||
| $, | ||
| params: { | ||
| pattern: this.pattern, | ||
| type: this.type, | ||
| provider: this.provider, | ||
| name: this.name, | ||
| namespace: this.namespace, | ||
| license: this.license, | ||
| releasedAfter: this.releasedAfter, | ||
| releasedBefore: this.releasedBefore, | ||
| minLicensedScore: this.minLicensedScore, | ||
| maxLicensedScore: this.maxLicensedScore, | ||
| minDescribedScore: this.minDescribedScore, | ||
| maxDescribedScore: this.maxDescribedScore, | ||
| sort: this.sort, | ||
| sortDesc: this.sortDirection === "descending", | ||
| continuationToken: this.continuationToken, | ||
| }, | ||
| }); | ||
|  | ||
| const length = response.data | ||
| ? response.data.length | ||
| : response.length | ||
| ? response.length | ||
| : 0; | ||
|  | ||
| $.export("$summary", `Successfully retrieved ${length} definition${length === 1 | ||
| ? "" | ||
| : "s"}`); | ||
|  | ||
| return response; | ||
| }, | ||
|         
                  michelle0927 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| }; | ||
        
          
          
            67 changes: 67 additions & 0 deletions
          
          67 
        
  components/clearly_defined/actions/get-harvests/get-harvests.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,67 @@ | ||
| import clearlyDefined from "../../clearly_defined.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "clearly_defined-get-harvests", | ||
| name: "Get Harvests", | ||
| description: "Get all the harvested data for a component revision. [See the documentation](https://api.clearlydefined.io/api-docs/#/harvest/get_harvest__type___provider___namespace___name___revision_).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| clearlyDefined, | ||
| type: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "type", | ||
| ], | ||
| }, | ||
| provider: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "provider", | ||
| ], | ||
| }, | ||
| namespace: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "namespace", | ||
| ], | ||
| }, | ||
| name: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "name", | ||
| ], | ||
| }, | ||
| revision: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "revision", | ||
| ], | ||
| }, | ||
| form: { | ||
| propDefinition: [ | ||
| clearlyDefined, | ||
| "form", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.clearlyDefined.getHarvests({ | ||
| $, | ||
| type: this.type, | ||
| provider: this.provider, | ||
| name: this.name, | ||
| namespace: this.namespace, | ||
| revision: this.revision, | ||
| params: { | ||
| form: this.form, | ||
| }, | ||
| }); | ||
|  | ||
| if (response && Object.keys(response).length > 0) { | ||
| $.export("$summary", "Successfully retrieved harvest details"); | ||
| } | ||
|  | ||
| return response; | ||
| }, | ||
|         
                  michelle0927 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 | 
|---|---|---|
| @@ -1,11 +1,94 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
|  | ||
| export default { | ||
| type: "app", | ||
| app: "clearly_defined", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| type: { | ||
| type: "string", | ||
| label: "Type", | ||
| description: "The type of component", | ||
| options: constants.COMPONENT_TYPES, | ||
| }, | ||
| provider: { | ||
| type: "string", | ||
| label: "Provider", | ||
| description: "Where the component can be found", | ||
| options: constants.COMPONENT_PROVIDERS, | ||
| }, | ||
| namespace: { | ||
| type: "string", | ||
| label: "Namespace", | ||
| description: "Many component systems have namespaces. GitHub orgs, NPM namespace, Maven group id, Conda Subdir/Architecture. If your component does not have a namespace, use '-' (ASCII hyphen).", | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "The name of the component you want", | ||
| }, | ||
| revision: { | ||
| type: "string", | ||
| label: "Revision", | ||
| description: "Components typically have some differentiator like a version or commit id. Use that here. If this segment is omitted, the latest revision is used (if that makes sense for the provider).", | ||
| optional: true, | ||
| }, | ||
| sort: { | ||
| type: "string", | ||
| label: "Sort", | ||
| description: "The field to sort the results by", | ||
| options: constants.SORT_FIELDS, | ||
| optional: true, | ||
| }, | ||
| sortDirection: { | ||
| type: "string", | ||
| label: "Sort Direction", | ||
| description: "The direction to sort the results by", | ||
| options: constants.SORT_DIRECTIONS, | ||
| optional: true, | ||
| }, | ||
| form: { | ||
| type: "string", | ||
| label: "Form", | ||
| description: "Form of the response", | ||
| options: constants.RESPONSE_FORMS, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return `https://${this.$auth.environment}.clearlydefined.io`; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, | ||
| path, | ||
| ...opts | ||
| }) { | ||
| return axios($, { | ||
| url: `${this._baseUrl()}${path}`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| getDefinitions(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/definitions", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| getHarvests({ | ||
| type, provider, namespace, name, revision, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/harvest/${type}/${provider}/${namespace}/${name}/${revision}`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createDefinition(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/definitions", | ||
| ...opts, | ||
| }); | ||
|         
                  michelle0927 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.