@snowtop/ent 0.0.35 → 0.0.36
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.
|
@@ -32,7 +32,7 @@ export declare class AssocEdgeLoaderFactory<T extends AssocEdge> implements Load
|
|
|
32
32
|
name: string;
|
|
33
33
|
constructor(edgeType: string, edgeCtr: AssocEdgeConstructor<T> | (() => AssocEdgeConstructor<T>));
|
|
34
34
|
createLoader(context?: Context): AssocLoader<T>;
|
|
35
|
-
private
|
|
35
|
+
private isConstructor;
|
|
36
36
|
createConfigurableLoader(options: EdgeQueryableDataOptions, context?: Context): AssocLoader<T>;
|
|
37
37
|
}
|
|
38
38
|
export {};
|
|
@@ -161,16 +161,18 @@ class AssocEdgeLoaderFactory {
|
|
|
161
161
|
createLoader(context) {
|
|
162
162
|
return this.createConfigurableLoader({}, context);
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
isConstructor(edgeCtr) {
|
|
165
165
|
// not constructor
|
|
166
|
-
return
|
|
166
|
+
return (edgeCtr.prototype &&
|
|
167
|
+
edgeCtr.prototype.constructor &&
|
|
168
|
+
edgeCtr.prototype.constructor.name.length > 0);
|
|
167
169
|
}
|
|
168
170
|
createConfigurableLoader(options, context) {
|
|
169
171
|
let edgeCtr = this.edgeCtr;
|
|
170
172
|
// in generated code, the edge is not necessarily defined at the time of loading
|
|
171
173
|
// so we call this as follows:
|
|
172
174
|
// const loader = new AssocEdgeLoaderFactory(EdgeType.Foo, ()=>DerivedEdgeClass);
|
|
173
|
-
if (this.
|
|
175
|
+
if (!this.isConstructor(edgeCtr)) {
|
|
174
176
|
edgeCtr = edgeCtr();
|
|
175
177
|
}
|
|
176
178
|
// rename to make TS happy
|