@pipedream/supabase 0.1.3 → 0.2.1

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/README.md CHANGED
@@ -1,26 +1,8 @@
1
1
  # Overview
2
2
 
3
- Supabase is an open-source database, authentication system, and hosting
4
- platform that allows you to quickly and easily build powerful web-based
5
- applications. Supabase’s API provides developers with the ability to quickly
6
- create, manage, and control data on their projects.
7
-
8
- When combined with other libraries, such as React or Redux, developers can
9
- create fast, secure, and reliable websites. With Supabase’s API, developers can
10
- connect, query, and manage data on their web projects via a simple and
11
- intuitive interface.
12
-
13
- Here is a list of some of the things you can build using the Supabase API:
14
-
15
- - Professional websites with custom content management
16
- - Node.js applications that read and write data to the database
17
- - GraphQL APIs for connecting front-end applications to the backend
18
- - Cloud-based Single-page applications
19
- - Web-based applications with authentication and security features
20
- - Mobile apps with real-time synchronization to the cloud database
21
- - IoT applications with remote control capabilities
22
- - Machine learning applications that use predictive analytics
3
+ Supabase is a real-time backend-as-a-service that provides developers with a suite of tools to quickly build and scale their applications. It offers database storage, authentication, instant APIs, and real-time subscriptions. With the Supabase API, you can perform CRUD operations on your database, manage users, and listen to database changes in real time. When integrated with Pipedream, you can automate workflows that react to these database events, synchronize data across multiple services, or streamline user management processes.
23
4
 
5
+ # Getting Started
24
6
  ## Webhooks
25
7
 
26
8
  Supabase provides support for Database Webhooks, and you can easily configure them through the Supabase website by following these simple steps:
@@ -32,3 +14,11 @@ Supabase provides support for Database Webhooks, and you can easily configure th
32
14
  5. In the `HTTP Request` section, select the `POST` method and paste the URL generated by the Pipedream source.
33
15
 
34
16
  That's it! You will now receive notifications in your trigger whenever an event occurs.
