Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 1 addition & 1 deletion components/algodocs/algodocs.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/allocadence/allocadence.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/ical/ical.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/nioleads/nioleads.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/virifi/virifi.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
3 changes: 0 additions & 3 deletions components/xata/.gitignore

This file was deleted.

79 changes: 79 additions & 0 deletions components/xata/actions/common/common.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
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",
],
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) {
try {
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 {};
}
} catch (e) {
props.recordData.description = description;
// Columns not found. Occurs when the user hasn't finished entering the table name
}
}
props.recordData.description = description;
return {};
},
};
31 changes: 31 additions & 0 deletions components/xata/actions/create-record/create-record.mjs
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: this.recordData,
});
$.export("$summary", `Successfully created Record with ID: '${response.id}'`);
return response;
},
};
42 changes: 42 additions & 0 deletions components/xata/actions/list-branches/list-branches.mjs
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;
},
};
44 changes: 44 additions & 0 deletions components/xata/actions/replace-record/replace-record.mjs
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: this.recordData,
});
$.export("$summary", `Successfully replaced Record with ID: '${response.id}'`);
return response;
},
};
44 changes: 44 additions & 0 deletions components/xata/actions/update-record/update-record.mjs
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: 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.

10 changes: 6 additions & 4 deletions components/xata/package.json
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",
"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"
}
}
Loading
Loading