@iebh/tera-fy 2.0.12 → 2.0.14
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/CHANGELOG.md +14 -0
- package/lib/syncro/entities.js +20 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.14](https://github.com/IEBH/TERA-fy/compare/v2.0.13...v2.0.14) (2025-03-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### fix
|
|
7
|
+
|
|
8
|
+
* Missing ID when creating blank user ([574aaa4](https://github.com/IEBH/TERA-fy/commit/574aaa4204b02b90405a83e99086b82fdfce8f3d))
|
|
9
|
+
|
|
10
|
+
## [2.0.13](https://github.com/IEBH/TERA-fy/compare/v2.0.12...v2.0.13) (2025-03-16)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### fix
|
|
14
|
+
|
|
15
|
+
* Create user via Syncro row if it doesnt already exist ([5a9dfe2](https://github.com/IEBH/TERA-fy/commit/5a9dfe286d16f4bcddcfd0870db0d194342ba4ab))
|
|
16
|
+
|
|
3
17
|
## [2.0.12](https://github.com/IEBH/TERA-fy/compare/v2.0.11...v2.0.12) (2025-03-12)
|
|
4
18
|
|
|
5
19
|
## [2.0.11](https://github.com/IEBH/TERA-fy/compare/v2.0.9...v2.0.11) (2025-03-10)
|
package/lib/syncro/entities.js
CHANGED
|
@@ -185,10 +185,28 @@ export default {
|
|
|
185
185
|
return Syncro.wrapSupabase(supabase.from('users')
|
|
186
186
|
.select('data')
|
|
187
187
|
.limit(1)
|
|
188
|
+
.maybeSingle()
|
|
188
189
|
.eq('id', id)
|
|
189
190
|
)
|
|
190
|
-
.then(
|
|
191
|
-
|
|
191
|
+
.then(user => {
|
|
192
|
+
if (user) return user.data; // User is valid and already exists
|
|
193
|
+
|
|
194
|
+
// User row doesn't already exist - need to create stub
|
|
195
|
+
return Syncro.wrapSupabase(supabase.from('users')
|
|
196
|
+
.insert({
|
|
197
|
+
id,
|
|
198
|
+
data: {
|
|
199
|
+
id,
|
|
200
|
+
data: { // Create user prototype data
|
|
201
|
+
id,
|
|
202
|
+
credits: 1000,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
})
|
|
206
|
+
.select('data')
|
|
207
|
+
)
|
|
208
|
+
.then(newUser => newUser.data) // Return back the data that eventually got created - allowing for database triggers, default field values etc.
|
|
209
|
+
})
|
|
192
210
|
},
|
|
193
211
|
flushState({supabase, state, fsId}) {
|
|
194
212
|
return Syncro.wrapSupabase(supabase.rpc('syncro_merge_data', {
|
package/package.json
CHANGED