@legendapp/state 3.0.0-alpha.24 → 3.0.0-alpha.25
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/package.json +1 -1
- package/sync-plugins/supabase.js +13 -5
- package/sync-plugins/supabase.mjs +13 -5
package/package.json
CHANGED
package/sync-plugins/supabase.js
CHANGED
|
@@ -59,8 +59,8 @@ function syncedSupabase(props) {
|
|
|
59
59
|
}
|
|
60
60
|
return data || [];
|
|
61
61
|
} : void 0;
|
|
62
|
-
const
|
|
63
|
-
const res = await client.from(collection).
|
|
62
|
+
const create = !actions || actions.includes("create") ? async (input) => {
|
|
63
|
+
const res = await client.from(collection).insert(input).select();
|
|
64
64
|
const { data, error } = res;
|
|
65
65
|
if (data) {
|
|
66
66
|
const created = data[0];
|
|
@@ -68,9 +68,17 @@ function syncedSupabase(props) {
|
|
|
68
68
|
} else {
|
|
69
69
|
throw new Error(error == null ? void 0 : error.message);
|
|
70
70
|
}
|
|
71
|
-
};
|
|
72
|
-
const
|
|
73
|
-
|
|
71
|
+
} : void 0;
|
|
72
|
+
const update = !actions || actions.includes("update") ? async (input) => {
|
|
73
|
+
const res = await client.from(collection).update(input).eq("id", input.id).select();
|
|
74
|
+
const { data, error } = res;
|
|
75
|
+
if (data) {
|
|
76
|
+
const created = data[0];
|
|
77
|
+
return created;
|
|
78
|
+
} else {
|
|
79
|
+
throw new Error(error == null ? void 0 : error.message);
|
|
80
|
+
}
|
|
81
|
+
} : void 0;
|
|
74
82
|
const deleteFn = !fieldDeleted && (!actions || actions.includes("delete")) ? async (input) => {
|
|
75
83
|
const id = input.id;
|
|
76
84
|
const res = await client.from(collection).delete().eq("id", id).select();
|
|
@@ -57,8 +57,8 @@ function syncedSupabase(props) {
|
|
|
57
57
|
}
|
|
58
58
|
return data || [];
|
|
59
59
|
} : void 0;
|
|
60
|
-
const
|
|
61
|
-
const res = await client.from(collection).
|
|
60
|
+
const create = !actions || actions.includes("create") ? async (input) => {
|
|
61
|
+
const res = await client.from(collection).insert(input).select();
|
|
62
62
|
const { data, error } = res;
|
|
63
63
|
if (data) {
|
|
64
64
|
const created = data[0];
|
|
@@ -66,9 +66,17 @@ function syncedSupabase(props) {
|
|
|
66
66
|
} else {
|
|
67
67
|
throw new Error(error == null ? void 0 : error.message);
|
|
68
68
|
}
|
|
69
|
-
};
|
|
70
|
-
const
|
|
71
|
-
|
|
69
|
+
} : void 0;
|
|
70
|
+
const update = !actions || actions.includes("update") ? async (input) => {
|
|
71
|
+
const res = await client.from(collection).update(input).eq("id", input.id).select();
|
|
72
|
+
const { data, error } = res;
|
|
73
|
+
if (data) {
|
|
74
|
+
const created = data[0];
|
|
75
|
+
return created;
|
|
76
|
+
} else {
|
|
77
|
+
throw new Error(error == null ? void 0 : error.message);
|
|
78
|
+
}
|
|
79
|
+
} : void 0;
|
|
72
80
|
const deleteFn = !fieldDeleted && (!actions || actions.includes("delete")) ? async (input) => {
|
|
73
81
|
const id = input.id;
|
|
74
82
|
const res = await client.from(collection).delete().eq("id", id).select();
|