@iebh/tera-fy 2.3.0 → 2.3.2

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 (66) hide show
  1. package/.vscode/settings.json +5 -0
  2. package/CHANGELOG.md +22 -0
  3. package/api.md +35 -36
  4. package/dist/lib/projectFile.d.ts +3 -3
  5. package/dist/lib/projectFile.js +4 -3
  6. package/dist/lib/projectFile.js.map +1 -1
  7. package/dist/lib/syncro/entities.js +11 -10
  8. package/dist/lib/syncro/entities.js.map +1 -1
  9. package/dist/lib/syncro/keyed.d.ts +2 -2
  10. package/dist/lib/syncro/keyed.js +23 -23
  11. package/dist/lib/syncro/keyed.js.map +1 -1
  12. package/dist/lib/syncro/syncro.d.ts +15 -13
  13. package/dist/lib/syncro/syncro.js +84 -59
  14. package/dist/lib/syncro/syncro.js.map +1 -1
  15. package/dist/lib/terafy.bootstrapper.d.ts +2 -2
  16. package/dist/lib/terafy.bootstrapper.js +15 -16
  17. package/dist/lib/terafy.bootstrapper.js.map +1 -1
  18. package/dist/lib/terafy.client.d.ts +24 -25
  19. package/dist/lib/terafy.client.js +50 -48
  20. package/dist/lib/terafy.client.js.map +1 -1
  21. package/dist/lib/terafy.proxy.js +4 -2
  22. package/dist/lib/terafy.proxy.js.map +1 -1
  23. package/dist/lib/terafy.server.d.ts +22 -8
  24. package/dist/lib/terafy.server.js +54 -58
  25. package/dist/lib/terafy.server.js.map +1 -1
  26. package/dist/plugin.vue2.es2019.js +210 -1224
  27. package/dist/plugins/base.d.ts +2 -2
  28. package/dist/plugins/base.js +1 -0
  29. package/dist/plugins/base.js.map +1 -1
  30. package/dist/plugins/firebase.d.ts +4 -4
  31. package/dist/plugins/firebase.js +7 -7
  32. package/dist/plugins/firebase.js.map +1 -1
  33. package/dist/plugins/vue2.d.ts +1 -1
  34. package/dist/plugins/vue2.js +6 -5
  35. package/dist/plugins/vue2.js.map +1 -1
  36. package/dist/plugins/vue3.js +6 -5
  37. package/dist/plugins/vue3.js.map +1 -1
  38. package/dist/terafy.bootstrapper.es2019.js +2 -2
  39. package/dist/terafy.bootstrapper.js +2 -2
  40. package/dist/terafy.es2019.js +2 -2
  41. package/dist/terafy.js +2 -2
  42. package/dist/utils/mixin.js +1 -1
  43. package/dist/utils/mixin.js.map +1 -1
  44. package/dist/utils/pDefer.d.ts +5 -1
  45. package/dist/utils/pDefer.js +6 -1
  46. package/dist/utils/pDefer.js.map +1 -1
  47. package/dist/utils/pathTools.d.ts +1 -1
  48. package/dist/utils/pathTools.js +2 -2
  49. package/dist/utils/pathTools.js.map +1 -1
  50. package/eslint.config.js +21 -7
  51. package/lib/projectFile.ts +5 -4
  52. package/lib/syncro/entities.ts +11 -10
  53. package/lib/syncro/keyed.ts +24 -24
  54. package/lib/syncro/syncro.ts +97 -60
  55. package/lib/terafy.bootstrapper.ts +15 -16
  56. package/lib/terafy.client.ts +62 -62
  57. package/lib/terafy.proxy.ts +8 -5
  58. package/lib/terafy.server.ts +75 -64
  59. package/package.json +5 -3
  60. package/plugins/base.ts +3 -2
  61. package/plugins/firebase.ts +12 -11
  62. package/plugins/vue2.ts +7 -6
  63. package/plugins/vue3.ts +6 -5
  64. package/utils/mixin.ts +1 -1
  65. package/utils/pDefer.ts +7 -2
  66. package/utils/pathTools.ts +3 -3
