@sylphx/lens-server 2.3.1 → 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.
- package/dist/index.js +10 -1
- package/package.json +1 -1
- package/src/server/create.ts +12 -1
package/dist/index.js
CHANGED
|
@@ -313,8 +313,17 @@ class LensServerImpl {
|
|
|
313
313
|
}
|
|
314
314
|
this.queries = queries;
|
|
315
315
|
this.mutations = mutations;
|
|
316
|
-
this.entities = config.entities ?? {};
|
|
317
316
|
this.resolverMap = config.resolvers ? toResolverMap(config.resolvers) : undefined;
|
|
317
|
+
const entities = { ...config.entities ?? {} };
|
|
318
|
+
if (config.resolvers) {
|
|
319
|
+
for (const resolver of config.resolvers) {
|
|
320
|
+
const entityName = resolver.entity._name;
|
|
321
|
+
if (entityName && !entities[entityName]) {
|
|
322
|
+
entities[entityName] = resolver.entity;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
this.entities = entities;
|
|
318
327
|
this.contextFactory = config.context ?? (() => ({}));
|
|
319
328
|
this.version = config.version ?? "1.0.0";
|
|
320
329
|
this.logger = config.logger ?? noopLogger;
|
package/package.json
CHANGED
package/src/server/create.ts
CHANGED
|
@@ -136,8 +136,19 @@ class LensServerImpl<
|
|
|
136
136
|
|
|
137
137
|
this.queries = queries as Q;
|
|
138
138
|
this.mutations = mutations as M;
|
|
139
|
-
this.entities = config.entities ?? {};
|
|
140
139
|
this.resolverMap = config.resolvers ? toResolverMap(config.resolvers) : undefined;
|
|
140
|
+
|
|
141
|
+
// Build entities map: explicit config + auto-extracted from resolvers
|
|
142
|
+
const entities: EntitiesMap = { ...(config.entities ?? {}) };
|
|
143
|
+
if (config.resolvers) {
|
|
144
|
+
for (const resolver of config.resolvers) {
|
|
145
|
+
const entityName = resolver.entity._name;
|
|
146
|
+
if (entityName && !entities[entityName]) {
|
|
147
|
+
entities[entityName] = resolver.entity;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
this.entities = entities;
|
|
141
152
|
this.contextFactory = config.context ?? (() => ({}) as TContext);
|
|
142
153
|
this.version = config.version ?? "1.0.0";
|
|
143
154
|
this.logger = config.logger ?? noopLogger;
|