@pipedream/supabase 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/batch-insert-rows/batch-insert-rows.mjs +12 -1
- package/actions/count-rows/count-rows.mjs +71 -0
- package/actions/delete-row/delete-row.mjs +6 -1
- package/actions/insert-row/insert-row.mjs +6 -1
- package/actions/remote-procedure-call/remote-procedure-call.mjs +6 -1
- package/actions/select-row/select-row.mjs +6 -1
- package/actions/update-row/update-row.mjs +6 -1
- package/actions/upsert-row/upsert-row.mjs +6 -1
- package/package.json +2 -2
- package/sources/new-row-added/new-row-added.mjs +1 -1
- package/sources/new-webhook-event/new-webhook-event.mjs +1 -1
- package/supabase.app.mjs +26 -0
|
@@ -6,7 +6,12 @@ export default {
|
|
|
6
6
|
key: "supabase-batch-insert-rows",
|
|
7
7
|
name: "Batch Insert Rows",
|
|
8
8
|
description: "Inserts new rows into a database. [See the documentation](https://supabase.com/docs/reference/javascript/insert)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.6",
|
|
10
|
+
annotations: {
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
openWorldHint: true,
|
|
13
|
+
readOnlyHint: false,
|
|
14
|
+
},
|
|
10
15
|
type: "action",
|
|
11
16
|
props: {
|
|
12
17
|
supabase,
|
|
@@ -27,6 +32,12 @@ export default {
|
|
|
27
32
|
],
|
|
28
33
|
reloadProps: true,
|
|
29
34
|
},
|
|
35
|
+
syncDir: {
|
|
36
|
+
type: "dir",
|
|
37
|
+
accessMode: "read",
|
|
38
|
+
sync: true,
|
|
39
|
+
optional: true,
|
|
40
|
+
},
|
|
30
41
|
},
|
|
31
42
|
async additionalProps() {
|
|
32
43
|
const props = {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import supabase from "../../supabase.app.mjs";
|
|
2
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "supabase-count-rows",
|
|
6
|
+
name: "Count Rows",
|
|
7
|
+
type: "action",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
},
|
|
14
|
+
description: "Counts rows in a database table, with optional filtering conditions. [See the docs here](https://supabase.com/docs/reference/javascript/select#querying-with-count-option)",
|
|
15
|
+
props: {
|
|
16
|
+
supabase,
|
|
17
|
+
table: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
supabase,
|
|
20
|
+
"table",
|
|
21
|
+
],
|
|
22
|
+
description: "Name of the table to count rows from",
|
|
23
|
+
},
|
|
24
|
+
column: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
supabase,
|
|
27
|
+
"column",
|
|
28
|
+
],
|
|
29
|
+
description: "Column name to filter by (optional)",
|
|
30
|
+
optional: true,
|
|
31
|
+
},
|
|
32
|
+
filter: {
|
|
33
|
+
propDefinition: [
|
|
34
|
+
supabase,
|
|
35
|
+
"filter",
|
|
36
|
+
],
|
|
37
|
+
description: "Filter type for the query (optional)",
|
|
38
|
+
optional: true,
|
|
39
|
+
},
|
|
40
|
+
value: {
|
|
41
|
+
propDefinition: [
|
|
42
|
+
supabase,
|
|
43
|
+
"value",
|
|
44
|
+
],
|
|
45
|
+
description: "Value to filter by (optional)",
|
|
46
|
+
optional: true,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
async run({ $ }) {
|
|
50
|
+
const {
|
|
51
|
+
table,
|
|
52
|
+
column,
|
|
53
|
+
filter,
|
|
54
|
+
value,
|
|
55
|
+
} = this;
|
|
56
|
+
|
|
57
|
+
if ((column || filter || value) && !(column && filter && value)) {
|
|
58
|
+
throw new ConfigurationError("If `column`, `filter`, or `value` is used, all three must be entered");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const response = await this.supabase.countRows({
|
|
62
|
+
table,
|
|
63
|
+
column,
|
|
64
|
+
filter,
|
|
65
|
+
value,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
$.export("$summary", `Successfully counted ${response.count} row(s) in table ${table}`);
|
|
69
|
+
return response;
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -4,7 +4,12 @@ export default {
|
|
|
4
4
|
key: "supabase-delete-row",
|
|
5
5
|
name: "Delete Row",
|
|
6
6
|
type: "action",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.5",
|
|
8
|
+
annotations: {
|
|
9
|
+
destructiveHint: true,
|
|
10
|
+
openWorldHint: true,
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
},
|
|
8
13
|
description: "Deletes row(s) in a database. [See the docs here](https://supabase.com/docs/reference/javascript/delete)",
|
|
9
14
|
props: {
|
|
10
15
|
supabase,
|
|
@@ -4,7 +4,12 @@ export default {
|
|
|
4
4
|
key: "supabase-insert-row",
|
|
5
5
|
name: "Insert Row",
|
|
6
6
|
type: "action",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.5",
|
|
8
|
+
annotations: {
|
|
9
|
+
destructiveHint: false,
|
|
10
|
+
openWorldHint: true,
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
},
|
|
8
13
|
description: "Inserts a new row into a database. [See the docs here](https://supabase.com/docs/reference/javascript/insert)",
|
|
9
14
|
props: {
|
|
10
15
|
supabase,
|
|
@@ -4,7 +4,12 @@ export default {
|
|
|
4
4
|
key: "supabase-remote-procedure-call",
|
|
5
5
|
name: "Remote Procedure Call",
|
|
6
6
|
type: "action",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.5",
|
|
8
|
+
annotations: {
|
|
9
|
+
destructiveHint: false,
|
|
10
|
+
openWorldHint: true,
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
},
|
|
8
13
|
description: "Call a Postgres function in a database. [See the docs here](https://supabase.com/docs/reference/javascript/rpc)",
|
|
9
14
|
props: {
|
|
10
15
|
supabase,
|
|
@@ -5,7 +5,12 @@ export default {
|
|
|
5
5
|
key: "supabase-select-row",
|
|
6
6
|
name: "Select Row",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.5",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: false,
|
|
13
|
+
},
|
|
9
14
|
description: "Selects row(s) in a database. [See the docs here](https://supabase.com/docs/reference/javascript/select)",
|
|
10
15
|
props: {
|
|
11
16
|
supabase,
|
|
@@ -4,7 +4,12 @@ export default {
|
|
|
4
4
|
key: "supabase-update-row",
|
|
5
5
|
name: "Update Row",
|
|
6
6
|
type: "action",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.5",
|
|
8
|
+
annotations: {
|
|
9
|
+
destructiveHint: true,
|
|
10
|
+
openWorldHint: true,
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
},
|
|
8
13
|
description: "Updates row(s) in a database. [See the docs here](https://supabase.com/docs/reference/javascript/update)",
|
|
9
14
|
props: {
|
|
10
15
|
supabase,
|
|
@@ -4,7 +4,12 @@ export default {
|
|
|
4
4
|
key: "supabase-upsert-row",
|
|
5
5
|
name: "Upsert Row",
|
|
6
6
|
type: "action",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.5",
|
|
8
|
+
annotations: {
|
|
9
|
+
destructiveHint: true,
|
|
10
|
+
openWorldHint: true,
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
},
|
|
8
13
|
description: "Updates a row in a database or inserts new row if not found. [See the docs here](https://supabase.com/docs/reference/javascript/upsert)",
|
|
9
14
|
props: {
|
|
10
15
|
supabase,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/supabase",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Pipedream Supabase Components",
|
|
5
5
|
"main": "supabase.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@pipedream/platform": "^3.1.
|
|
16
|
+
"@pipedream/platform": "^3.1.1",
|
|
17
17
|
"@supabase/supabase-js": "^2.45.6",
|
|
18
18
|
"csv-parse": "^5.5.6"
|
|
19
19
|
}
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
key: "supabase-new-row-added",
|
|
10
10
|
name: "New Row Added",
|
|
11
11
|
description: "Emit new event for every new row added in a table. [See documentation here](https://supabase.com/docs/reference/javascript/select)",
|
|
12
|
-
version: "0.0.
|
|
12
|
+
version: "0.0.6",
|
|
13
13
|
type: "source",
|
|
14
14
|
props: {
|
|
15
15
|
...base.props,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "supabase-new-webhook-event",
|
|
6
6
|
name: "New Webhook Event (Instant)",
|
|
7
7
|
description: "Emit new event for every `insert`, `update`, or `delete` operation in a table. This source requires user configuration using the Supabase website. More information in the README. [Also see documentation here](https://supabase.com/docs/guides/database/webhooks#creating-a-webhook)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.7",
|
|
9
9
|
type: "source",
|
|
10
10
|
props: {
|
|
11
11
|
...base.props,
|
package/supabase.app.mjs
CHANGED
|
@@ -182,5 +182,31 @@ export default {
|
|
|
182
182
|
this.verifyForErrors(resp);
|
|
183
183
|
return resp;
|
|
184
184
|
},
|
|
185
|
+
async countRows(args) {
|
|
186
|
+
const client = await this._client();
|
|
187
|
+
const {
|
|
188
|
+
table,
|
|
189
|
+
column,
|
|
190
|
+
filter,
|
|
191
|
+
value,
|
|
192
|
+
} = args;
|
|
193
|
+
const ctx = this;
|
|
194
|
+
const resp = await this.retryWithExponentialBackoff(async () => {
|
|
195
|
+
let query = client
|
|
196
|
+
.from(table)
|
|
197
|
+
.select("*", {
|
|
198
|
+
count: "exact",
|
|
199
|
+
head: true,
|
|
200
|
+
});
|
|
201
|
+
if (filter) {
|
|
202
|
+
query = ctx[filter](query, column, value);
|
|
203
|
+
}
|
|
204
|
+
return await query;
|
|
205
|
+
});
|
|
206
|
+
return {
|
|
207
|
+
count: resp.count,
|
|
208
|
+
error: resp.error,
|
|
209
|
+
};
|
|
210
|
+
},
|
|
185
211
|
},
|
|
186
212
|
};
|