@pipedream/supabase 0.3.0 → 0.3.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.
@@ -6,7 +6,7 @@ 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.1",
9
+ version: "0.0.2",
10
10
  type: "action",
11
11
  props: {
12
12
  supabase,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "supabase-delete-row",
5
5
  name: "Delete Row",
6
6
  type: "action",
7
- version: "0.1.2",
7
+ version: "0.1.3",
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,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "supabase-insert-row",
5
5
  name: "Insert Row",
6
6
  type: "action",
7
- version: "0.1.2",
7
+ version: "0.1.3",
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,
@@ -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.1.2",
7
+ version: "0.1.3",
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,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "supabase-select-row",
6
6
  name: "Select Row",
7
7
  type: "action",
8
- version: "0.1.2",
8
+ version: "0.1.3",
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,7 +81,7 @@ export default {
81
81
  sortOrder,
82
82
  max,
83
83
  });
84
- $.export("$summary", `Successfully retrieved ${response.length} rows from table ${table}`);
84
+ $.export("$summary", `Successfully retrieved ${response.data?.length || 0} row(s) from table ${table}`);
85
85
  return response;
86
86
  },
87
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.1.2",
7
+ version: "0.1.3",
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,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "supabase-upsert-row",
5
5
  name: "Upsert Row",
6
6
  type: "action",
7
- version: "0.1.2",
7
+ version: "0.1.3",
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/supabase",
3
- "version": "0.3.0",
3
+ "version": "0.3.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.4",
12
+ version: "0.0.5",
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.5",
8
+ version: "0.0.6",
9
9
  type: "source",
10
10
  props: {
11
11
  ...base.props,
package/supabase.app.mjs CHANGED
@@ -52,6 +52,30 @@ export default {
52
52
  async _client() {
53
53
  return createClient(`https://${this.$auth.subdomain}.supabase.co`, this.$auth.service_key);
54
54
  },
55
+ retryWithExponentialBackoff(func, maxAttempts = 3, baseDelayS = 2) {
56
+ let attempt = 0;
57
+ const verifyForErrors = this.verifyForErrors;
58
+
59
+ const execute = async () => {
60
+ try {
61
+ const resp = await func();
62
+ verifyForErrors(resp);
63
+ return resp;
64
+ } catch (error) {
65
+ if (attempt === maxAttempts - 1) {
66
+ throw error;
67
+ }
68
+
69
+ const delayMs = Math.pow(baseDelayS, attempt) * 1000;
70
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
71
+
72
+ attempt++;
73
+ return execute();
74
+ }
75
+ };
76
+
77
+ return execute();
78
+ },
55
79
  async selectRow(args) {
56
80
  const client = await this._client();
57
81
  const {
@@ -63,13 +87,14 @@ export default {
63
87
  ascending = args.sortOrder === "ascending",
64
88
  max,
65
89
  } = args;
66
- const query = this.baseFilter(client, table, orderBy, ascending, max);
67
- if (filter) {
68
- const filterMethod = this[filter];
69
- filterMethod(query, column, value);
70
- }
71
- const resp = await query;
72
- this.verifyForErrors(resp);
90
+ const ctx = this;
91
+ const resp = await this.retryWithExponentialBackoff(async () => {
92
+ let query = ctx.baseFilter(client, table, orderBy, ascending, max);
93
+ if (filter) {
94
+ query = ctx[filter](query, column, value);
95
+ }
96
+ return await query;
97
+ });
73
98
  return resp;
74
99
  },
75
100
  baseFilter(client, table, orderBy, ascending, max) {