package/plugins/vue3.ts CHANGED
@@ -46,15 +46,15 @@ export default class TeraFyPluginVue3 extends TeraFyPluginFirebase {
46
46
  await super.init(options); // Initalize parent class Firebase functionality
47
47
 
48
48
  // Mount the project namespace
49
- // @ts-ignore
49
+ // @ts-expect-error TODO: Track down why eslint throws error
50
50
  this.project = await this.mountNamespace('_PROJECT');
51
51
  }
52
52
 
53
53
 
54
54
  /** @override */
55
- // @ts-ignore
55
+ // @ts-expect-error TODO: Work out why TS doesn't like overrides
56
56
  getReactive(value: any) {
57
- let doc = vueReactive(value);
57
+ const doc = vueReactive(value);
58
58
  return {
59
59
  doc,
60
60
  setState(state: any) {
@@ -78,7 +78,8 @@ export default class TeraFyPluginVue3 extends TeraFyPluginFirebase {
78
78
  * @returns {VuePlugin} A Vue@3 plugin spec
79
79
  */
80
80
  vuePlugin() {
81
- let $tera = this;
81
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
82
+ const $tera = this;
82
83
 
83
84
  return {
84
85
 
@@ -91,7 +92,7 @@ export default class TeraFyPluginVue3 extends TeraFyPluginFirebase {
91
92
  * @param {String} [options.globalName='$tera'] Global property to allocate this service as
92
93
  */
93
94
  install(app: App, options: Record<string, any>) {
94
- let settings = {
95
+ const settings = {
95
96
  globalName: '$tera',
96
97
  ...options,
97
98
  };
package/utils/mixin.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * @returns {Object} A shallow copy of the input instance extended with the assignments
10
10
  */
11
11
  export default function mixin(instance: any, assignments: any) {
12
- let output = Object.assign(
12
+ const output = Object.assign(
13
13
  Object.create(Object.getPrototypeOf(instance)),
14
14
  instance,
15
15
  assignments,
package/utils/pDefer.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-unused-vars */
1
2
  /**
2
3
  * Returns a defer object which represents a promise object which can resolve in the future - but without enclosing a function
3
4
  * The defer object has the keys {promise, resolve(), reject()}
@@ -6,12 +7,16 @@
6
7
 
7
8
  interface Defer {
8
9
  promise: Promise<unknown>;
9
- resolve: (value?: unknown | PromiseLike<unknown>) => void;
10
+ resolve: (value?: unknown) => void;
10
11
  reject: (reason?: any) => void;
11
12
  }
12
13
 
14
+ /**
15
+ * Default export
16
+ * @returns Deferred promise
17
+ */
13
18
  export default function(): Defer {
14
- var deferred = {} as Defer;
19
+ const deferred = {} as Defer;
15
20
 
16
21
  deferred.promise = new Promise((resolve, reject) => {
17
22
  deferred.resolve = resolve;
@@ -34,13 +34,13 @@ import {
34
34
  * @returns {*} The set value
35
35
  */
36
36
  export function set(target: any, path: string | (string | number)[], value: any, options?: any): any {
37
- let settings = {
37
+ const settings = {
38
38
  strategy: 'overwrite',
39
39
  ...options,
40
40
  };
41
41
 
42
42
  // Fetch the existing value if the strategy calls for it
43
- let hasExistingValue = ['merge', 'defaults'].includes(settings.strategy)
43
+ const hasExistingValue = ['merge', 'defaults'].includes(settings.strategy)
44
44
  ? has(target, path)
45
45
  : undefined;
46
46
 
@@ -119,7 +119,7 @@ export function merge(target: any, path: string | (string | number)[], value: an
119
119
  *
120
120
  * @returns {*} The resulting object with defaults applied
121
121
  */
122
- export function defaults(target: any, path: string | (string | number)[] | any, value?: any): any {
122
+ export function defaults(target: any, path: string | (string | number)[], value?: any): any {
123
123
  if (typeof path == 'string' || Array.isArray(path)) { // Called as (target, path, value)
124
124
  if (!has(target, path)) { // Target path doesn't exist at all
125
125
  return set(target, path, value);