-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - keboola #17157
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 - keboola #17157
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions
27
components/keboola/actions/get-bucket-detail/get-bucket-detail.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,27 @@ | ||
| import keboola from "../../keboola.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "keboola-get-bucket-detail", | ||
| name: "Get Bucket Detail", | ||
| description: "Get detailed information about a specific bucket in Keboola. [See the documentation](https://keboola.docs.apiary.io/#reference/buckets/manage-bucket/bucket-detail)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| keboola, | ||
| bucketId: { | ||
| propDefinition: [ | ||
| keboola, | ||
| "bucketId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.keboola.getBucketDetails({ | ||
| $, | ||
| bucketId: this.bucketId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved bucket details for bucket ID: ${this.bucketId}`); | ||
| return response; | ||
| }, | ||
| }; |
35 changes: 35 additions & 0 deletions
35
components/keboola/actions/get-table-detail/get-table-detail.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,35 @@ | ||
| import keboola from "../../keboola.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "keboola-get-table-detail", | ||
| name: "Get Table Detail", | ||
| description: "Get detailed information about a specific table. [See the documentation](https://keboola.docs.apiary.io/#reference/tables/manage-tables/table-detail)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| keboola, | ||
| bucketId: { | ||
| propDefinition: [ | ||
| keboola, | ||
| "bucketId", | ||
| ], | ||
| }, | ||
| tableId: { | ||
| propDefinition: [ | ||
| keboola, | ||
| "tableId", | ||
| (c) => ({ | ||
| bucketId: c.bucketId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.keboola.getTableDetails({ | ||
| $, | ||
| tableId: this.tableId, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved details for table ID: ${this.tableId}`); | ||
| return response; | ||
| }, | ||
| }; |
26 changes: 26 additions & 0 deletions
26
components/keboola/actions/retrieve-bucket-tables/retrieve-bucket-tables.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,26 @@ | ||
| import keboola from "../../keboola.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "keboola-retrieve-bucket-tables", | ||
| name: "List Tables In Bucket", | ||
| description: "Lists all tables in a specified bucket. [See the documentation](https://keboola.docs.apiary.io/#reference/tables/create-or-list-tables/tables-in-bucket)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| keboola, | ||
| bucketId: { | ||
| propDefinition: [ | ||
| keboola, | ||
| "bucketId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const tables = await this.keboola.listTablesInBucket({ | ||
| $, | ||
| bucketId: this.bucketId, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved ${tables.length} tables from bucket ${this.bucketId}.`); | ||
| return tables; | ||
| }, | ||
| }; |
20 changes: 20 additions & 0 deletions
20
components/keboola/actions/retrieve-buckets/retrieve-buckets.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,20 @@ | ||
| import keboola from "../../keboola.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "keboola-retrieve-buckets", | ||
| name: "Retrieve Buckets", | ||
| description: "Lists all buckets in your Keboola project. [See the documentation](https://keboola.docs.apiary.io/#reference/buckets/create-or-list-buckets/list-all-buckets)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| keboola, | ||
| }, | ||
| async run({ $ }) { | ||
| const buckets = await this.keboola.listBuckets({ | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${buckets.length} buckets.`); | ||
| return buckets; | ||
| }, | ||
| }; |
53 changes: 53 additions & 0 deletions
53
components/keboola/actions/update-bucket/update-bucket.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,53 @@ | ||
| import keboola from "../../keboola.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "keboola-update-bucket", | ||
| name: "Update Bucket", | ||
| description: "Updates a bucket with a new display name in Keboola. [See the documentation](https://keboola.docs.apiary.io/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| keboola, | ||
| bucketId: { | ||
| propDefinition: [ | ||
| keboola, | ||
| "bucketId", | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| displayName: { | ||
| type: "string", | ||
| label: "Display Name", | ||
| description: "The new display name for the bucket", | ||
| }, | ||
| color: { | ||
| type: "string", | ||
| label: "Color", | ||
| description: "The new color for the bucket. Format: #RRGGBB", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async additionalProps(props) { | ||
| if (this.bucketId) { | ||
| const bucket = await this.keboola.getBucketDetails({ | ||
| bucketId: this.bucketId, | ||
| }); | ||
| props.displayName.default = bucket.displayName; | ||
| props.color.default = bucket.color || ""; | ||
| } | ||
| return {}; | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.keboola.updateBucket({ | ||
| $, | ||
| bucketId: this.bucketId, | ||
| data: { | ||
| displayName: this.displayName, | ||
| color: this.color, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully updated bucket with ID ${this.bucketId} to have new display name: "${this.displayName}"`); | ||
| return response; | ||
| }, | ||
| }; | ||
53 changes: 53 additions & 0 deletions
53
components/keboola/actions/update-table-name/update-table-name.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,53 @@ | ||
| import keboola from "../../keboola.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "keboola-update-table-name", | ||
| name: "Update Table Name", | ||
| description: "Update the name of a table. [See the documentation](https://keboola.docs.apiary.io/#reference/tables/manage-tables/table-update)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| keboola, | ||
| bucketId: { | ||
| propDefinition: [ | ||
| keboola, | ||
| "bucketId", | ||
| ], | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| tableId: { | ||
| propDefinition: [ | ||
| keboola, | ||
| "tableId", | ||
| (c) => ({ | ||
| bucketId: c.bucketId, | ||
| }), | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| displayName: { | ||
| type: "string", | ||
| label: "Display Name", | ||
| description: "The new display name for the table", | ||
| }, | ||
| }, | ||
| async additionalProps(props) { | ||
| if (this.tableId) { | ||
| const table = await this.keboola.getTableDetails({ | ||
| tableId: this.tableId, | ||
| }); | ||
| props.displayName.default = table.displayName; | ||
| } | ||
| return {}; | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.keboola.updateTable({ | ||
| $, | ||
| tableId: this.tableId, | ||
| data: { | ||
| displayName: this.displayName, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully updated table name to ${this.displayName}`); | ||
| 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 |
|---|---|---|
| @@ -1,11 +1,109 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "keboola", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| bucketId: { | ||
| type: "string", | ||
| label: "Bucket ID", | ||
| description: "The ID of the bucket", | ||
| async options() { | ||
| const buckets = await this.listBuckets(); | ||
| return buckets.map(({ | ||
| id: value, name: label, | ||
| }) => ({ | ||
| label, | ||
| value, | ||
| })); | ||
| }, | ||
| }, | ||
| tableId: { | ||
| type: "string", | ||
| label: "Table ID", | ||
| description: "The ID of the table", | ||
| async options({ bucketId }) { | ||
| const tables = await this.listTablesInBucket({ | ||
| bucketId, | ||
| }); | ||
| return tables.map(({ | ||
| id: value, name: label, | ||
| }) => ({ | ||
| label, | ||
| value, | ||
| })); | ||
| }, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return `https://${this.$auth.stack_endpoint}/v2/storage`; | ||
| }, | ||
| _headers() { | ||
| return { | ||
| "x-storageapi-token": `${this.$auth.api_token}`, | ||
| "content-type": "multipart/form-data", | ||
| }; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| _makeRequest({ | ||
| $ = this, path, ...opts | ||
| }) { | ||
| return axios($, { | ||
| url: this._baseUrl() + path, | ||
| headers: this._headers(), | ||
| ...opts, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| listBuckets(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/buckets", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| getBucketDetails({ | ||
| bucketId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/buckets/${bucketId}`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| listTablesInBucket({ | ||
| bucketId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/buckets/${bucketId}/tables`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| getTableDetails({ | ||
| tableId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/tables/${tableId}`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| updateBucket({ | ||
| bucketId, displayName, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| method: "PUT", | ||
| path: `/buckets/${bucketId}`, | ||
| data: { | ||
| displayName, | ||
| }, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| updateTable({ | ||
| tableId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| method: "PUT", | ||
| path: `/tables/${tableId}`, | ||
| ...opts, | ||
| }); | ||
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,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/keboola", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Keboola Components", | ||
| "main": "keboola.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.1.0" | ||
| } | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.