@eleven-am/pondsocket-nest 0.0.48 → 0.0.49
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 +1 -1
- package/services/pondSocket.js +12 -4
package/package.json
CHANGED
package/services/pondSocket.js
CHANGED
|
@@ -119,6 +119,7 @@ class PondSocketService {
|
|
|
119
119
|
}
|
|
120
120
|
getGroupedInstances() {
|
|
121
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
var _a;
|
|
122
123
|
const endpoints = yield this.discovery.providersWithMetaAtKey(constants_1.endpointKey);
|
|
123
124
|
const channels = yield this.discovery.providersWithMetaAtKey(constants_1.channelKey);
|
|
124
125
|
const modules = new Map();
|
|
@@ -149,13 +150,20 @@ class PondSocketService {
|
|
|
149
150
|
endpoint,
|
|
150
151
|
channels: instance.channels,
|
|
151
152
|
}))).flat();
|
|
152
|
-
const baseEndpoint = endpoints.
|
|
153
|
+
const baseEndpoint = endpoints.length === 1 ?
|
|
154
|
+
endpoints[0].discoveredClass :
|
|
155
|
+
(_a = endpoints
|
|
156
|
+
.find((endpoint) => endpoint.discoveredClass.parentModule.name === 'AppModule')) === null || _a === void 0 ? void 0 : _a.discoveredClass;
|
|
157
|
+
const groupedInstanceWithBaseEndpoint = groupedInstances.find((groupedInstance) => groupedInstance.endpoint.instance === (baseEndpoint === null || baseEndpoint === void 0 ? void 0 : baseEndpoint.instance));
|
|
153
158
|
if (channelsWithNoEndpoints.length > 0) {
|
|
154
|
-
if (
|
|
155
|
-
const
|
|
159
|
+
if (groupedInstanceWithBaseEndpoint) {
|
|
160
|
+
const channels = channelsWithNoEndpoints.map((instance) => instance.channels).flat();
|
|
161
|
+
groupedInstanceWithBaseEndpoint.channels = [...new Set([...groupedInstanceWithBaseEndpoint.channels, ...channels])];
|
|
162
|
+
}
|
|
163
|
+
else if (baseEndpoint) {
|
|
156
164
|
const channels = channelsWithNoEndpoints.map((instance) => instance.channels).flat();
|
|
157
165
|
groupedInstances.push({
|
|
158
|
-
endpoint:
|
|
166
|
+
endpoint: baseEndpoint,
|
|
159
167
|
channels,
|
|
160
168
|
});
|
|
161
169
|
}
|