-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] xata #13198 #13853
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
[Components] xata #13198 #13853
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d2cd1e6
Added actions
lcaresia 76cc37e
Added actions
lcaresia 7496f4c
Merge branch 'master' into issue-13198
lcaresia c66dc88
Update components/xata/actions/list-branches/list-branches.mjs
lcaresia b0182ce
Merge branch 'master' into issue-13198
lcaresia c6e3ef9
Requested changes done
lcaresia 9dddce1
Merge branch 'master' into issue-13198
lcaresia 48bdf93
updates
michelle0927 3de3ac1
Merge remote-tracking branch 'origin/master' into issue-13198
michelle0927 9c8d0de
pnpm-lock.yaml
michelle0927 e729dc7
format recordData
michelle0927 15187cb
updates
michelle0927 b78c20c
update
michelle0927 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
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,108 @@ | ||
import app from "../../xata.app.mjs"; | ||
|
||
export default { | ||
props: { | ||
app, | ||
endpoint: { | ||
propDefinition: [ | ||
app, | ||
"endpoint", | ||
], | ||
}, | ||
workspace: { | ||
propDefinition: [ | ||
app, | ||
"workspace", | ||
], | ||
}, | ||
database: { | ||
propDefinition: [ | ||
app, | ||
"database", | ||
(c) => ({ | ||
workspace: c.workspace, | ||
}), | ||
], | ||
}, | ||
branch: { | ||
propDefinition: [ | ||
app, | ||
"branch", | ||
(c) => ({ | ||
endpoint: c.endpoint, | ||
database: c.database, | ||
}), | ||
], | ||
}, | ||
table: { | ||
propDefinition: [ | ||
app, | ||
"table", | ||
(c) => ({ | ||
endpoint: c.endpoint, | ||
database: c.database, | ||
branch: c.branch, | ||
}), | ||
], | ||
reloadProps: true, | ||
}, | ||
}, | ||
async additionalProps(props) { | ||
const { | ||
endpoint, | ||
database, | ||
branch, | ||
table, | ||
} = this; | ||
|
||
const description = "The keys and values of the data that will be recorded in the database."; | ||
|
||
if (endpoint && database && branch && table) { | ||
const { columns } = await this.app.listColumns({ | ||
endpoint, | ||
database, | ||
branch, | ||
table, | ||
}); | ||
if (columns?.length) { | ||
let descriptionWithColumns = `${description} Available Columns:`; | ||
for (const column of columns) { | ||
descriptionWithColumns += ` \`${column.name}\``; | ||
} | ||
props.recordData.description = descriptionWithColumns; | ||
return {}; | ||
} | ||
} | ||
props.recordData.description = description; | ||
return {}; | ||
}, | ||
methods: { | ||
async formatRecordData() { | ||
const recordData = this.recordData; | ||
const { columns } = await this.app.listColumns({ | ||
endpoint: this.endpoint, | ||
database: this.database, | ||
branch: this.branch, | ||
table: this.table, | ||
}); | ||
if (!columns?.length) { | ||
return this.recordData; | ||
} | ||
for (const column of columns) { | ||
if (!recordData[column.name] || typeof recordData[column.name] !== "string") { | ||
continue; | ||
} | ||
if ((column.type === "int" || column.type === "float")) { | ||
recordData[column.name] = +recordData[column.name]; | ||
} | ||
if (column.type === "bool") { | ||
recordData[column.name] = !(recordData[column.name] === "false" || recordData[column.name === "0"]); | ||
} | ||
if (column.type === "multiple" || column.type === "vector") { | ||
recordData[column.name] = JSON.parse(recordData[column.name]); | ||
} | ||
} | ||
return recordData; | ||
}, | ||
}, | ||
}; |
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,31 @@ | ||
import common from "../common/common.mjs"; | ||
|
||
export default { | ||
...common, | ||
key: "xata-create-record", | ||
name: "Create Record", | ||
description: "Create a new Record in the specified database. [See the documentation](https://xata.io/docs/api-reference/db/db_branch_name/tables/table_name/data#insert-record)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
...common.props, | ||
recordData: { | ||
propDefinition: [ | ||
common.props.app, | ||
"recordData", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.createRecord({ | ||
$, | ||
endpoint: this.endpoint, | ||
database: this.database, | ||
branch: this.branch, | ||
table: this.table, | ||
data: await this.formatRecordData(), | ||
}); | ||
$.export("$summary", `Successfully created Record with ID: '${response.id}'`); | ||
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,42 @@ | ||
import app from "../../xata.app.mjs"; | ||
|
||
export default { | ||
key: "xata-list-branches", | ||
name: "List Branches", | ||
description: "List branches of the specified database. [See the documentation](https://xata.io/docs/api-reference/dbs/db_name#list-branches)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
app, | ||
endpoint: { | ||
propDefinition: [ | ||
app, | ||
"endpoint", | ||
], | ||
}, | ||
workspace: { | ||
propDefinition: [ | ||
app, | ||
"workspace", | ||
], | ||
}, | ||
database: { | ||
propDefinition: [ | ||
app, | ||
"database", | ||
(c) => ({ | ||
workspace: c.workspace, | ||
}), | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.listBranches({ | ||
$, | ||
endpoint: this.endpoint, | ||
database: this.database, | ||
}); | ||
$.export("$summary", `Successfully retrieved '${response.branches.length}' branches`); | ||
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,44 @@ | ||
import common from "../common/common.mjs"; | ||
|
||
export default { | ||
...common, | ||
key: "xata-replace-record", | ||
name: "Replace Record", | ||
description: "Replace a record with the specified ID. [See the documentation](https://xata.io/docs/api-reference/db/db_branch_name/tables/table_name/data/record_id#insert-record-with-id)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
...common.props, | ||
recordId: { | ||
propDefinition: [ | ||
common.props.app, | ||
"recordId", | ||
(c) => ({ | ||
endpoint: c.endpoint, | ||
database: c.database, | ||
table: c.table, | ||
branch: c.branch, | ||
}), | ||
], | ||
}, | ||
recordData: { | ||
propDefinition: [ | ||
common.props.app, | ||
"recordData", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.replaceRecord({ | ||
$, | ||
endpoint: this.endpoint, | ||
database: this.database, | ||
branch: this.branch, | ||
table: this.table, | ||
recordId: this.recordId, | ||
data: await this.formatRecordData(), | ||
}); | ||
$.export("$summary", `Successfully replaced Record with ID: '${response.id}'`); | ||
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,44 @@ | ||
import common from "../common/common.mjs"; | ||
|
||
export default { | ||
...common, | ||
key: "xata-update-record", | ||
name: "Update Record", | ||
description: "Update or create a record with the specified ID. [See the documentation](https://xata.io/docs/api-reference/db/db_branch_name/tables/table_name/data/record_id#upsert-record-with-id)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
...common.props, | ||
recordId: { | ||
propDefinition: [ | ||
common.props.app, | ||
"recordId", | ||
(c) => ({ | ||
endpoint: c.endpoint, | ||
database: c.database, | ||
table: c.table, | ||
branch: c.branch, | ||
}), | ||
], | ||
}, | ||
recordData: { | ||
propDefinition: [ | ||
common.props.app, | ||
"recordData", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.app.updateRecord({ | ||
$, | ||
endpoint: this.endpoint, | ||
database: this.database, | ||
branch: this.branch, | ||
table: this.table, | ||
recordId: this.recordId, | ||
data: await this.formatRecordData(), | ||
}); | ||
$.export("$summary", `Successfully updated/created Record with ID: '${response.id}'`); | ||
return response; | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
{ | ||
"name": "@pipedream/xata", | ||
"version": "0.0.2", | ||
"description": "Pipedream Xata Components", | ||
"main": "dist/app/xata.app.mjs", | ||
"version": "0.1.0", | ||
"description": "Pipedream xata Components", | ||
"main": "xata.app.mjs", | ||
lcaresia marked this conversation as resolved.
Show resolved
Hide resolved
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"keywords": [ | ||
"pipedream", | ||
"xata" | ||
], | ||
"files": ["dist"], | ||
"homepage": "https://pipedream.com/apps/xata", | ||
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^3.0.2" | ||
} | ||
} |
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.