@iebh/tera-fy 2.0.11 → 2.0.13
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 +9 -0
- package/lib/syncro/entities.js +19 -2
- package/lib/terafy.server.js +16 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.13](https://github.com/IEBH/TERA-fy/compare/v2.0.12...v2.0.13) (2025-03-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### fix
|
|
7
|
+
|
|
8
|
+
* Create user via Syncro row if it doesnt already exist ([5a9dfe2](https://github.com/IEBH/TERA-fy/commit/5a9dfe286d16f4bcddcfd0870db0d194342ba4ab))
|
|
9
|
+
|
|
10
|
+
## [2.0.12](https://github.com/IEBH/TERA-fy/compare/v2.0.11...v2.0.12) (2025-03-12)
|
|
11
|
+
|
|
3
12
|
## [2.0.11](https://github.com/IEBH/TERA-fy/compare/v2.0.9...v2.0.11) (2025-03-10)
|
|
4
13
|
|
|
5
14
|
|
package/lib/syncro/entities.js
CHANGED
|
@@ -185,10 +185,27 @@ 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
|
+
data: {
|
|
198
|
+
id,
|
|
199
|
+
data: { // Create user prototype data
|
|
200
|
+
id,
|
|
201
|
+
credits: 1000,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
})
|
|
205
|
+
.select('data')
|
|
206
|
+
)
|
|
207
|
+
.then(newUser => newUser.data) // Return back the data that eventually got created - allowing for database triggers, default field values etc.
|
|
208
|
+
})
|
|
192
209
|
},
|
|
193
210
|
flushState({supabase, state, fsId}) {
|
|
194
211
|
return Syncro.wrapSupabase(supabase.rpc('syncro_merge_data', {
|
package/lib/terafy.server.js
CHANGED
|
@@ -1570,8 +1570,8 @@ export default class TeraFyServer {
|
|
|
1570
1570
|
uiProgress(options) {
|
|
1571
1571
|
if (options === false) options = {close: true}; // Shorthand to close existing ui progress window
|
|
1572
1572
|
|
|
1573
|
-
if (this.
|
|
1574
|
-
this.
|
|
1573
|
+
if (!options?.close && this._uiProgress.options === null) { // Create new uiProgress options object
|
|
1574
|
+
this._uiProgress.options = reactive({
|
|
1575
1575
|
body: '',
|
|
1576
1576
|
bodyHtml: false,
|
|
1577
1577
|
title: 'TERA',
|
|
@@ -1581,23 +1581,23 @@ export default class TeraFyServer {
|
|
|
1581
1581
|
...options,
|
|
1582
1582
|
});
|
|
1583
1583
|
} else { // Merge options with existing uiProgress window
|
|
1584
|
-
Object.assign(this.
|
|
1584
|
+
Object.assign(this._uiProgress.options, options);
|
|
1585
1585
|
}
|
|
1586
1586
|
|
|
1587
|
-
if (this.
|
|
1587
|
+
if (this._uiProgress.options.close) { // Asked to close the dialog
|
|
1588
1588
|
return Promise.resolve()
|
|
1589
|
-
.then(()=> this.
|
|
1589
|
+
.then(()=> this._uiProgress.promise && app.service('$prompt').close(true)) // Close the dialog if its open
|
|
1590
1590
|
.then(()=> { // Release state
|
|
1591
|
-
this.
|
|
1592
|
-
this.
|
|
1591
|
+
this._uiProgress.options = {};
|
|
1592
|
+
this._uiProgress.promise = null;
|
|
1593
1593
|
})
|
|
1594
|
-
} else if (!this.
|
|
1595
|
-
this.
|
|
1594
|
+
} else if (!this._uiProgress.promise) { // Not created the dialog yet
|
|
1595
|
+
this._uiProgress.promise = this.requestFocus(()=>
|
|
1596
1596
|
app.service('$prompt').dialog({
|
|
1597
|
-
title: this.
|
|
1598
|
-
backdrop: this.
|
|
1597
|
+
title: this._uiProgress.options.title,
|
|
1598
|
+
backdrop: this._uiProgress.options.backdrop, // pass backdrop to allow 'static' dialog
|
|
1599
1599
|
component: 'uiProgress',
|
|
1600
|
-
componentProps: this.
|
|
1600
|
+
componentProps: this._uiProgress.options,
|
|
1601
1601
|
closeable: false,
|
|
1602
1602
|
keyboard: false,
|
|
1603
1603
|
})
|
|
@@ -1608,8 +1608,10 @@ export default class TeraFyServer {
|
|
|
1608
1608
|
}
|
|
1609
1609
|
}
|
|
1610
1610
|
|
|
1611
|
-
|
|
1612
|
-
|
|
1611
|
+
_uiProgress = {
|
|
1612
|
+
options: {},
|
|
1613
|
+
promise: null,
|
|
1614
|
+
};
|
|
1613
1615
|
|
|
1614
1616
|
|
|
1615
1617
|
/**
|
package/package.json
CHANGED