Skip to content
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

[Components] xata #13198 #13853

Merged
merged 13 commits into from
Oct 11, 2024
3 changes: 0 additions & 3 deletions components/xata/.gitignore

This file was deleted.

69 changes: 69 additions & 0 deletions components/xata/actions/create-record/create-record.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import app from "../../xata.app.mjs";

export default {
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: {
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",
],
},
recordData: {
propDefinition: [
app,
"recordData",
],
},
},
async run({ $ }) {
const response = await this.app.createRecord({
$,
endpoint: this.endpoint,
database: this.database,
branch: this.branch,
table: this.table,
data: this.recordData,
});

$.export("$summary", `Successfully created Record with ID: '${response.id}'`);

return response;
},
};
44 changes: 44 additions & 0 deletions components/xata/actions/list-branches/list-branches.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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.branchse.length}' branches`);
lcaresia marked this conversation as resolved.
Show resolved Hide resolved

return response;
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
};
76 changes: 76 additions & 0 deletions components/xata/actions/replace-record/replace-record.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import app from "../../xata.app.mjs";

export default {
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: {
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",
],
},
recordId: {
propDefinition: [
app,
"recordId",
],
},
recordData: {
propDefinition: [
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: this.recordData,
});

$.export("$summary", `Successfully replaced Record with ID: '${response.id}'`);

return response;
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
};
76 changes: 76 additions & 0 deletions components/xata/actions/update-record/update-record.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import app from "../../xata.app.mjs";

export default {
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: {
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",
],
},
recordId: {
propDefinition: [
app,
"recordId",
],
},
recordData: {
propDefinition: [
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: this.recordData,
});

$.export("$summary", `Successfully updated/created Record with ID: '${response.id}'`);

return response;
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
};
13 changes: 0 additions & 13 deletions components/xata/app/xata.app.ts

This file was deleted.

7 changes: 3 additions & 4 deletions components/xata/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"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": {
Expand Down
Loading
Loading