@rebasepro/server-mongo 0.9.1-canary.ff338b5 → 0.10.0
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/auth/services.d.ts +43 -43
- package/dist/auth/services.d.ts.map +1 -1
- package/dist/index.es.js +97 -97
- package/dist/index.es.js.map +1 -1
- package/dist/services/MongoRealtimeService.d.ts +5 -5
- package/dist/services/MongoRealtimeService.d.ts.map +1 -1
- package/dist/{websocket-DQlwCHFq.js → websocket-CoKu1mvm.js} +4 -4
- package/dist/websocket-CoKu1mvm.js.map +1 -0
- package/package.json +5 -5
- package/src/auth/services.ts +92 -92
- package/src/services/MongoDriver.ts +2 -2
- package/src/services/MongoRealtimeService.ts +10 -10
- package/src/websocket.ts +3 -3
- package/dist/websocket-DQlwCHFq.js.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -488,7 +488,7 @@ var MongoRealtimeService = class {
|
|
|
488
488
|
const registryCollection = this.driver?.registry?.getCollectionByPath(config.path);
|
|
489
489
|
if (config.authContext && this.driver) {
|
|
490
490
|
const mockUser = {
|
|
491
|
-
uid: config.authContext.
|
|
491
|
+
uid: config.authContext.uid,
|
|
492
492
|
roles: config.authContext.roles
|
|
493
493
|
};
|
|
494
494
|
rows = await (await this.driver.withAuth(mockUser)).fetchCollection({
|
|
@@ -571,7 +571,7 @@ var MongoRealtimeService = class {
|
|
|
571
571
|
const registryCollection = this.driver?.registry?.getCollectionByPath(config.path);
|
|
572
572
|
if (config.authContext && this.driver) {
|
|
573
573
|
const mockUser = {
|
|
574
|
-
uid: config.authContext.
|
|
574
|
+
uid: config.authContext.uid,
|
|
575
575
|
roles: config.authContext.roles
|
|
576
576
|
};
|
|
577
577
|
row = await (await this.driver.withAuth(mockUser)).fetchOne({
|
|
@@ -651,7 +651,7 @@ var MongoRealtimeService = class {
|
|
|
651
651
|
const ws = this.clients.get(clientId);
|
|
652
652
|
if (!ws) return;
|
|
653
653
|
const authContext = _authContext ? {
|
|
654
|
-
|
|
654
|
+
uid: _authContext.uid,
|
|
655
655
|
roles: (_authContext.roles ?? []).map(String)
|
|
656
656
|
} : void 0;
|
|
657
657
|
switch (message.type) {
|
|
@@ -1357,7 +1357,7 @@ var AuthenticatedMongoDriver = class {
|
|
|
1357
1357
|
listenCollection(props) {
|
|
1358
1358
|
const unsubscribe = this.delegate.listenCollection(props);
|
|
1359
1359
|
const authContext = {
|
|
1360
|
-
|
|
1360
|
+
uid: this.user.uid,
|
|
1361
1361
|
roles: this.user.roles ?? []
|
|
1362
1362
|
};
|
|
1363
1363
|
const subscriptions = this.delegate.getRealtimeService().getSubscriptions();
|
|
@@ -1376,7 +1376,7 @@ var AuthenticatedMongoDriver = class {
|
|
|
1376
1376
|
listenOne(props) {
|
|
1377
1377
|
const unsubscribe = this.delegate.listenOne(props);
|
|
1378
1378
|
const authContext = {
|
|
1379
|
-
|
|
1379
|
+
uid: this.user.uid,
|
|
1380
1380
|
roles: this.user.roles ?? []
|
|
1381
1381
|
};
|
|
1382
1382
|
const subscriptions = this.delegate.getRealtimeService().getSubscriptions();
|
|
@@ -1852,12 +1852,12 @@ var MongoUserService = class {
|
|
|
1852
1852
|
providerId
|
|
1853
1853
|
});
|
|
1854
1854
|
if (!identity) return null;
|
|
1855
|
-
return this.getUserById(identity.
|
|
1855
|
+
return this.getUserById(identity.uid);
|
|
1856
1856
|
}
|
|
1857
|
-
async getUserIdentities(
|
|
1858
|
-
return (await this.identitiesCollection.find({
|
|
1857
|
+
async getUserIdentities(uid) {
|
|
1858
|
+
return (await this.identitiesCollection.find({ uid }).toArray()).map((doc) => ({
|
|
1859
1859
|
id: doc.id,
|
|
1860
|
-
|
|
1860
|
+
uid: doc.uid,
|
|
1861
1861
|
provider: doc.provider,
|
|
1862
1862
|
providerId: doc.providerId,
|
|
1863
1863
|
profileData: doc.profileData ?? null,
|
|
@@ -1865,7 +1865,7 @@ var MongoUserService = class {
|
|
|
1865
1865
|
updatedAt: new Date(doc.updatedAt)
|
|
1866
1866
|
}));
|
|
1867
1867
|
}
|
|
1868
|
-
async linkUserIdentity(
|
|
1868
|
+
async linkUserIdentity(uid, provider, providerId, profileData) {
|
|
1869
1869
|
const now = /* @__PURE__ */ new Date();
|
|
1870
1870
|
await this.identitiesCollection.updateOne({
|
|
1871
1871
|
provider,
|
|
@@ -1874,7 +1874,7 @@ var MongoUserService = class {
|
|
|
1874
1874
|
$setOnInsert: {
|
|
1875
1875
|
_id: new ObjectId().toString(),
|
|
1876
1876
|
id: new ObjectId().toString(),
|
|
1877
|
-
|
|
1877
|
+
uid,
|
|
1878
1878
|
provider,
|
|
1879
1879
|
providerId,
|
|
1880
1880
|
createdAt: now
|
|
@@ -1896,8 +1896,8 @@ var MongoUserService = class {
|
|
|
1896
1896
|
}
|
|
1897
1897
|
async deleteUser(id) {
|
|
1898
1898
|
await this.collection.deleteOne({ id });
|
|
1899
|
-
await this.identitiesCollection.deleteMany({
|
|
1900
|
-
await this.userRolesCollection.deleteMany({
|
|
1899
|
+
await this.identitiesCollection.deleteMany({ uid: id });
|
|
1900
|
+
await this.userRolesCollection.deleteMany({ uid: id });
|
|
1901
1901
|
}
|
|
1902
1902
|
async listUsers() {
|
|
1903
1903
|
return (await this.collection.find().toArray()).map(toUser);
|
|
@@ -1920,7 +1920,7 @@ var MongoUserService = class {
|
|
|
1920
1920
|
$options: "i"
|
|
1921
1921
|
} }];
|
|
1922
1922
|
}
|
|
1923
|
-
if (roleId) query.id = { $in: (await this.userRolesCollection.find({ roleId }).toArray()).map((ur) => ur.
|
|
1923
|
+
if (roleId) query.id = { $in: (await this.userRolesCollection.find({ roleId }).toArray()).map((ur) => ur.uid) };
|
|
1924
1924
|
const sort = {};
|
|
1925
1925
|
sort[orderBy] = orderDir === "asc" ? 1 : -1;
|
|
1926
1926
|
const total = await this.collection.countDocuments(query);
|
|
@@ -1955,8 +1955,8 @@ var MongoUserService = class {
|
|
|
1955
1955
|
const doc = await this.collection.findOne({ emailVerificationToken: token });
|
|
1956
1956
|
return doc ? toUser(doc) : null;
|
|
1957
1957
|
}
|
|
1958
|
-
async getUserRoles(
|
|
1959
|
-
const roleIds = (await this.userRolesCollection.find({
|
|
1958
|
+
async getUserRoles(uid) {
|
|
1959
|
+
const roleIds = (await this.userRolesCollection.find({ uid }).toArray()).map((ur) => ur.roleId);
|
|
1960
1960
|
if (roleIds.length === 0) return [];
|
|
1961
1961
|
return (await this.rolesCollection.find({ id: { $in: roleIds } }).toArray()).map((r) => ({
|
|
1962
1962
|
id: r.id,
|
|
@@ -1966,36 +1966,36 @@ var MongoUserService = class {
|
|
|
1966
1966
|
collectionPermissions: r.collectionPermissions ?? null
|
|
1967
1967
|
}));
|
|
1968
1968
|
}
|
|
1969
|
-
async getUserRoleIds(
|
|
1970
|
-
return (await this.userRolesCollection.find({
|
|
1969
|
+
async getUserRoleIds(uid) {
|
|
1970
|
+
return (await this.userRolesCollection.find({ uid }).toArray()).map((ur) => ur.roleId);
|
|
1971
1971
|
}
|
|
1972
|
-
async setUserRoles(
|
|
1973
|
-
await this.userRolesCollection.deleteMany({
|
|
1972
|
+
async setUserRoles(uid, roleIds) {
|
|
1973
|
+
await this.userRolesCollection.deleteMany({ uid });
|
|
1974
1974
|
if (roleIds.length > 0) {
|
|
1975
1975
|
const docs = roleIds.map((roleId) => ({
|
|
1976
1976
|
_id: new ObjectId().toString(),
|
|
1977
|
-
|
|
1977
|
+
uid,
|
|
1978
1978
|
roleId
|
|
1979
1979
|
}));
|
|
1980
1980
|
await this.userRolesCollection.insertMany(docs);
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
1983
|
-
async assignDefaultRole(
|
|
1983
|
+
async assignDefaultRole(uid, roleId) {
|
|
1984
1984
|
await this.userRolesCollection.updateOne({
|
|
1985
|
-
|
|
1985
|
+
uid,
|
|
1986
1986
|
roleId
|
|
1987
1987
|
}, { $setOnInsert: {
|
|
1988
1988
|
_id: new ObjectId().toString(),
|
|
1989
|
-
|
|
1989
|
+
uid,
|
|
1990
1990
|
roleId
|
|
1991
1991
|
} }, { upsert: true });
|
|
1992
1992
|
}
|
|
1993
|
-
async getUserWithRoles(
|
|
1994
|
-
const user = await this.getUserById(
|
|
1993
|
+
async getUserWithRoles(uid) {
|
|
1994
|
+
const user = await this.getUserById(uid);
|
|
1995
1995
|
if (!user) return null;
|
|
1996
1996
|
return {
|
|
1997
1997
|
user,
|
|
1998
|
-
roles: await this.getUserRoles(
|
|
1998
|
+
roles: await this.getUserRoles(uid)
|
|
1999
1999
|
};
|
|
2000
2000
|
}
|
|
2001
2001
|
};
|
|
@@ -2056,18 +2056,18 @@ var MongoRefreshTokenService = class {
|
|
|
2056
2056
|
get collection() {
|
|
2057
2057
|
return this.db.collection("rebase_refresh_tokens");
|
|
2058
2058
|
}
|
|
2059
|
-
async createToken(
|
|
2059
|
+
async createToken(uid, tokenHash, expiresAt, userAgent, ipAddress) {
|
|
2060
2060
|
const safeUserAgent = userAgent || "";
|
|
2061
2061
|
const safeIpAddress = ipAddress || "";
|
|
2062
2062
|
await this.collection.deleteMany({
|
|
2063
|
-
|
|
2063
|
+
uid,
|
|
2064
2064
|
userAgent: safeUserAgent,
|
|
2065
2065
|
ipAddress: safeIpAddress
|
|
2066
2066
|
});
|
|
2067
2067
|
await this.collection.insertOne({
|
|
2068
2068
|
_id: new ObjectId().toString(),
|
|
2069
2069
|
id: new ObjectId().toString(),
|
|
2070
|
-
|
|
2070
|
+
uid,
|
|
2071
2071
|
tokenHash,
|
|
2072
2072
|
expiresAt,
|
|
2073
2073
|
createdAt: /* @__PURE__ */ new Date(),
|
|
@@ -2080,7 +2080,7 @@ var MongoRefreshTokenService = class {
|
|
|
2080
2080
|
if (!doc) return null;
|
|
2081
2081
|
return {
|
|
2082
2082
|
id: doc.id,
|
|
2083
|
-
|
|
2083
|
+
uid: doc.uid,
|
|
2084
2084
|
tokenHash: doc.tokenHash,
|
|
2085
2085
|
expiresAt: new Date(doc.expiresAt),
|
|
2086
2086
|
createdAt: new Date(doc.createdAt),
|
|
@@ -2091,13 +2091,13 @@ var MongoRefreshTokenService = class {
|
|
|
2091
2091
|
async deleteByHash(tokenHash) {
|
|
2092
2092
|
await this.collection.deleteOne({ tokenHash });
|
|
2093
2093
|
}
|
|
2094
|
-
async deleteAllForUser(
|
|
2095
|
-
await this.collection.deleteMany({
|
|
2094
|
+
async deleteAllForUser(uid) {
|
|
2095
|
+
await this.collection.deleteMany({ uid });
|
|
2096
2096
|
}
|
|
2097
|
-
async listForUser(
|
|
2098
|
-
return (await this.collection.find({
|
|
2097
|
+
async listForUser(uid) {
|
|
2098
|
+
return (await this.collection.find({ uid }).sort({ createdAt: 1 }).toArray()).map((doc) => ({
|
|
2099
2099
|
id: doc.id,
|
|
2100
|
-
|
|
2100
|
+
uid: doc.uid,
|
|
2101
2101
|
tokenHash: doc.tokenHash,
|
|
2102
2102
|
expiresAt: new Date(doc.expiresAt),
|
|
2103
2103
|
createdAt: new Date(doc.createdAt),
|
|
@@ -2105,10 +2105,10 @@ var MongoRefreshTokenService = class {
|
|
|
2105
2105
|
ipAddress: doc.ipAddress
|
|
2106
2106
|
}));
|
|
2107
2107
|
}
|
|
2108
|
-
async deleteById(id,
|
|
2108
|
+
async deleteById(id, uid) {
|
|
2109
2109
|
await this.collection.deleteOne({
|
|
2110
2110
|
id,
|
|
2111
|
-
|
|
2111
|
+
uid
|
|
2112
2112
|
});
|
|
2113
2113
|
}
|
|
2114
2114
|
};
|
|
@@ -2120,14 +2120,14 @@ var MongoPasswordResetTokenService = class {
|
|
|
2120
2120
|
get collection() {
|
|
2121
2121
|
return this.db.collection("rebase_password_reset_tokens");
|
|
2122
2122
|
}
|
|
2123
|
-
async createToken(
|
|
2123
|
+
async createToken(uid, tokenHash, expiresAt) {
|
|
2124
2124
|
await this.collection.deleteMany({
|
|
2125
|
-
|
|
2125
|
+
uid,
|
|
2126
2126
|
usedAt: null
|
|
2127
2127
|
});
|
|
2128
2128
|
await this.collection.insertOne({
|
|
2129
2129
|
_id: new ObjectId().toString(),
|
|
2130
|
-
|
|
2130
|
+
uid,
|
|
2131
2131
|
tokenHash,
|
|
2132
2132
|
expiresAt,
|
|
2133
2133
|
usedAt: null
|
|
@@ -2141,15 +2141,15 @@ var MongoPasswordResetTokenService = class {
|
|
|
2141
2141
|
});
|
|
2142
2142
|
if (!doc) return null;
|
|
2143
2143
|
return {
|
|
2144
|
-
|
|
2144
|
+
uid: doc.uid,
|
|
2145
2145
|
expiresAt: new Date(doc.expiresAt)
|
|
2146
2146
|
};
|
|
2147
2147
|
}
|
|
2148
2148
|
async markAsUsed(tokenHash) {
|
|
2149
2149
|
await this.collection.updateOne({ tokenHash }, { $set: { usedAt: /* @__PURE__ */ new Date() } });
|
|
2150
2150
|
}
|
|
2151
|
-
async deleteAllForUser(
|
|
2152
|
-
await this.collection.deleteMany({
|
|
2151
|
+
async deleteAllForUser(uid) {
|
|
2152
|
+
await this.collection.deleteMany({ uid });
|
|
2153
2153
|
}
|
|
2154
2154
|
async deleteExpired() {
|
|
2155
2155
|
await this.collection.deleteMany({ expiresAt: { $lt: /* @__PURE__ */ new Date() } });
|
|
@@ -2164,8 +2164,8 @@ var MongoTokenRepository = class {
|
|
|
2164
2164
|
this.refreshTokenService = new MongoRefreshTokenService(db);
|
|
2165
2165
|
this.passwordResetTokenService = new MongoPasswordResetTokenService(db);
|
|
2166
2166
|
}
|
|
2167
|
-
async createRefreshToken(
|
|
2168
|
-
await this.refreshTokenService.createToken(
|
|
2167
|
+
async createRefreshToken(uid, tokenHash, expiresAt, userAgent, ipAddress) {
|
|
2168
|
+
await this.refreshTokenService.createToken(uid, tokenHash, expiresAt, userAgent, ipAddress);
|
|
2169
2169
|
}
|
|
2170
2170
|
async findRefreshTokenByHash(tokenHash) {
|
|
2171
2171
|
return this.refreshTokenService.findByHash(tokenHash);
|
|
@@ -2173,17 +2173,17 @@ var MongoTokenRepository = class {
|
|
|
2173
2173
|
async deleteRefreshToken(tokenHash) {
|
|
2174
2174
|
await this.refreshTokenService.deleteByHash(tokenHash);
|
|
2175
2175
|
}
|
|
2176
|
-
async deleteAllRefreshTokensForUser(
|
|
2177
|
-
await this.refreshTokenService.deleteAllForUser(
|
|
2176
|
+
async deleteAllRefreshTokensForUser(uid) {
|
|
2177
|
+
await this.refreshTokenService.deleteAllForUser(uid);
|
|
2178
2178
|
}
|
|
2179
|
-
async listRefreshTokensForUser(
|
|
2180
|
-
return this.refreshTokenService.listForUser(
|
|
2179
|
+
async listRefreshTokensForUser(uid) {
|
|
2180
|
+
return this.refreshTokenService.listForUser(uid);
|
|
2181
2181
|
}
|
|
2182
|
-
async deleteRefreshTokenById(id,
|
|
2183
|
-
await this.refreshTokenService.deleteById(id,
|
|
2182
|
+
async deleteRefreshTokenById(id, uid) {
|
|
2183
|
+
await this.refreshTokenService.deleteById(id, uid);
|
|
2184
2184
|
}
|
|
2185
|
-
async createPasswordResetToken(
|
|
2186
|
-
await this.passwordResetTokenService.createToken(
|
|
2185
|
+
async createPasswordResetToken(uid, tokenHash, expiresAt) {
|
|
2186
|
+
await this.passwordResetTokenService.createToken(uid, tokenHash, expiresAt);
|
|
2187
2187
|
}
|
|
2188
2188
|
async findValidPasswordResetToken(tokenHash) {
|
|
2189
2189
|
return this.passwordResetTokenService.findValidByHash(tokenHash);
|
|
@@ -2191,20 +2191,20 @@ var MongoTokenRepository = class {
|
|
|
2191
2191
|
async markPasswordResetTokenUsed(tokenHash) {
|
|
2192
2192
|
await this.passwordResetTokenService.markAsUsed(tokenHash);
|
|
2193
2193
|
}
|
|
2194
|
-
async deleteAllPasswordResetTokensForUser(
|
|
2195
|
-
await this.passwordResetTokenService.deleteAllForUser(
|
|
2194
|
+
async deleteAllPasswordResetTokensForUser(uid) {
|
|
2195
|
+
await this.passwordResetTokenService.deleteAllForUser(uid);
|
|
2196
2196
|
}
|
|
2197
2197
|
async deleteExpiredTokens() {
|
|
2198
2198
|
await this.passwordResetTokenService.deleteExpired();
|
|
2199
2199
|
}
|
|
2200
|
-
async createMagicLinkToken(
|
|
2200
|
+
async createMagicLinkToken(uid, tokenHash, expiresAt) {
|
|
2201
2201
|
const col = this.db.collection("magic_link_tokens");
|
|
2202
2202
|
await col.deleteMany({
|
|
2203
|
-
|
|
2203
|
+
uid,
|
|
2204
2204
|
usedAt: null
|
|
2205
2205
|
});
|
|
2206
2206
|
await col.insertOne({
|
|
2207
|
-
|
|
2207
|
+
uid,
|
|
2208
2208
|
tokenHash,
|
|
2209
2209
|
expiresAt,
|
|
2210
2210
|
usedAt: null,
|
|
@@ -2219,7 +2219,7 @@ var MongoTokenRepository = class {
|
|
|
2219
2219
|
});
|
|
2220
2220
|
if (!doc) return null;
|
|
2221
2221
|
return {
|
|
2222
|
-
|
|
2222
|
+
uid: doc.uid,
|
|
2223
2223
|
expiresAt: doc.expiresAt
|
|
2224
2224
|
};
|
|
2225
2225
|
}
|
|
@@ -2250,11 +2250,11 @@ var MongoAuthRepository = class {
|
|
|
2250
2250
|
async getUserByIdentity(provider, providerId) {
|
|
2251
2251
|
return this.userService.getUserByIdentity(provider, providerId);
|
|
2252
2252
|
}
|
|
2253
|
-
async getUserIdentities(
|
|
2254
|
-
return this.userService.getUserIdentities(
|
|
2253
|
+
async getUserIdentities(uid) {
|
|
2254
|
+
return this.userService.getUserIdentities(uid);
|
|
2255
2255
|
}
|
|
2256
|
-
async linkUserIdentity(
|
|
2257
|
-
return this.userService.linkUserIdentity(
|
|
2256
|
+
async linkUserIdentity(uid, provider, providerId, profileData) {
|
|
2257
|
+
return this.userService.linkUserIdentity(uid, provider, providerId, profileData);
|
|
2258
2258
|
}
|
|
2259
2259
|
async updateUser(id, data) {
|
|
2260
2260
|
return this.userService.updateUser(id, data);
|
|
@@ -2280,20 +2280,20 @@ var MongoAuthRepository = class {
|
|
|
2280
2280
|
async getUserByVerificationToken(token) {
|
|
2281
2281
|
return this.userService.getUserByVerificationToken(token);
|
|
2282
2282
|
}
|
|
2283
|
-
async getUserRoles(
|
|
2284
|
-
return this.userService.getUserRoles(
|
|
2283
|
+
async getUserRoles(uid) {
|
|
2284
|
+
return this.userService.getUserRoles(uid);
|
|
2285
2285
|
}
|
|
2286
|
-
async getUserRoleIds(
|
|
2287
|
-
return this.userService.getUserRoleIds(
|
|
2286
|
+
async getUserRoleIds(uid) {
|
|
2287
|
+
return this.userService.getUserRoleIds(uid);
|
|
2288
2288
|
}
|
|
2289
|
-
async setUserRoles(
|
|
2290
|
-
await this.userService.setUserRoles(
|
|
2289
|
+
async setUserRoles(uid, roleIds) {
|
|
2290
|
+
await this.userService.setUserRoles(uid, roleIds);
|
|
2291
2291
|
}
|
|
2292
|
-
async assignDefaultRole(
|
|
2293
|
-
await this.userService.assignDefaultRole(
|
|
2292
|
+
async assignDefaultRole(uid, roleId) {
|
|
2293
|
+
await this.userService.assignDefaultRole(uid, roleId);
|
|
2294
2294
|
}
|
|
2295
|
-
async getUserWithRoles(
|
|
2296
|
-
return this.userService.getUserWithRoles(
|
|
2295
|
+
async getUserWithRoles(uid) {
|
|
2296
|
+
return this.userService.getUserWithRoles(uid);
|
|
2297
2297
|
}
|
|
2298
2298
|
async getRoleById(id) {
|
|
2299
2299
|
return this.roleService.getRoleById(id);
|
|
@@ -2310,8 +2310,8 @@ var MongoAuthRepository = class {
|
|
|
2310
2310
|
async deleteRole(id) {
|
|
2311
2311
|
await this.roleService.deleteRole(id);
|
|
2312
2312
|
}
|
|
2313
|
-
async createRefreshToken(
|
|
2314
|
-
await this.tokenRepository.createRefreshToken(
|
|
2313
|
+
async createRefreshToken(uid, tokenHash, expiresAt, userAgent, ipAddress) {
|
|
2314
|
+
await this.tokenRepository.createRefreshToken(uid, tokenHash, expiresAt, userAgent, ipAddress);
|
|
2315
2315
|
}
|
|
2316
2316
|
async findRefreshTokenByHash(tokenHash) {
|
|
2317
2317
|
return this.tokenRepository.findRefreshTokenByHash(tokenHash);
|
|
@@ -2319,17 +2319,17 @@ var MongoAuthRepository = class {
|
|
|
2319
2319
|
async deleteRefreshToken(tokenHash) {
|
|
2320
2320
|
await this.tokenRepository.deleteRefreshToken(tokenHash);
|
|
2321
2321
|
}
|
|
2322
|
-
async deleteAllRefreshTokensForUser(
|
|
2323
|
-
await this.tokenRepository.deleteAllRefreshTokensForUser(
|
|
2322
|
+
async deleteAllRefreshTokensForUser(uid) {
|
|
2323
|
+
await this.tokenRepository.deleteAllRefreshTokensForUser(uid);
|
|
2324
2324
|
}
|
|
2325
|
-
async listRefreshTokensForUser(
|
|
2326
|
-
return this.tokenRepository.listRefreshTokensForUser(
|
|
2325
|
+
async listRefreshTokensForUser(uid) {
|
|
2326
|
+
return this.tokenRepository.listRefreshTokensForUser(uid);
|
|
2327
2327
|
}
|
|
2328
|
-
async deleteRefreshTokenById(id,
|
|
2329
|
-
await this.tokenRepository.deleteRefreshTokenById(id,
|
|
2328
|
+
async deleteRefreshTokenById(id, uid) {
|
|
2329
|
+
await this.tokenRepository.deleteRefreshTokenById(id, uid);
|
|
2330
2330
|
}
|
|
2331
|
-
async createPasswordResetToken(
|
|
2332
|
-
await this.tokenRepository.createPasswordResetToken(
|
|
2331
|
+
async createPasswordResetToken(uid, tokenHash, expiresAt) {
|
|
2332
|
+
await this.tokenRepository.createPasswordResetToken(uid, tokenHash, expiresAt);
|
|
2333
2333
|
}
|
|
2334
2334
|
async findValidPasswordResetToken(tokenHash) {
|
|
2335
2335
|
return this.tokenRepository.findValidPasswordResetToken(tokenHash);
|
|
@@ -2337,14 +2337,14 @@ var MongoAuthRepository = class {
|
|
|
2337
2337
|
async markPasswordResetTokenUsed(tokenHash) {
|
|
2338
2338
|
await this.tokenRepository.markPasswordResetTokenUsed(tokenHash);
|
|
2339
2339
|
}
|
|
2340
|
-
async deleteAllPasswordResetTokensForUser(
|
|
2341
|
-
await this.tokenRepository.deleteAllPasswordResetTokensForUser(
|
|
2340
|
+
async deleteAllPasswordResetTokensForUser(uid) {
|
|
2341
|
+
await this.tokenRepository.deleteAllPasswordResetTokensForUser(uid);
|
|
2342
2342
|
}
|
|
2343
2343
|
async deleteExpiredTokens() {
|
|
2344
2344
|
await this.tokenRepository.deleteExpiredTokens();
|
|
2345
2345
|
}
|
|
2346
|
-
async createMagicLinkToken(
|
|
2347
|
-
await this.tokenRepository.createMagicLinkToken(
|
|
2346
|
+
async createMagicLinkToken(uid, tokenHash, expiresAt) {
|
|
2347
|
+
await this.tokenRepository.createMagicLinkToken(uid, tokenHash, expiresAt);
|
|
2348
2348
|
}
|
|
2349
2349
|
async findValidMagicLinkToken(tokenHash) {
|
|
2350
2350
|
return this.tokenRepository.findValidMagicLinkToken(tokenHash);
|
|
@@ -2352,10 +2352,10 @@ var MongoAuthRepository = class {
|
|
|
2352
2352
|
async markMagicLinkTokenUsed(tokenHash) {
|
|
2353
2353
|
await this.tokenRepository.markMagicLinkTokenUsed(tokenHash);
|
|
2354
2354
|
}
|
|
2355
|
-
async createMfaFactor(
|
|
2355
|
+
async createMfaFactor(uid, factorType, secretEncrypted, friendlyName) {
|
|
2356
2356
|
throw new Error("MFA is not implemented for MongoDB");
|
|
2357
2357
|
}
|
|
2358
|
-
async getMfaFactors(
|
|
2358
|
+
async getMfaFactors(uid) {
|
|
2359
2359
|
return [];
|
|
2360
2360
|
}
|
|
2361
2361
|
async getMfaFactorById(factorId) {
|
|
@@ -2364,7 +2364,7 @@ var MongoAuthRepository = class {
|
|
|
2364
2364
|
async verifyMfaFactor(factorId) {
|
|
2365
2365
|
throw new Error("MFA is not implemented for MongoDB");
|
|
2366
2366
|
}
|
|
2367
|
-
async deleteMfaFactor(factorId,
|
|
2367
|
+
async deleteMfaFactor(factorId, uid) {
|
|
2368
2368
|
throw new Error("MFA is not implemented for MongoDB");
|
|
2369
2369
|
}
|
|
2370
2370
|
async createMfaChallenge(factorId, ipAddress) {
|
|
@@ -2376,17 +2376,17 @@ var MongoAuthRepository = class {
|
|
|
2376
2376
|
async verifyMfaChallenge(challengeId) {
|
|
2377
2377
|
throw new Error("MFA is not implemented for MongoDB");
|
|
2378
2378
|
}
|
|
2379
|
-
async createRecoveryCodes(
|
|
2379
|
+
async createRecoveryCodes(uid, codeHashes) {
|
|
2380
2380
|
throw new Error("MFA is not implemented for MongoDB");
|
|
2381
2381
|
}
|
|
2382
|
-
async useRecoveryCode(
|
|
2382
|
+
async useRecoveryCode(uid, codeHash) {
|
|
2383
2383
|
return false;
|
|
2384
2384
|
}
|
|
2385
|
-
async getUnusedRecoveryCodeCount(
|
|
2385
|
+
async getUnusedRecoveryCodeCount(uid) {
|
|
2386
2386
|
return 0;
|
|
2387
2387
|
}
|
|
2388
|
-
async deleteAllRecoveryCodes(
|
|
2389
|
-
async hasVerifiedMfaFactors(
|
|
2388
|
+
async deleteAllRecoveryCodes(uid) {}
|
|
2389
|
+
async hasVerifiedMfaFactors(uid) {
|
|
2390
2390
|
return false;
|
|
2391
2391
|
}
|
|
2392
2392
|
};
|
|
@@ -2497,7 +2497,7 @@ function createMongoBootstrapper(mongoConfig) {
|
|
|
2497
2497
|
},
|
|
2498
2498
|
mountRoutes() {},
|
|
2499
2499
|
async initializeWebsockets(server, realtimeService, driver, config) {
|
|
2500
|
-
const { createMongoWebSocket } = await import("./websocket-
|
|
2500
|
+
const { createMongoWebSocket } = await import("./websocket-CoKu1mvm.js");
|
|
2501
2501
|
createMongoWebSocket(server, realtimeService, driver, config, cachedAdmin);
|
|
2502
2502
|
}
|
|
2503
2503
|
};
|