Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`);

return response;
},
};
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;
},
};
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;
},
};
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",
"keywords": [
"pipedream",
"xata"
],
"files": ["dist"],
"homepage": "https://pipedream.com/apps/xata",
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
Expand Down
Loading