evogram-gramjs 1.0.2 → 1.0.3

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.
@@ -160,11 +160,10 @@ class SessionManager extends events_1.EventEmitter {
160
160
  getAllLoadedSessions() {
161
161
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
162
162
  const sessions = Array.from(this.sessions.values());
163
- const results = yield Promise.all(sessions.map((session) => tslib_1.__awaiter(this, void 0, void 0, function* () {
164
- //@ts-ignore
165
- ;
166
- [session.db, session.user] = [yield session.db().catch(() => null), yield session.user().catch(() => null)];
167
- return session;
163
+ const results = yield Promise.all(sessions
164
+ .filter((x) => x.sessionId)
165
+ .map((session) => tslib_1.__awaiter(this, void 0, void 0, function* () {
166
+ return Object.assign(Object.assign({}, session), { db: yield session.db().catch(() => null), user: yield session.user().catch(() => null) });
168
167
  })));
169
168
  //@ts-ignore
170
169
  return results;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evogram-gramjs",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "./lib/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -164,12 +164,17 @@ export class SessionManager extends EventEmitter {
164
164
 
165
165
  async getAllLoadedSessions(): Promise<({ db: SessionEntity | null; user: Api.User | null } & Omit<SessionInfo, 'db' | 'user'>)[]> {
166
166
  const sessions = Array.from(this.sessions.values())
167
+
167
168
  const results = await Promise.all(
168
- sessions.map(async (session) => {
169
- //@ts-ignore
170
- ;[session.db, session.user] = [await session.db().catch(() => null), await session.user().catch(() => null)]
171
- return session
172
- })
169
+ sessions
170
+ .filter((x) => x.sessionId)
171
+ .map(async (session) => {
172
+ return {
173
+ ...session,
174
+ db: await session.db().catch(() => null),
175
+ user: await session.user().catch(() => null),
176
+ }
177
+ })
173
178
  )
174
179
 
175
180
  //@ts-ignore