Skip to content

Commit c6e3ef9

Browse files
committed
Requested changes done
1 parent b0182ce commit c6e3ef9

File tree

7 files changed

+53
-10
lines changed

7 files changed

+53
-10
lines changed

components/xata/actions/create-record/create-record.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ export default {
6161
table: this.table,
6262
data: this.recordData,
6363
});
64-
6564
$.export("$summary", `Successfully created Record with ID: '${response.id}'`);
66-
6765
return response;
6866
},
6967
};

components/xata/actions/list-branches/list-branches.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ export default {
3636
endpoint: this.endpoint,
3737
database: this.database,
3838
});
39-
4039
$.export("$summary", `Successfully retrieved '${response.branches.length}' branches`);
41-
42-
4340
return response;
4441
},
4542
};

components/xata/actions/replace-record/replace-record.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ export default {
4949
propDefinition: [
5050
app,
5151
"recordId",
52+
(c) => ({
53+
endpoint: c.endpoint,
54+
database: c.database,
55+
table: c.table,
56+
branch: c.branch,
57+
}),
5258
],
5359
},
5460
recordData: {
@@ -68,9 +74,7 @@ export default {
6874
recordId: this.recordId,
6975
data: this.recordData,
7076
});
71-
7277
$.export("$summary", `Successfully replaced Record with ID: '${response.id}'`);
73-
7478
return response;
7579
},
7680
};

components/xata/actions/update-record/update-record.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ export default {
4949
propDefinition: [
5050
app,
5151
"recordId",
52+
(c) => ({
53+
endpoint: c.endpoint,
54+
database: c.database,
55+
table: c.table,
56+
branch: c.branch,
57+
}),
5258
],
5359
},
5460
recordData: {
@@ -68,9 +74,7 @@ export default {
6874
recordId: this.recordId,
6975
data: this.recordData,
7076
});
71-
7277
$.export("$summary", `Successfully updated/created Record with ID: '${response.id}'`);
73-
7478
return response;
7579
},
7680
};

components/xata/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.2"
1417
}
1518
}

components/xata/xata.app.mjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ export default {
88
type: "string",
99
label: "Record ID",
1010
description: "ID of the record to create or update",
11+
async options({
12+
endpoint, database, branch, table,
13+
}) {
14+
const response = await this.listRecords({
15+
endpoint,
16+
database,
17+
branch,
18+
table,
19+
});
20+
const recordIds = response.records;
21+
return recordIds.map(({ id }) => ({
22+
value: id,
23+
}));
24+
},
1125
},
1226
table: {
1327
type: "string",
@@ -122,6 +136,15 @@ export default {
122136
...args,
123137
});
124138
},
139+
async listRecords({
140+
endpoint, database, branch, table, ...args
141+
}) {
142+
return this._makeRequest({
143+
method: "post",
144+
url: `${endpoint}/db/${database}:${branch}/tables/${table}/query`,
145+
...args,
146+
});
147+
},
125148
async listWorkspaces(args = {}) {
126149
return this._makeRequest({
127150
path: "/workspaces",

pnpm-lock.yaml

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)