@eleven-am/pondsocket-nest 0.0.26 → 0.0.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket-nest",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",
@@ -123,7 +123,7 @@ class PondSocketService {
123
123
  channels: [],
124
124
  });
125
125
  }
126
- modules.get(module).endpoints.push(endpoint.discoveredClass.instance);
126
+ modules.get(module).endpoints.push(endpoint.discoveredClass);
127
127
  });
128
128
  channels.forEach((channel) => {
129
129
  const module = channel.discoveredClass.parentModule.injectType;
@@ -133,23 +133,17 @@ class PondSocketService {
133
133
  channels: [],
134
134
  });
135
135
  }
136
- if (Array.isArray(channel.discoveredClass.instance)) {
137
- modules.get(module).channels.push(...channel.discoveredClass.instance);
138
- }
139
- else {
140
- modules.get(module).channels.push(channel.discoveredClass.instance);
141
- }
136
+ modules.get(module).channels.push(channel.discoveredClass);
142
137
  });
143
138
  const instances = [...modules.values()];
144
139
  const channelsWithNoEndpoints = instances.filter((instance) => instance.channels.length > 0 && instance.endpoints.length === 0);
145
140
  const channelsWithEndpoints = instances.filter((instance) => instance.channels.length > 0 && instance.endpoints.length > 0);
146
- const endpointsWithNoChannels = instances.filter((instance) => instance.endpoints.length > 0 && instance.channels.length === 0);
147
141
  const groupedInstances = channelsWithEndpoints.map((instance) => instance.endpoints.map((endpoint) => ({
148
142
  endpoint,
149
143
  channels: instance.channels,
150
144
  }))).flat();
151
145
  const baseEndpoint = endpoints.find((endpoint) => endpoint.discoveredClass.parentModule.name === 'AppModule');
152
- const baseEndpointInstance = groupedInstances.find((groupedInstance) => groupedInstance.endpoint.instance === (baseEndpoint === null || baseEndpoint === void 0 ? void 0 : baseEndpoint.discoveredClass.instance));
146
+ const baseEndpointInstance = groupedInstances.find((groupedInstance) => groupedInstance.endpoint.name === (baseEndpoint === null || baseEndpoint === void 0 ? void 0 : baseEndpoint.discoveredClass.name));
153
147
  if (channelsWithNoEndpoints.length > 0 && baseEndpointInstance) {
154
148
  const channels = channelsWithNoEndpoints.map((instance) => instance.channels).flat();
155
149
  groupedInstances.push({
@@ -157,15 +151,8 @@ class PondSocketService {
157
151
  channels,
158
152
  });
159
153
  }
160
- else if (channelsWithNoEndpoints.length > 0) {
161
- const endpoints = endpointsWithNoChannels.map((instance) => instance.endpoints).flat();
162
- const channels = channelsWithNoEndpoints.map((instance) => instance.channels).flat();
163
- endpoints.forEach((endpoint) => {
164
- groupedInstances.push({
165
- endpoint,
166
- channels,
167
- });
168
- });
154
+ else {
155
+ throw new Error('No base endpoint found');
169
156
  }
170
157
  return groupedInstances;
171
158
  });