Skip to content

Commit 1ea52a8

Browse files
authored
Nile Database - updates per their team (#14342)
* updates * versions
1 parent 82c3227 commit 1ea52a8

File tree

7 files changed

+44
-8
lines changed

7 files changed

+44
-8
lines changed

components/nile_database/actions/create-user/create-user.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "nile_database-create-user",
55
name: "Create User",
66
description: "Create a new database user by providing an email address and password. [See the documentation](https://www.thenile.dev/docs/reference/api-reference/users/create-user)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
nile,
@@ -18,6 +18,9 @@ export default {
1818
propDefinition: [
1919
nile,
2020
"database",
21+
(c) => ({
22+
workspace: c.workspace,
23+
}),
2124
],
2225
},
2326
email: {

components/nile_database/actions/execute-query/execute-query.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
name: "Execute Query",
55
key: "nile_database-execute-query",
66
description: "Execute a custom PostgreSQL query.",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
nile,
@@ -18,6 +18,9 @@ export default {
1818
propDefinition: [
1919
nile,
2020
"database",
21+
(c) => ({
22+
workspace: c.workspace,
23+
}),
2124
],
2225
},
2326
user: {

components/nile_database/nile_database.app.mjs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ export default {
1818
type: "string",
1919
label: "Database",
2020
description: "The database name",
21-
async options() {
22-
const { databases } = await this.getAuthenticatedUser();
21+
async options({ workspace }) {
22+
if (!workspace) {
23+
return [];
24+
}
25+
const databases = await this.listDatabases({
26+
workspace,
27+
});
2328
return databases?.map(({ name }) => name) || [];
2429
},
2530
},
@@ -68,6 +73,14 @@ export default {
6873
...opts,
6974
});
7075
},
76+
listDatabases({
77+
workspace, ...opts
78+
}) {
79+
return this._makeRequest({
80+
url: `${this._globalBaseUrl()}/workspaces/${workspace}/databases`,
81+
...opts,
82+
});
83+
},
7184
getAuthenticatedUser(opts = {}) {
7285
return this._makeRequest({
7386
url: `${this._globalBaseUrl()}/developers/me/full`,

components/nile_database/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/nile_database",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Pipedream Nile Database Components",
55
"main": "nile_database.app.mjs",
66
"keywords": [

components/nile_database/sources/common/base.mjs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import nile from "../../nile_database.app.mjs";
2-
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
2+
import {
3+
DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, ConfigurationError,
4+
} from "@pipedream/platform";
35

46
export default {
57
props: {
@@ -21,9 +23,24 @@ export default {
2123
propDefinition: [
2224
nile,
2325
"database",
26+
(c) => ({
27+
workspace: c.workspace,
28+
}),
2429
],
2530
},
2631
},
32+
hooks: {
33+
async deploy() {
34+
try {
35+
await this.nile.getDatabase({
36+
workspace: this.workspace,
37+
database: this.database,
38+
});
39+
} catch {
40+
throw new ConfigurationError(`Database "${this.database}" with workspace "${this.workspace}" not found`);
41+
}
42+
},
43+
},
2744
methods: {
2845
getResourceFn() {
2946
throw new Error("getResourceFn is not implemented");

components/nile_database/sources/new-tenant-created/new-tenant-created.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "nile_database-new-tenant-created",
66
name: "New Tenant Created",
77
description: "Emit new event when a new tenant is added to a Nile Database",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "source",
1010
dedupe: "unique",
1111
methods: {

components/nile_database/sources/new-user-created/new-user-created.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "nile_database-new-user-created",
66
name: "New User Created",
77
description: "Emit new event when a new user is added in a Nile Database",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "source",
1010
dedupe: "unique",
1111
methods: {

0 commit comments

Comments
 (0)