@iebh/tera-fy 2.3.10 → 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.
- package/CHANGELOG.md +32 -0
- package/api.md +8 -11
- package/dist/plugin.vue2.es2019.js +28 -27
- package/dist/terafy.bootstrapper.es2019.js +2 -2
- package/dist/terafy.bootstrapper.js +2 -2
- package/dist/terafy.es2019.js +5 -5
- package/dist/terafy.js +5 -5
- package/eslint.config.js +4 -66
- package/lib/{projectFile.ts → projectFile.js} +52 -76
- package/lib/syncro/{entities.ts → entities.js} +14 -83
- package/lib/syncro/{keyed.ts → keyed.js} +46 -68
- package/lib/syncro/{syncro.ts → syncro.js} +104 -136
- package/lib/{terafy.bootstrapper.ts → terafy.bootstrapper.js} +20 -30
- package/lib/{terafy.client.ts → terafy.client.js} +85 -84
- package/lib/{terafy.proxy.ts → terafy.proxy.js} +12 -26
- package/lib/{terafy.server.ts → terafy.server.js} +204 -229
- package/package.json +20 -39
- package/plugins/{base.ts → base.js} +3 -5
- package/plugins/{firebase.ts → firebase.js} +22 -21
- package/plugins/{vite.ts → vite.js} +3 -3
- package/plugins/{vue2.ts → vue2.js} +8 -10
- package/plugins/{vue3.ts → vue3.js} +7 -10
- package/utils/mixin.js +15 -0
- package/utils/{pathTools.ts → pathTools.js} +8 -9
- package/widgets/tera-file-select.vue +1 -1
- package/dist/lib/projectFile.d.ts +0 -190
- package/dist/lib/projectFile.js +0 -305
- package/dist/lib/projectFile.js.map +0 -1
- package/dist/lib/syncro/entities.d.ts +0 -34
- package/dist/lib/syncro/entities.js +0 -212
- package/dist/lib/syncro/entities.js.map +0 -1
- package/dist/lib/syncro/keyed (Rhino's conflicted copy 2026-05-10).js +0 -287
- package/dist/lib/syncro/keyed.d.ts +0 -95
- package/dist/lib/syncro/keyed.js +0 -288
- package/dist/lib/syncro/keyed.js (Rhino's conflicted copy 2026-05-10).map +0 -1
- package/dist/lib/syncro/keyed.js.map +0 -1
- package/dist/lib/syncro/syncro (Rhino's conflicted copy 2026-05-10).js +0 -765
- package/dist/lib/syncro/syncro.d (Rhino's conflicted copy 2026-05-10).ts +0 -336
- package/dist/lib/syncro/syncro.d.ts +0 -343
- package/dist/lib/syncro/syncro.js +0 -771
- package/dist/lib/syncro/syncro.js (Rhino's conflicted copy 2026-05-10).map +0 -1
- package/dist/lib/syncro/syncro.js.map +0 -1
- package/dist/lib/terafy.bootstrapper.d.ts +0 -42
- package/dist/lib/terafy.bootstrapper.js +0 -129
- package/dist/lib/terafy.bootstrapper.js.map +0 -1
- package/dist/lib/terafy.client.d.ts +0 -555
- package/dist/lib/terafy.client.js +0 -1153
- package/dist/lib/terafy.client.js.map +0 -1
- package/dist/lib/terafy.proxy.d.ts +0 -66
- package/dist/lib/terafy.proxy.js +0 -130
- package/dist/lib/terafy.proxy.js.map +0 -1
- package/dist/lib/terafy.server.d.ts +0 -697
- package/dist/lib/terafy.server.js +0 -2062
- package/dist/lib/terafy.server.js.map +0 -1
- package/dist/plugin.vue2.es2019 (Rhino's conflicted copy 2026-05-10).js +0 -1271
- package/dist/plugins/base.d.ts +0 -20
- package/dist/plugins/base.js +0 -22
- package/dist/plugins/base.js.map +0 -1
- package/dist/plugins/firebase.d.ts +0 -62
- package/dist/plugins/firebase.js +0 -123
- package/dist/plugins/firebase.js.map +0 -1
- package/dist/plugins/vite.d.ts +0 -12
- package/dist/plugins/vite.js +0 -22
- package/dist/plugins/vite.js.map +0 -1
- package/dist/plugins/vue2.d.ts +0 -67
- package/dist/plugins/vue2.js +0 -104
- package/dist/plugins/vue2.js.map +0 -1
- package/dist/plugins/vue3.d.ts +0 -63
- package/dist/plugins/vue3.js +0 -93
- package/dist/plugins/vue3.js.map +0 -1
- package/dist/utils/mixin.d.ts +0 -11
- package/dist/utils/mixin.js +0 -15
- package/dist/utils/mixin.js.map +0 -1
- package/dist/utils/pDefer.d.ts +0 -16
- package/dist/utils/pDefer.js +0 -19
- package/dist/utils/pDefer.js.map +0 -1
- package/dist/utils/pathTools.d.ts +0 -70
- package/dist/utils/pathTools.js +0 -120
- package/dist/utils/pathTools.js.map +0 -1
- package/tsconfig.json +0 -30
- package/utils/mixin.ts +0 -18
- package/utils/pDefer.ts +0 -27
package/dist/utils/pDefer.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
|
2
|
-
/**
|
|
3
|
-
* Returns a defer object which represents a promise object which can resolve in the future - but without enclosing a function
|
|
4
|
-
* The defer object has the keys {promise, resolve(), reject()}
|
|
5
|
-
* @returns {Defer} A defered promise
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Default export
|
|
9
|
-
* @returns Deferred promise
|
|
10
|
-
*/
|
|
11
|
-
export default function () {
|
|
12
|
-
const deferred = {};
|
|
13
|
-
deferred.promise = new Promise((resolve, reject) => {
|
|
14
|
-
deferred.resolve = resolve;
|
|
15
|
-
deferred.reject = reject;
|
|
16
|
-
});
|
|
17
|
-
return deferred;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=pDefer.js.map
|
package/dist/utils/pDefer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pDefer.js","sourceRoot":"","sources":["../../utils/pDefer.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC;;;;EAIE;AAQF;;;GAGG;AACH,MAAM,CAAC,OAAO;IACb,MAAM,QAAQ,GAAG,EAAW,CAAC;IAE7B,QAAQ,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAClD,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;QAC3B,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AACjB,CAAC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* General path setters / getters for project state
|
|
3
|
-
* These are _MAINLY_ wrappers for Lodash functionality such as Lodash.set() / Lodash.get(), any deviations are documented inline
|
|
4
|
-
*
|
|
5
|
-
* In each case these functions work with either dotted or array notation against a target master-object
|
|
6
|
-
* - Dotted notation - e.g. `foo.bar.1.baz`
|
|
7
|
-
* - Array path segments e.g. `['foo', 'bar', 1, 'baz']`
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Internal recursive path setter
|
|
11
|
-
*
|
|
12
|
-
* Conflict strategies (copied from utils/pathTools @ `set()`)
|
|
13
|
-
* - 'set' / 'overwrite' - Just overwrite any existing value
|
|
14
|
-
* - 'merge' - Merge existing values using Lodash.merge()
|
|
15
|
-
* - 'defaults' - Merge existing values using Lodash.defaultsDeep()
|
|
16
|
-
*
|
|
17
|
-
* @param {Object} target The target to operate on
|
|
18
|
-
* @param {String|Array} path The path within the target to set, in dotted or array notation
|
|
19
|
-
* @param {*} value The value to set
|
|
20
|
-
* @param {Object} [options] Additional options to mutate behaviour
|
|
21
|
-
* @param {'set'|'overwrite'|'merge'|'defaults'} [options.strategy='set'] How to handle an existing value, if any
|
|
22
|
-
*
|
|
23
|
-
* @returns {*} The set value
|
|
24
|
-
*/
|
|
25
|
-
export declare function set(target: any, path: string | (string | number)[], value: any, options?: any): any;
|
|
26
|
-
/**
|
|
27
|
-
* Internal recursive path fetcher
|
|
28
|
-
*
|
|
29
|
-
* @param {Object} target The target to examine
|
|
30
|
-
* @param {String|Array} path The path within the target to fetch, in dotted or array notation
|
|
31
|
-
* @param {*} [fallback] Optional fallback to return if the end point does not exist
|
|
32
|
-
* @returns {*} The fetched value
|
|
33
|
-
*/
|
|
34
|
-
export declare function get(target: any, path: string | (string | number)[], fallback?: any): any;
|
|
35
|
-
/**
|
|
36
|
-
* Internal recursive path checker
|
|
37
|
-
*
|
|
38
|
-
* @param {Object} target The target to examine
|
|
39
|
-
* @param {String|Array} path The path within the target, to fetch in dotted or array notation
|
|
40
|
-
* @returns {Boolean} True if the given path already exists within the subject
|
|
41
|
-
*/
|
|
42
|
-
export declare function has(target: any, path: string | (string | number)[]): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Internal recursive path merger
|
|
45
|
-
*
|
|
46
|
-
* @param {Object} target The target to operate on, this is likly to be mutated
|
|
47
|
-
* @param {String|Array} path The path within the target to merge, in dotted or array notation
|
|
48
|
-
* @param {*} value The value to merge
|
|
49
|
-
*
|
|
50
|
-
* @returns {*} The merged value
|
|
51
|
-
*/
|
|
52
|
-
export declare function merge(target: any, path: string | (string | number)[], value: any): any;
|
|
53
|
-
/**
|
|
54
|
-
* Internal recursive path defaulter
|
|
55
|
-
*
|
|
56
|
-
* @param {Object} target The target to operate on, this is likly to be mutated
|
|
57
|
-
* @param {String|Array} [path] The path within the target to merge, in dotted or array notation
|
|
58
|
-
* @param {*} value The value to merge
|
|
59
|
-
*
|
|
60
|
-
* @returns {*} The resulting object with defaults applied
|
|
61
|
-
*/
|
|
62
|
-
export declare function defaults(target: any, path: string | (string | number)[], value?: any): any;
|
|
63
|
-
declare const _default: {
|
|
64
|
-
set: typeof set;
|
|
65
|
-
get: typeof get;
|
|
66
|
-
has: typeof has;
|
|
67
|
-
merge: typeof merge;
|
|
68
|
-
defaults: typeof defaults;
|
|
69
|
-
};
|
|
70
|
-
export default _default;
|
package/dist/utils/pathTools.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { defaultsDeep as _defaults, get as _get, has as _has, merge as _merge, set as _set, } from 'lodash-es';
|
|
2
|
-
/**
|
|
3
|
-
* General path setters / getters for project state
|
|
4
|
-
* These are _MAINLY_ wrappers for Lodash functionality such as Lodash.set() / Lodash.get(), any deviations are documented inline
|
|
5
|
-
*
|
|
6
|
-
* In each case these functions work with either dotted or array notation against a target master-object
|
|
7
|
-
* - Dotted notation - e.g. `foo.bar.1.baz`
|
|
8
|
-
* - Array path segments e.g. `['foo', 'bar', 1, 'baz']`
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Internal recursive path setter
|
|
12
|
-
*
|
|
13
|
-
* Conflict strategies (copied from utils/pathTools @ `set()`)
|
|
14
|
-
* - 'set' / 'overwrite' - Just overwrite any existing value
|
|
15
|
-
* - 'merge' - Merge existing values using Lodash.merge()
|
|
16
|
-
* - 'defaults' - Merge existing values using Lodash.defaultsDeep()
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} target The target to operate on
|
|
19
|
-
* @param {String|Array} path The path within the target to set, in dotted or array notation
|
|
20
|
-
* @param {*} value The value to set
|
|
21
|
-
* @param {Object} [options] Additional options to mutate behaviour
|
|
22
|
-
* @param {'set'|'overwrite'|'merge'|'defaults'} [options.strategy='set'] How to handle an existing value, if any
|
|
23
|
-
*
|
|
24
|
-
* @returns {*} The set value
|
|
25
|
-
*/
|
|
26
|
-
export function set(target, path, value, options) {
|
|
27
|
-
const settings = {
|
|
28
|
-
strategy: 'overwrite',
|
|
29
|
-
...options,
|
|
30
|
-
};
|
|
31
|
-
// Fetch the existing value if the strategy calls for it
|
|
32
|
-
const hasExistingValue = ['merge', 'defaults'].includes(settings.strategy)
|
|
33
|
-
? has(target, path)
|
|
34
|
-
: undefined;
|
|
35
|
-
switch (settings.strategy) {
|
|
36
|
-
case 'set':
|
|
37
|
-
case 'overwrite':
|
|
38
|
-
_set(target, path, value);
|
|
39
|
-
break;
|
|
40
|
-
case 'merge':
|
|
41
|
-
if (hasExistingValue) {
|
|
42
|
-
merge(target, path, value);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
_set(target, path, value);
|
|
46
|
-
}
|
|
47
|
-
break;
|
|
48
|
-
case 'defaults':
|
|
49
|
-
defaults(target, path, value);
|
|
50
|
-
break;
|
|
51
|
-
default:
|
|
52
|
-
throw new Error(`Unknown conflict resolution strategy "${settings.strategy}"`);
|
|
53
|
-
}
|
|
54
|
-
return value;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Internal recursive path fetcher
|
|
58
|
-
*
|
|
59
|
-
* @param {Object} target The target to examine
|
|
60
|
-
* @param {String|Array} path The path within the target to fetch, in dotted or array notation
|
|
61
|
-
* @param {*} [fallback] Optional fallback to return if the end point does not exist
|
|
62
|
-
* @returns {*} The fetched value
|
|
63
|
-
*/
|
|
64
|
-
export function get(target, path, fallback) {
|
|
65
|
-
return _get(target, path, fallback);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Internal recursive path checker
|
|
69
|
-
*
|
|
70
|
-
* @param {Object} target The target to examine
|
|
71
|
-
* @param {String|Array} path The path within the target, to fetch in dotted or array notation
|
|
72
|
-
* @returns {Boolean} True if the given path already exists within the subject
|
|
73
|
-
*/
|
|
74
|
-
export function has(target, path) {
|
|
75
|
-
return _has(target, path);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Internal recursive path merger
|
|
79
|
-
*
|
|
80
|
-
* @param {Object} target The target to operate on, this is likly to be mutated
|
|
81
|
-
* @param {String|Array} path The path within the target to merge, in dotted or array notation
|
|
82
|
-
* @param {*} value The value to merge
|
|
83
|
-
*
|
|
84
|
-
* @returns {*} The merged value
|
|
85
|
-
*/
|
|
86
|
-
export function merge(target, path, value) {
|
|
87
|
-
_merge(get(target, path), value);
|
|
88
|
-
return value;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Internal recursive path defaulter
|
|
92
|
-
*
|
|
93
|
-
* @param {Object} target The target to operate on, this is likly to be mutated
|
|
94
|
-
* @param {String|Array} [path] The path within the target to merge, in dotted or array notation
|
|
95
|
-
* @param {*} value The value to merge
|
|
96
|
-
*
|
|
97
|
-
* @returns {*} The resulting object with defaults applied
|
|
98
|
-
*/
|
|
99
|
-
export function defaults(target, path, value) {
|
|
100
|
-
if (typeof path == 'string' || Array.isArray(path)) { // Called as (target, path, value)
|
|
101
|
-
if (!has(target, path)) { // Target path doesn't exist at all
|
|
102
|
-
return set(target, path, value);
|
|
103
|
-
}
|
|
104
|
-
else { // Target path exists - apply Lodash defaults
|
|
105
|
-
return _defaults(get(target, path), value);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else { // Called as (target, value)
|
|
109
|
-
return _defaults(target, path);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// Export all functions as a lookup object
|
|
113
|
-
export default {
|
|
114
|
-
set,
|
|
115
|
-
get,
|
|
116
|
-
has,
|
|
117
|
-
merge,
|
|
118
|
-
defaults,
|
|
119
|
-
};
|
|
120
|
-
//# sourceMappingURL=pathTools.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pathTools.js","sourceRoot":"","sources":["../../utils/pathTools.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,IAAI,SAAS,EACzB,GAAG,IAAI,IAAI,EACX,GAAG,IAAI,IAAI,EACX,KAAK,IAAI,MAAM,EACf,GAAG,IAAI,IAAI,GACX,MAAM,WAAW,CAAC;AAGnB;;;;;;;EAOE;AAGF;;;;;;;;;;;;;;;EAeE;AACF,MAAM,UAAU,GAAG,CAAC,MAAW,EAAE,IAAkC,EAAE,KAAU,EAAE,OAAa;IAC7F,MAAM,QAAQ,GAAG;QAChB,QAAQ,EAAE,WAAW;QACrB,GAAG,OAAO;KACV,CAAC;IAEF,wDAAwD;IACxD,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACzE,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;QACnB,CAAC,CAAC,SAAS,CAAC;IAEb,QAAQ,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC3B,KAAK,KAAK,CAAC;QACX,KAAK,WAAW;YACf,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC1B,MAAM;QACP,KAAK,OAAO;YACX,IAAI,gBAAgB,EAAE,CAAC;gBACtB,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC3B,CAAC;YACD,MAAM;QACP,KAAK,UAAU;YACd,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC9B,MAAM;QACP;YACC,MAAM,IAAI,KAAK,CAAC,yCAAyC,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAC;IACjF,CAAC;IAGD,OAAO,KAAK,CAAC;AACd,CAAC;AAGD;;;;;;;EAOE;AACF,MAAM,UAAU,GAAG,CAAC,MAAW,EAAE,IAAkC,EAAE,QAAc;IAClF,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AACrC,CAAC;AAKD;;;;;;EAME;AACF,MAAM,UAAU,GAAG,CAAC,MAAW,EAAE,IAAkC;IAClE,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC;AAGD;;;;;;;;EAQE;AACF,MAAM,UAAU,KAAK,CAAC,MAAW,EAAE,IAAkC,EAAE,KAAU;IAChF,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC;AACd,CAAC;AAGD;;;;;;;;EAQE;AACF,MAAM,UAAU,QAAQ,CAAC,MAAW,EAAE,IAAkC,EAAE,KAAW;IACpF,IAAI,OAAO,IAAI,IAAI,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,kCAAkC;QACvF,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,mCAAmC;YAC5D,OAAO,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC,CAAC,6CAA6C;YACrD,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;IACF,CAAC;SAAM,CAAC,CAAC,4BAA4B;QACpC,OAAO,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC;AACF,CAAC;AAGD,0CAA0C;AAC1C,eAAe;IACd,GAAG;IACH,GAAG;IACH,GAAG;IACH,KAAK;IACL,QAAQ;CACR,CAAC"}
|
package/tsconfig.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"rootDir": "./",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"paths": {
|
|
16
|
-
"#terafy": ["./lib/terafy.client.ts"],
|
|
17
|
-
"#utils/*": ["./utils/*.ts"]
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"include": [
|
|
21
|
-
"lib/**/*.ts",
|
|
22
|
-
"plugins/**/*.ts",
|
|
23
|
-
"utils/**/*.ts",
|
|
24
|
-
"widgets/**/*.ts"
|
|
25
|
-
],
|
|
26
|
-
"exclude": [
|
|
27
|
-
"node_modules",
|
|
28
|
-
"dist"
|
|
29
|
-
]
|
|
30
|
-
}
|
package/utils/mixin.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shallow-copy a object instance and inject new properties into the result
|
|
3
|
-
*
|
|
4
|
-
* Rather ugly shallow-copy-of instance hack from https://stackoverflow.com/a/44782052/1295040
|
|
5
|
-
* Keeps the original object instance and overrides the given object of assignments
|
|
6
|
-
*
|
|
7
|
-
* @param {Object} instance Original object class instance to mixin
|
|
8
|
-
* @param {Object} assignments Additional object properties to mix
|
|
9
|
-
* @returns {Object} A shallow copy of the input instance extended with the assignments
|
|
10
|
-
*/
|
|
11
|
-
export default function mixin(instance: any, assignments: any) {
|
|
12
|
-
const output = Object.assign(
|
|
13
|
-
Object.create(Object.getPrototypeOf(instance)),
|
|
14
|
-
instance,
|
|
15
|
-
assignments,
|
|
16
|
-
);
|
|
17
|
-
return output;
|
|
18
|
-
}
|
package/utils/pDefer.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
|
2
|
-
/**
|
|
3
|
-
* Returns a defer object which represents a promise object which can resolve in the future - but without enclosing a function
|
|
4
|
-
* The defer object has the keys {promise, resolve(), reject()}
|
|
5
|
-
* @returns {Defer} A defered promise
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
interface Defer {
|
|
9
|
-
promise: Promise<unknown>;
|
|
10
|
-
resolve: (value?: unknown) => void;
|
|
11
|
-
reject: (reason?: any) => void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Default export
|
|
16
|
-
* @returns Deferred promise
|
|
17
|
-
*/
|
|
18
|
-
export default function(): Defer {
|
|
19
|
-
const deferred = {} as Defer;
|
|
20
|
-
|
|
21
|
-
deferred.promise = new Promise((resolve, reject) => {
|
|
22
|
-
deferred.resolve = resolve;
|
|
23
|
-
deferred.reject = reject;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return deferred;
|
|
27
|
-
}
|