17
+
18
+ # Example Use Cases
19
+
20
+ - **Sync Supabase Data to Google Sheets**: Automatically update a Google Sheet with new data from a Supabase database. Whenever a new row is added to a specified Supabase table, a Pipedream workflow is triggered, appending the data to a Google Sheet. This can be useful for non-technical stakeholders needing real-time visibility into the database without direct access.
21
+
22
+ - **User Signup Email Confirmation**: Send a welcome email to new users who sign up via your Supabase-powered app. Utilize Pipedream to listen for new signups in Supabase, and then trigger an email through an email service provider like SendGrid. This helps in engaging users from the moment they create an account.
23
+
24
+ - **Aggregate Logs and Monitor Events**: Collect logs from your Supabase application and send them to a logging platform like Datadog. Monitor events in your Supabase database, such as updates or deletes, and forward these events from Pipedream to Datadog for real-time monitoring and analysis. This workflow is key for maintaining oversight and security within your application.
@@ -4,7 +4,7 @@ export default {
4
4
  key: "supabase-delete-row",
5
5
  name: "Delete Row",
6
6
  type: "action",
7
- version: "0.0.3",
7
+ version: "0.1.1",
8
8
  description: "Deletes row(s) in a database. [See the docs here](https://supabase.com/docs/reference/javascript/delete)",
9
9
  props: {
10
10
  supabase,
@@ -32,9 +32,7 @@ export default {
32
32
  },
33
33
  async run({ $ }) {
34
34
  const response = await this.supabase.deleteRow(this.table, this.column, this.value);
35
- if (response) {
36
- $.export("$summary", `Successfully deleted ${response.length} row(s) from table ${this.table}`);
37
- }
35
+ $.export("$summary", `Successfully deleted ${response.length} row(s) from table ${this.table}`);
38
36
  return response;
39
37
  },
40
38
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "supabase-insert-row",
5
5
  name: "Insert Row",
6
6
  type: "action",
7
- version: "0.0.3",
7
+ version: "0.1.1",
8
8
  description: "Inserts a new row into a database. [See the docs here](https://supabase.com/docs/reference/javascript/insert)",
9
9
  props: {
10
10
  supabase,
@@ -24,9 +24,7 @@ export default {
24
24
  },
25
25
  async run({ $ }) {
26
26
  const response = await this.supabase.insertRow(this.table, this.data);
27
- if (response) {
28
- $.export("$summary", `Successfully inserted row into table ${this.table}`);
29
- }
27
+ $.export("$summary", `Successfully inserted row into table ${this.table}`);
30
28
  return response;
31
29
  },
32
30
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "supabase-remote-procedure-call",
5
5
  name: "Remote Procedure Call",
6
6
  type: "action",
7
- version: "0.0.3",
7
+ version: "0.1.1",
8
8
  description: "Call a Postgres function in a database. [See the docs here](https://supabase.com/docs/reference/javascript/rpc)",
9
9
  props: {
10
10
  supabase,
@@ -22,9 +22,7 @@ export default {
22
22
  },
23
23
  async run({ $ }) {
24
24
  const response = await this.supabase.remoteProcedureCall(this.functionName, this.args);
25
- if (response) {
26
- $.export("$summary", `Successfully executed remote procedure call ${this.functionName}`);
27
- }
25
+ $.export("$summary", `Successfully executed remote procedure call ${this.functionName}`);
28
26
  return response;
29
27
  },
30
28
  };
@@ -5,7 +5,7 @@ export default {
5
5
  key: "supabase-select-row",
6
6
  name: "Select Row",
7
7
  type: "action",
8
- version: "0.0.5",
8
+ version: "0.1.1",
9
9
  description: "Selects row(s) in a database. [See the docs here](https://supabase.com/docs/reference/javascript/select)",
10
10
  props: {
11
11
  supabase,
@@ -81,9 +81,7 @@ export default {
81
81
  sortOrder,
82
82
  max,
83
83
  });
84
- if (response) {
85
- $.export("$summary", `Successfully retrieved ${response.length} rows from table ${table}`);
86
- }
84
+ $.export("$summary", `Successfully retrieved ${response.length} rows from table ${table}`);
87
85
  return response;
88
86
  },
89
87
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "supabase-update-row",
5
5
  name: "Update Row",
6
6
  type: "action",
7
- version: "0.0.3",
7
+ version: "0.1.1",
8
8
  description: "Updates row(s) in a database. [See the docs here](https://supabase.com/docs/reference/javascript/update)",
9
9
  props: {
10
10
  supabase,
@@ -39,9 +39,7 @@ export default {
39
39
  },
40
40
  async run({ $ }) {
41
41
  const response = await this.supabase.updateRow(this.table, this.column, this.value, this.data);
42
- if (response) {
43
- $.export("$summary", `Successfully updated ${response.length} row(s) from table ${this.table}`);
44
- }
42
+ $.export("$summary", `Successfully updated ${response.length} row(s) from table ${this.table}`);
45
43
  return response;
46
44
  },
47
45
  };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "supabase-upsert-row",
5
5
  name: "Upsert Row",
6
6
  type: "action",
7
- version: "0.0.3",
7
+ version: "0.1.1",
8
8
  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
9
  props: {
10
10
  supabase,
@@ -24,9 +24,7 @@ export default {
24
24
  },
25
25
  async run({ $ }) {
26
26
  const response = await this.supabase.upsertRow(this.table, this.data);
27
- if (response) {
28
- $.export("$summary", `Successfully upserted row into table ${this.table}`);
29
- }
27
+ $.export("$summary", `Successfully upserted row into table ${this.table}`);
30
28
  return response;
31
29
  },
32
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/supabase",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "Pipedream Supabase Components",
5
5
  "main": "supabase.app.mjs",
6
6
  "keywords": [
@@ -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.1",
12
+ version: "0.0.3",
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.2",
8
+ version: "0.0.4",
9
9
  type: "source",
10
10
  props: {
11
11
  ...base.props,
package/supabase.app.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createClient } from "@supabase/supabase-js@2.39.0";
1
+ import { createClient } from "@supabase/supabase-js@2.39.8";
2
2
  import constants from "./common/constants.mjs";
3
3
 
4
4
  export default {
@@ -44,6 +44,11 @@ export default {
44
44
  },
45
45
  },
46
46
  methods: {
47
+ verifyForErrors(resp) {
48
+ if (resp.error) {
49
+ throw new Error(JSON.stringify(resp, null, 2));
50
+ }
51
+ },
47
52
  async _client() {
48
53
  return createClient(`https://${this.$auth.subdomain}.supabase.co`, this.$auth.service_key);
49
54
  },
@@ -64,11 +69,8 @@ export default {
64
69
  filterMethod(query, column, value);
65
70
  }
66
71
  const resp = await query;
67
- if (resp.error) {
68
- throw new Error(JSON.stringify(resp.error, null, 2));
69
- }
70
- console.log("resp: ", resp);
71
- return resp.data;
72
+ this.verifyForErrors(resp);
73
+ return resp;
72
74
  },
73
75
  baseFilter(client, table, orderBy, ascending, max) {
74
76
  return client
@@ -113,42 +115,47 @@ export default {
113
115
  },
114
116
  async insertRow(table, rowData = {}) {
115
117
  const client = await this._client();
116
- const { data } = await client
118
+ const resp = await client
117
119
  .from(table)
118
120
  .insert(rowData)
119
121
  .select();
120
- return data;
122
+ this.verifyForErrors(resp);
123
+ return resp;
121
124
  },
122
125
  async updateRow(table, column, value, rowData = {}) {
123
126
  const client = await this._client();
124
- const { data } = await client
127
+ const resp = await client
125
128
  .from(table)
126
129
  .update(rowData)
127
130
  .eq(column, value)
128
131
  .select();
129
- return data;
132
+ this.verifyForErrors(resp);
133
+ return resp;
130
134
  },
131
135
  async upsertRow(table, rowData = {}) {
132
136
  const client = await this._client();
133
- const { data } = await client
137
+ const resp = await client
134
138
  .from(table)
135
139
  .upsert(rowData)
136
140
  .select();
137
- return data;
141
+ this.verifyForErrors(resp);
142
+ return resp;
138
143
  },
139
144
  async deleteRow(table, column, value) {
140
145
  const client = await this._client();
141
- const { data } = await client
146
+ const resp = await client
142
147
  .from(table)
143
148
  .delete()
144
149
  .eq(column, value)
145
150
  .select();
146
- return data;
151
+ this.verifyForErrors(resp);
152
+ return resp;
147
153
  },
148
154
  async remoteProcedureCall(functionName, args = {}) {
149
155
  const client = await this._client();
150
- const { data } = await client.rpc(functionName, args);
151
- return data;
156
+ const resp = await client.rpc(functionName, args);
157
+ this.verifyForErrors(resp);
158
+ return resp;
152
159
  },
153
160
  },
154
161
  };