@singularsystems/neo-core 0.10.63 → 0.10.64
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/dist/Model/NeoTypeInfo.d.ts +1 -0
- package/dist/Model/NeoTypeInfo.js +13 -6
- package/dist/Utils.js +1 -2
- package/package.json +1 -1
|
@@ -34,6 +34,7 @@ export declare class NeoTypeInfo {
|
|
|
34
34
|
/** Copy the property info list from each base type into the current type. */
|
|
35
35
|
merge(baseConstructor: NeoModelConstructor): void;
|
|
36
36
|
ensureInitialised(): void;
|
|
37
|
+
createInstance(...args: any): any;
|
|
37
38
|
/** Gets the override constructor which can setup a neo model. */
|
|
38
39
|
getOverrideConstructor(): Function;
|
|
39
40
|
private createWrapperConstructor;
|
|
@@ -165,12 +165,19 @@ var NeoTypeInfo = /** @class */ (function () {
|
|
|
165
165
|
NeoTypeInfo.prototype.ensureInitialised = function () {
|
|
166
166
|
if (!this.modelCreator) {
|
|
167
167
|
// create a new instance which will cause the type to be setup.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
this.createInstance();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
NeoTypeInfo.prototype.createInstance = function () {
|
|
172
|
+
var args = [];
|
|
173
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
174
|
+
args[_i] = arguments[_i];
|
|
175
|
+
}
|
|
176
|
+
if (this.wrapperConstructor) {
|
|
177
|
+
return this.wrapperConstructor(args);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
return new this.objectConstructor(args);
|
|
174
181
|
}
|
|
175
182
|
};
|
|
176
183
|
/** Gets the override constructor which can setup a neo model. */
|
package/dist/Utils.js
CHANGED
|
@@ -71,13 +71,12 @@ var Utils = /** @class */ (function () {
|
|
|
71
71
|
* @param args Constructor args.
|
|
72
72
|
*/
|
|
73
73
|
Utils.createInstance = function (type) {
|
|
74
|
-
var _a;
|
|
75
74
|
var args = [];
|
|
76
75
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
77
76
|
args[_i - 1] = arguments[_i];
|
|
78
77
|
}
|
|
79
78
|
if (type.prototype.constructor.neo) {
|
|
80
|
-
return
|
|
79
|
+
return type.prototype.constructor.neo.createInstance(args);
|
|
81
80
|
}
|
|
82
81
|
else {
|
|
83
82
|
throw "Cannot instantiate '" + type.name + "' because it does not have an @NeoModel attribute.";
|