@iebh/tera-fy 2.0.8 → 2.0.9
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 +12 -0
- package/dist/plugin.vue2.es2019.js +1938 -77
- package/lib/syncro/syncro.js +1 -18
- package/package.json +2 -2
package/lib/syncro/syncro.js
CHANGED
|
@@ -105,13 +105,11 @@ export default class Syncro {
|
|
|
105
105
|
* @type {Object}
|
|
106
106
|
* @property {Number} heartbeatinterval Time in milliseconds between heartbeat beacons
|
|
107
107
|
* @property {String} syncroRegistryUrl The prefix Sync worker URL, used to populate Syncros and determine their active status
|
|
108
|
-
* @property {Boolean} forceLocalInit If true, try to init the state of a Syncro locally rather than using `syncroRegistryUrl`, used only for testing
|
|
109
108
|
* @property {Object} context Additional named parameters to pass to callbacks like initState
|
|
110
109
|
*/
|
|
111
110
|
config = {
|
|
112
111
|
heartbeatInterval: 50_000, //~= 50s
|
|
113
112
|
syncroRegistryUrl: 'https://tera-tools.com/api/sync',
|
|
114
|
-
forceLocalInit: false,
|
|
115
113
|
context: {},
|
|
116
114
|
};
|
|
117
115
|
|
|
@@ -256,7 +254,7 @@ export default class Syncro {
|
|
|
256
254
|
let extracted = { ...pathMatcher.exec(path)?.groups };
|
|
257
255
|
|
|
258
256
|
if (!extracted) throw new Error(`Invalid session path syntax "${path}"`);
|
|
259
|
-
if (Syncro.
|
|
257
|
+
if (Syncro.SyncroEntities && !(extracted.entity in SyncroEntities)) throw new Error(`Unsupported entity "${path}" -> Entity="${extracted.entity}"`);
|
|
260
258
|
|
|
261
259
|
return {
|
|
262
260
|
...extracted,
|
|
@@ -511,21 +509,6 @@ export default class Syncro {
|
|
|
511
509
|
} else if (settings.initialState) { // Provided an intiailState - use that instead of the entities own method
|
|
512
510
|
this.debug('Populate initial Syncro state (from provided initialState)');
|
|
513
511
|
return this.setFirestoreState(settings.initialState, {method: 'set'});
|
|
514
|
-
} else if (this.config.forceLocalInit) {
|
|
515
|
-
this.debug(`Populate initial Syncro state (from "${entity}" SyncroEntities)`);
|
|
516
|
-
|
|
517
|
-
return Promise.resolve()
|
|
518
|
-
.then(()=> Syncro.SyncroEntities // Dynamically load Syncro.SyncroEntities if we don't already have it
|
|
519
|
-
|| import('./entities.js')
|
|
520
|
-
.then(({default: entities}) => Syncro.SyncroEntities = entities)
|
|
521
|
-
)
|
|
522
|
-
.then(()=> Syncro.SyncroEntities[entity] || Promise.reject(`Unknown Sync entity "${entity}"`))
|
|
523
|
-
.then(()=> Syncro.SyncroEntities[entity].initState({
|
|
524
|
-
supabase: Syncro.supabase,
|
|
525
|
-
fsCollection, fsId,
|
|
526
|
-
entity, id, relation,
|
|
527
|
-
...this.config.context,
|
|
528
|
-
}))
|
|
529
512
|
} else {
|
|
530
513
|
this.debug(`Populate initial Syncro state (from "${entity}" Syncro worker)`);
|
|
531
514
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iebh/tera-fy",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "TERA website worker",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify --serve --servedir=.",
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
"node": ">=18"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@iebh/reflib": "^2.5.3",
|
|
78
77
|
"@momsfriendlydevco/marshal": "^2.1.4",
|
|
79
78
|
"detect-port": "^2.1.0",
|
|
80
79
|
"filesize": "^10.1.6",
|
|
@@ -95,6 +94,7 @@
|
|
|
95
94
|
"nodemon": "^3.1.9"
|
|
96
95
|
},
|
|
97
96
|
"peerDependencies": {
|
|
97
|
+
"@iebh/reflib": "^2.5.4",
|
|
98
98
|
"@supabase/supabase-js": "^2.48.1",
|
|
99
99
|
"firebase": "^11.3.1",
|
|
100
100
|
"vue": "^3.0.0"
|