-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
413 additions
and
3 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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,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; | ||
}, | ||
}; |
This file contains 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 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; | ||
}, | ||
}; |
This file contains 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,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; | ||
}, | ||
}; |
This file contains 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,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; | ||
}, | ||
}; |
Oops, something went wrong.