@iebh/tera-fy 2.3.11 → 2.3.12

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.
Files changed (82) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/api.md +8 -11
  3. package/dist/plugin.vue2.es2019.js +7 -7
  4. package/dist/terafy.bootstrapper.es2019.js +2 -2
  5. package/dist/terafy.bootstrapper.js +2 -2
  6. package/dist/terafy.es2019.js +5 -5
  7. package/dist/terafy.js +5 -5
  8. package/eslint.config.js +4 -66
  9. package/lib/{projectFile.ts → projectFile.js} +52 -76
  10. package/lib/syncro/{entities.ts → entities.js} +14 -83
  11. package/lib/syncro/{keyed.ts → keyed.js} +46 -68
  12. package/lib/syncro/{syncro.ts → syncro.js} +104 -136
  13. package/lib/{terafy.bootstrapper.ts → terafy.bootstrapper.js} +20 -30
  14. package/lib/{terafy.client.ts → terafy.client.js} +85 -84
  15. package/lib/{terafy.proxy.ts → terafy.proxy.js} +12 -26
  16. package/lib/{terafy.server.ts → terafy.server.js} +204 -229
  17. package/package.json +20 -39
  18. package/plugins/{base.ts → base.js} +3 -5
  19. package/plugins/{firebase.ts → firebase.js} +22 -21
  20. package/plugins/{vite.ts → vite.js} +3 -3
  21. package/plugins/{vue2.ts → vue2.js} +8 -10
  22. package/plugins/{vue3.ts → vue3.js} +7 -10
  23. package/utils/mixin.js +15 -0
  24. package/utils/{pathTools.ts → pathTools.js} +8 -9
  25. package/widgets/tera-file-select.vue +1 -1
  26. package/dist/lib/projectFile.d.ts +0 -190
  27. package/dist/lib/projectFile.js +0 -305
  28. package/dist/lib/projectFile.js.map +0 -1
  29. package/dist/lib/syncro/entities.d.ts +0 -34
  30. package/dist/lib/syncro/entities.js +0 -212
  31. package/dist/lib/syncro/entities.js.map +0 -1
  32. package/dist/lib/syncro/keyed (Rhino's conflicted copy 2026-05-10).js +0 -287
  33. package/dist/lib/syncro/keyed.d.ts +0 -95
  34. package/dist/lib/syncro/keyed.js +0 -288
  35. package/dist/lib/syncro/keyed.js (Rhino's conflicted copy 2026-05-10).map +0 -1
  36. package/dist/lib/syncro/keyed.js.map +0 -1
  37. package/dist/lib/syncro/syncro (Rhino's conflicted copy 2026-05-10).js +0 -765
  38. package/dist/lib/syncro/syncro.d (Rhino's conflicted copy 2026-05-10).ts +0 -336
  39. package/dist/lib/syncro/syncro.d.ts +0 -343
  40. package/dist/lib/syncro/syncro.js +0 -771
  41. package/dist/lib/syncro/syncro.js (Rhino's conflicted copy 2026-05-10).map +0 -1
  42. package/dist/lib/syncro/syncro.js.map +0 -1
  43. package/dist/lib/terafy.bootstrapper.d.ts +0 -42
  44. package/dist/lib/terafy.bootstrapper.js +0 -129
  45. package/dist/lib/terafy.bootstrapper.js.map +0 -1
  46. package/dist/lib/terafy.client.d.ts +0 -555
  47. package/dist/lib/terafy.client.js +0 -1153
  48. package/dist/lib/terafy.client.js.map +0 -1
  49. package/dist/lib/terafy.proxy.d.ts +0 -66
  50. package/dist/lib/terafy.proxy.js +0 -130
  51. package/dist/lib/terafy.proxy.js.map +0 -1
  52. package/dist/lib/terafy.server.d.ts +0 -697
  53. package/dist/lib/terafy.server.js +0 -2062
  54. package/dist/lib/terafy.server.js.map +0 -1
  55. package/dist/plugin.vue2.es2019 (Rhino's conflicted copy 2026-05-10).js +0 -1271
  56. package/dist/plugins/base.d.ts +0 -20
  57. package/dist/plugins/base.js +0 -22
  58. package/dist/plugins/base.js.map +0 -1
  59. package/dist/plugins/firebase.d.ts +0 -62
  60. package/dist/plugins/firebase.js +0 -123
  61. package/dist/plugins/firebase.js.map +0 -1
  62. package/dist/plugins/vite.d.ts +0 -12
  63. package/dist/plugins/vite.js +0 -22
  64. package/dist/plugins/vite.js.map +0 -1
  65. package/dist/plugins/vue2.d.ts +0 -67
  66. package/dist/plugins/vue2.js +0 -104
  67. package/dist/plugins/vue2.js.map +0 -1
  68. package/dist/plugins/vue3.d.ts +0 -63
  69. package/dist/plugins/vue3.js +0 -93
  70. package/dist/plugins/vue3.js.map +0 -1
  71. package/dist/utils/mixin.d.ts +0 -11
  72. package/dist/utils/mixin.js +0 -15
  73. package/dist/utils/mixin.js.map +0 -1
  74. package/dist/utils/pDefer.d.ts +0 -16
  75. package/dist/utils/pDefer.js +0 -19
  76. package/dist/utils/pDefer.js.map +0 -1
  77. package/dist/utils/pathTools.d.ts +0 -70
  78. package/dist/utils/pathTools.js +0 -120
  79. package/dist/utils/pathTools.js.map +0 -1
  80. package/tsconfig.json +0 -30
  81. package/utils/mixin.ts +0 -18
  82. package/utils/pDefer.ts +0 -27
package/package.json CHANGED
@@ -1,73 +1,64 @@
1
1
  {
2
2
  "name": "@iebh/tera-fy",
3
- "version": "2.3.11",
3
+ "version": "2.3.12",
4
4
  "description": "TERA website worker",
5
5
  "scripts": {
6
- "dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.ts --outfile=dist/terafy.js --minify --serve --servedir=.",
6
+ "dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify --serve --servedir=.",
7
+ "prebuild": "rimraf dist/",
7
8
  "build": "concurrently 'npm:build:*'",
8
- "build:tsc": "tsc --outDir dist",
9
- "build:client": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.ts --outfile=dist/terafy.js --minify",
10
- "build:client:es2019": "esbuild --platform=browser --format=esm --target=es2019 --bundle lib/terafy.client.ts --outfile=dist/terafy.es2019.js --minify",
11
- "build:bootstrapper": "esbuild --platform=browser --format=esm --bundle lib/terafy.bootstrapper.ts --outfile=dist/terafy.bootstrapper.js --minify",
12
- "build:bootstrapper:es2019": "esbuild --platform=browser --format=esm --target=es2019 --bundle lib/terafy.bootstrapper.ts --outfile=dist/terafy.bootstrapper.es2019.js --minify",
13
- "build:plugins:vue2:es2019": "esbuild --platform=browser --format=esm --target=es2019 --bundle plugins/vue2.ts --outfile=dist/plugin.vue2.es2019.js --minify",
14
- "build:docs:api": "documentation build lib/terafy.client.ts lib/projectFile.ts --format html --config documentation.yml --output docs/",
15
- "build:docs:markdown": "documentation build lib/terafy.client.ts lib/projectFile.ts --format md --markdown-toc --output api.md",
9
+ "build:client": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify",
10
+ "build:client:es2019": "esbuild --platform=browser --format=esm --target=es2019 --bundle lib/terafy.client.js --outfile=dist/terafy.es2019.js --minify",
11
+ "build:bootstrapper": "esbuild --platform=browser --format=esm --bundle lib/terafy.bootstrapper.js --outfile=dist/terafy.bootstrapper.js --minify",
12
+ "build:bootstrapper:es2019": "esbuild --platform=browser --format=esm --target=es2019 --bundle lib/terafy.bootstrapper.js --outfile=dist/terafy.bootstrapper.es2019.js --minify",
13
+ "build:plugins:vue2:es2019": "esbuild --platform=browser --format=esm --target=es2019 --bundle plugins/vue2.js --outfile=dist/plugin.vue2.es2019.js --minify",
14
+ "build:docs:api": "documentation build lib/terafy.client.js lib/projectFile.js --format html --config documentation.yml --output docs/",
15
+ "build:docs:markdown": "documentation build lib/terafy.client.js lib/projectFile.js --format md --markdown-toc --output api.md",
16
16
  "lint": "eslint",
17
17
  "release": "release-it",
18
- "watch": "nodemon --watch lib --watch plugins --ext ts --exec \"npm run build\""
18
+ "watch": "nodemon --watch lib --watch plugins --ext js --exec \"npm run build\""
19
19
  },
20
20
  "type": "module",
21
21
  "imports": {
22
- "#terafy": "./lib/terafy.client.ts",
23
- "#utils/*": "./utils/*.ts"
22
+ "#terafy": "./lib/terafy.client.js",
23
+ "#utils/*": "./utils/*.js"
24
24
  },
25
25
  "exports": {
26
26
  ".": {
27
- "types": "./dist/lib/terafy.client.d.ts",
28
27
  "browser": "./dist/lib/terafy.client.js",
29
28
  "import": "./dist/lib/terafy.client.js",
30
29
  "require": "./dist/terafy.js",
31
30
  "default": "./dist/terafy.js"
32
31
  },
33
32
  "./bootstrap": {
34
- "types": "./dist/lib/terafy.bootstrapper.d.ts",
35
33
  "import": "./dist/lib/terafy.bootstrapper.js",
36
34
  "default": "./dist/lib/terafy.bootstrapper.js"
37
35
  },
38
36
  "./projectFile": {
39
- "types": "./dist/lib/projectFile.d.ts",
40
37
  "import": "./dist/lib/projectFile.js",
41
38
  "default": "./dist/lib/projectFile.js"
42
39
  },
43
40
  "./proxy": {
44
- "types": "./dist/lib/terafy.proxy.d.ts",
45
41
  "import": "./dist/lib/terafy.proxy.js",
46
42
  "default": "./dist/lib/terafy.proxy.js"
47
43
  },
48
44
  "./server": {
49
- "types": "./dist/lib/terafy.server.d.ts",
50
45
  "import": "./dist/lib/terafy.server.js",
51
46
  "default": "./dist/lib/terafy.server.js"
52
47
  },
53
48
  "./syncro": {
54
- "types": "./dist/lib/syncro/syncro.d.ts",
55
49
  "import": "./dist/lib/syncro/syncro.js",
56
50
  "default": "./dist/lib/syncro/syncro.js"
57
51
  },
58
52
  "./syncro/*": {
59
- "types": "./dist/lib/syncro/*.d.ts",
60
53
  "import": "./dist/lib/syncro/*.js",
61
54
  "default": "./dist/lib/syncro/*.js"
62
55
  },
63
56
  "./plugins/*": {
64
- "types": "./dist/plugins/*.d.ts",
65
57
  "import": "./dist/plugins/*.js",
66
58
  "default": "./dist/plugins/*.js"
67
59
  },
68
60
  "./widgets/*": "./widgets/*"
69
61
  },
70
- "types": "./dist/lib/terafy.client.d.ts",
71
62
  "repository": {
72
63
  "type": "git",
73
64
  "url": "git+https://github.com/IEBH/TERA-fy.git"
@@ -107,9 +98,9 @@
107
98
  "@iebh/supabasey": "^1.1.7",
108
99
  "@momsfriendlydevco/marshal": "^2.2.0",
109
100
  "detect-port": "^2.1.0",
110
- "filesize": "^11.0.13",
101
+ "filesize": "^11.0.17",
111
102
  "http-proxy": "^1.18.1",
112
- "lodash-es": "^4.17.23",
103
+ "lodash-es": "^4.18.1",
113
104
  "mitt": "^3.0.1",
114
105
  "nanoid": "^5.1.6",
115
106
  "p-retry": "^7.1.1",
@@ -118,35 +109,25 @@
118
109
  "uuid": "^13.0.0"
119
110
  },
120
111
  "devDependencies": {
121
- "@momsfriendlydevco/eslint-config": "^2.4.2",
112
+ "@momsfriendlydevco/eslint-config": "^2.5.0",
122
113
  "@release-it/conventional-changelog": "^10.0.5",
123
- "@types/detect-port": "^2.0.0",
124
- "@types/http-proxy": "^1.17.17",
125
- "@types/lodash-es": "^4.17.12",
126
- "@types/node": "^25.4.0",
127
- "@types/uuid": "^11.0.0",
128
- "@typescript-eslint/eslint-plugin": "^8.57.0",
129
- "@typescript-eslint/parser": "^8.57.0",
130
114
  "concurrently": "^9.2.1",
131
115
  "conventional-changelog-eslint": "^6.1.0",
132
116
  "documentation": "^14.0.3",
133
117
  "esbuild": "^0.27.3",
134
- "eslint": "^10.1.0",
118
+ "eslint": "^10.3.0",
135
119
  "eslint-plugin": "^1.0.1",
136
- "globals": "^17.4.0",
137
120
  "nodemon": "^3.1.14",
138
- "typescript": "^5.9.3",
139
- "typescript-eslint": "^8.57.0"
121
+ "rimraf": "^6.1.3"
140
122
  },
141
123
  "peerDependencies": {
142
124
  "@iebh/reflib": "^2.5.4",
143
125
  "@supabase/supabase-js": "^2.48.1",
144
- "firebase": ">=11.11.0",
145
- "vue": "^3.0.0"
126
+ "firebase": ">=11.11.0"
146
127
  },
147
128
  "optionalDependencies": {
148
129
  "just-diff-apply": "^5.5.0",
149
- "vue": "^3.5.30"
130
+ "vue": "^3.5.34"
150
131
  },
151
132
  "release-it": {
152
133
  "git": {
@@ -1,5 +1,3 @@
1
- import type TeraFy from "../lib/terafy.client.js";
2
-
3
1
  /**
4
2
  * Base TeraFy plugin interface
5
3
  * This is included as a documentation exanple only
@@ -11,7 +9,7 @@ export default class TeraFyPlugin {
11
9
  /**
12
10
  * Optional function to be included when the main TeraFyClient is initalized
13
11
  */
14
- init(): any {}
12
+ init() {}
15
13
 
16
14
 
17
15
  /**
@@ -20,7 +18,7 @@ export default class TeraFyPlugin {
20
18
  * @param {TeraFy} terafy The TeraFy client this plugin is being initalized against
21
19
  * @param {Object} [options] Additional options to mutate behaviour
22
20
  */
23
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
- constructor(terafy: TeraFy, options: object) { // eslint-disable-line no-unused-vars
21
+ constructor(terafy, options) { // eslint-disable-line no-unused-vars
25
22
  }
23
+
26
24
  }
@@ -17,14 +17,15 @@ export default class TeraFyPluginFirebase extends TeraFyPluginBase {
17
17
  *
18
18
  * @type {Object<Syncro>}
19
19
  */
20
- syncros: Record<string, Syncro> = {};
21
- namespaces: Record<string, any> = {}; // Declare namespaces property
20
+ syncros = {};
22
21
 
23
- // Declare properties expected by the class methods or potentially inherited
24
- getCredentials!: () => Promise<Record<string, any>>;
25
- requireProject!: () => Promise<{ id: string }>;
26
- // eslint-disable-next-line no-unused-vars
27
- debug!: (...args: any[]) => void;
22
+
23
+ /**
24
+ * Available Namespaces
25
+ *
26
+ * @type {Object}
27
+ */
28
+ namespaces = {};
28
29
 
29
30
 
30
31
  /**
@@ -36,7 +37,7 @@ export default class TeraFyPluginFirebase extends TeraFyPluginBase {
36
37
  * @name getReactive
37
38
  * @type {Function} A reactive function as defined in Syncro
38
39
  */
39
- getReactive?: () => any;
40
+ getReactive;
40
41
 
41
42
 
42
43
  /**
@@ -53,7 +54,7 @@ export default class TeraFyPluginFirebase extends TeraFyPluginBase {
53
54
  *
54
55
  * @returns {Promise} A Promise which will resolve when the init process has completed
55
56
  */
56
- async init(options?: any): Promise<void> { // Add optional '?' and type 'any', keep async Promise<void>
57
+ async init(options) {
57
58
  const settings = {
58
59
  firebaseApiKey: null,
59
60
  firebaseAuthDomain: null,
@@ -70,17 +71,17 @@ export default class TeraFyPluginFirebase extends TeraFyPluginBase {
70
71
  throw new Error('Firebase plugin requires mandatory options: ' + emptyValues.join(', '));
71
72
 
72
73
  Syncro.firebase = Firebase({
73
- apiKey: settings.firebaseApiKey!, // Add non-null assertion
74
- authDomain: settings.firebaseAuthDomain!, // Add non-null assertion
75
- projectId: settings.firebaseProjectId!, // Add non-null assertion
76
- appId: settings.firebaseAppId!, // Add non-null assertion
74
+ apiKey: settings.firebaseApiKey,
75
+ authDomain: settings.firebaseAuthDomain,
76
+ projectId: settings.firebaseProjectId,
77
+ appId: settings.firebaseAppId,
77
78
  });
78
- Syncro.firestore = Firestore(Syncro.firebase); // Use Syncro.firebase
79
+ Syncro.firestore = Firestore(Syncro.firebase);
79
80
 
80
81
  Syncro.supabasey = await Supabasey.init({
81
82
  env: {
82
- SUPABASE_URL: settings.supabaseUrl!,
83
- SUPABASE_KEY: settings.supabaseKey!, // Add non-null assertions
83
+ SUPABASE_URL: settings.supabaseUrl,
84
+ SUPABASE_KEY: settings.supabaseKey,
84
85
  },
85
86
  });
86
87
  }
@@ -93,8 +94,8 @@ export default class TeraFyPluginFirebase extends TeraFyPluginBase {
93
94
  *
94
95
  * @returns {Promise} A promise which resolves when the operation has completed
95
96
  */
96
- _mountNamespace(name: string): Promise<void> { // Add type 'string'
97
- let syncro: Syncro; // Add type Syncro
97
+ _mountNamespace(name) {
98
+ let syncro;
98
99
 
99
100
  return Promise.resolve()
100
101
  .then(()=> this.requireProject())
@@ -104,7 +105,7 @@ export default class TeraFyPluginFirebase extends TeraFyPluginBase {
104
105
  : `project_namespaces::${project.id}::${name}`;
105
106
 
106
107
  syncro = this.syncros[name] = new Syncro(path, {
107
- debug: (...msg: any[]) => this.debug(`SYNCRO://${path}`, ...msg), // Add type any[]
108
+ debug: (...msg) => this.debug(`SYNCRO://${path}`, ...msg),
108
109
  getReactive: this.getReactive, // Try to inherit this instances getReactive prop, otherwise Syncro will fall back to its default
109
110
  });
110
111
 
@@ -124,7 +125,7 @@ export default class TeraFyPluginFirebase extends TeraFyPluginBase {
124
125
  *
125
126
  * @returns {Promise} A promise which resolves when the operation has completed
126
127
  */
127
- _unmountNamespace(name: string): Promise<void | any[]> { // Add type 'string'
128
+ _unmountNamespace(name) {
128
129
  const syncro = this.syncros[name]; // Create local alias for Syncro before we detach it
129
130
 
130
131
  // Detach local state
@@ -132,7 +133,7 @@ export default class TeraFyPluginFirebase extends TeraFyPluginBase {
132
133
  delete this.syncros[name];
133
134
 
134
135
  // Check if syncro exists before calling destroy
135
- if (syncro) {
136
+ if (syncro) { // eslint-disable-line unicorn/prefer-ternary
136
137
  return syncro.destroy(); // Trigger Syncro destruction
137
138
  } else {
138
139
  return Promise.resolve(); // Or handle the case where syncro doesn't exist
@@ -8,12 +8,12 @@ import TeraProxy from '../lib/terafy.proxy.js';
8
8
  * @param {Object} [options] Options to pass to the Proxy module
9
9
  * @returns {VitePlugin}
10
10
  */
11
- export default function vitePluginTeraFy(options: any) {
11
+ export default function vitePluginTeraFy(options) {
12
12
 
13
13
  // Vite plugin config
14
14
  return {
15
15
  name: 'tera-fy',
16
- apply(config: any, { command }: any) { // Only run within serve-mode rather than each build
16
+ apply(config, {command}) { // Only run within serve-mode rather than each build
17
17
 
18
18
  // Don't run when building
19
19
  if (command == 'build') return false;
@@ -21,4 +21,4 @@ export default function vitePluginTeraFy(options: any) {
21
21
  TeraProxy(options);
22
22
  },
23
23
  }
24
- }
24
+ }
@@ -31,13 +31,14 @@ export default class TeraFyPluginVue2 extends TeraFyPluginFirebase {
31
31
  *
32
32
  * @type {Vue}
33
33
  */
34
- Vue: any;
34
+ Vue;
35
+
35
36
 
36
37
  /**
37
38
  * The root Vue app instance
38
39
  * @type {any}
39
40
  */
40
- app: any;
41
+ app;
41
42
 
42
43
 
43
44
  /**
@@ -45,7 +46,7 @@ export default class TeraFyPluginVue2 extends TeraFyPluginFirebase {
45
46
  *
46
47
  * @type {Object | null}
47
48
  */
48
- project: any = null;
49
+ project = null;
49
50
 
50
51
 
51
52
  /**
@@ -66,7 +67,7 @@ export default class TeraFyPluginVue2 extends TeraFyPluginFirebase {
66
67
  *
67
68
  * @returns {Promise} A Promise which will resolve when the init process has completed
68
69
  */
69
- async init(options: any) {
70
+ async init(options) {
70
71
  const settings = {
71
72
  app: null,
72
73
  Vue: null,
@@ -85,14 +86,12 @@ export default class TeraFyPluginVue2 extends TeraFyPluginFirebase {
85
86
  this.Vue.prototype[settings.globalName] = this;
86
87
 
87
88
  await super.init(settings); // Initalize parent class Firebase functionality
88
- // @ts-expect-error TODO: Track down why eslint throws error
89
89
  this.project = await this.mountNamespace('_PROJECT');
90
90
  }
91
91
 
92
92
 
93
93
  /** @override */
94
- // @ts-expect-error TODO: Work out why TS doesn't like overrides
95
- getReactive(value: any) {
94
+ getReactive(value) {
96
95
  const doc = this.Vue.observable(value);
97
96
 
98
97
  const watcherPath = `_teraFy_${this.reactiveId++}`;
@@ -100,7 +99,7 @@ export default class TeraFyPluginVue2 extends TeraFyPluginFirebase {
100
99
 
101
100
  return {
102
101
  doc,
103
- setState: (state: any) => {
102
+ setState: state => {
104
103
  // Shallow copy all sub-keys into existing object (keeping the object pointer)
105
104
  Object.entries(state || {})
106
105
  .filter(([k]) => !isEqual(doc[k], state[k])) // Only accept changed keys
@@ -109,8 +108,7 @@ export default class TeraFyPluginVue2 extends TeraFyPluginFirebase {
109
108
  getState: () => {
110
109
  return cloneDeep(doc);
111
110
  },
112
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
113
- watch: (cb: Function) => {
111
+ watch: cb => {
114
112
  this.app.$watch(watcherPath, cb, {deep: true});
115
113
  },
116
114
  };
@@ -1,6 +1,6 @@
1
1
  import {cloneDeep} from 'lodash-es';
2
2
  import TeraFyPluginFirebase from './firebase.js';
3
- import {reactive as vueReactive, watch as vueWatch, App, WatchCallback} from 'vue';
3
+ import {reactive as vueReactive, watch as vueWatch} from 'vue';
4
4
 
5
5
  /**
6
6
  * Vue observables plugin
@@ -33,7 +33,7 @@ export default class TeraFyPluginVue3 extends TeraFyPluginFirebase {
33
33
  *
34
34
  * @type {Object}
35
35
  */
36
- project: any = null;
36
+ project = null;
37
37
 
38
38
 
39
39
  /**
@@ -41,22 +41,20 @@ export default class TeraFyPluginVue3 extends TeraFyPluginFirebase {
41
41
  *
42
42
  * @param {Object} options Additional options to mutate behaviour, see TeraFyPluginFirebase
43
43
  */
44
- async init(options: Record<string, any>) {
44
+ async init(options) {
45
45
  await super.init(options); // Initalize parent class Firebase functionality
46
46
 
47
47
  // Mount the project namespace
48
- // @ts-expect-error TODO: Track down why eslint throws error
49
48
  this.project = await this.mountNamespace('_PROJECT');
50
49
  }
51
50
 
52
51
 
53
52
  /** @override */
54
- // @ts-expect-error TODO: Work out why TS doesn't like overrides
55
- getReactive(value: any) {
53
+ getReactive(value) {
56
54
  const doc = vueReactive(value);
57
55
  return {
58
56
  doc,
59
- setState(state: any) {
57
+ setState(state) {
60
58
  // Shallow copy all sub-keys into existing object (keeping the object pointer)
61
59
  Object.entries(state || {})
62
60
  .forEach(([k, v]) => doc[k] = v)
@@ -64,7 +62,7 @@ export default class TeraFyPluginVue3 extends TeraFyPluginFirebase {
64
62
  getState() {
65
63
  return cloneDeep(doc);
66
64
  },
67
- watch(cb: WatchCallback<any, any>) {
65
+ watch(cb) {
68
66
  vueWatch(doc, cb, {deep: true});
69
67
  },
70
68
  };
@@ -77,7 +75,6 @@ export default class TeraFyPluginVue3 extends TeraFyPluginFirebase {
77
75
  * @returns {VuePlugin} A Vue@3 plugin spec
78
76
  */
79
77
  vuePlugin() {
80
- // eslint-disable-next-line @typescript-eslint/no-this-alias
81
78
  const $tera = this;
82
79
 
83
80
  return {
@@ -90,7 +87,7 @@ export default class TeraFyPluginVue3 extends TeraFyPluginFirebase {
90
87
  * @param {Object} [options] Additional options to mutate behaviour
91
88
  * @param {String} [options.globalName='$tera'] Global property to allocate this service as
92
89
  */
93
- install(app: App, options: Record<string, any>) {
90
+ install(app, options) {
94
91
  const settings = {
95
92
  globalName: '$tera',
96
93
  ...options,
package/utils/mixin.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Mix additional properties into an object, inheriting from its prototype
3
+ * @param {Object} instance The instance to mixin into
4
+ * @param {Object} assignments Additional properties to assign
5
+ * @returns {Object} A new object inheriting from the instance prototype with merged properties
6
+ */
7
+ export default function mixin(instance, assignments) {
8
+ return Object.assign(
9
+ Object.create(
10
+ Object.getPrototypeOf(instance)
11
+ ),
12
+ instance,
13
+ assignments
14
+ );
15
+ }
@@ -33,7 +33,7 @@ import {
33
33
  *
34
34
  * @returns {*} The set value
35
35
  */
36
- export function set(target: any, path: string | (string | number)[], value: any, options?: any): any {
36
+ export function set(target, path, value, options) {
37
37
  const settings = {
38
38
  strategy: 'overwrite',
39
39
  ...options,
@@ -76,13 +76,11 @@ export function set(target: any, path: string | (string | number)[], value: any,
76
76
  * @param {*} [fallback] Optional fallback to return if the end point does not exist
77
77
  * @returns {*} The fetched value
78
78
  */
79
- export function get(target: any, path: string | (string | number)[], fallback?: any): any {
79
+ export function get(target, path, fallback) {
80
80
  return _get(target, path, fallback);
81
81
  }
82
82
 
83
83
 
84
-
85
-
86
84
  /**
87
85
  * Internal recursive path checker
88
86
  *
@@ -90,7 +88,7 @@ export function get(target: any, path: string | (string | number)[], fallback?:
90
88
  * @param {String|Array} path The path within the target, to fetch in dotted or array notation
91
89
  * @returns {Boolean} True if the given path already exists within the subject
92
90
  */
93
- export function has(target: any, path: string | (string | number)[]): boolean {
91
+ export function has(target, path) {
94
92
  return _has(target, path);
95
93
  }
96
94
 
@@ -104,7 +102,7 @@ export function has(target: any, path: string | (string | number)[]): boolean {
104
102
  *
105
103
  * @returns {*} The merged value
106
104
  */
107
- export function merge(target: any, path: string | (string | number)[], value: any): any {
105
+ export function merge(target, path, value) {
108
106
  _merge(get(target, path), value);
109
107
  return value;
110
108
  }
@@ -119,9 +117,10 @@ export function merge(target: any, path: string | (string | number)[], value: an
119
117
  *
120
118
  * @returns {*} The resulting object with defaults applied
121
119
  */
122
- export function defaults(target: any, path: string | (string | number)[], value?: any): any {
120
+ export function defaults(target, path, value) {
123
121
  if (typeof path == 'string' || Array.isArray(path)) { // Called as (target, path, value)
124
- if (!has(target, path)) { // Target path doesn't exist at all
122
+ if (!has(target, path)) { // eslint-disable-line unicorn/prefer-ternary
123
+ // Target path doesn't exist at all
125
124
  return set(target, path, value);
126
125
  } else { // Target path exists - apply Lodash defaults
127
126
  return _defaults(get(target, path), value);
@@ -139,4 +138,4 @@ export default {
139
138
  has,
140
139
  merge,
141
140
  defaults,
142
- };
141
+ };
@@ -31,7 +31,7 @@ export default {
31
31
  * @type {null|ProjectFile}
32
32
  */
33
33
  selected: null,
34
- }},
34
+ } },
35
35
  props: {
36
36
  // Props passed to $teraFy.selectProjectFile()
37
37
  save: {type: Boolean, default: false},