@budibase/backend-core 2.10.12-alpha.2 → 2.10.12
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 +0 -38
- package/dist/index.js.map +2 -2
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +4 -4
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/cache/user.d.ts +0 -13
- package/dist/src/cache/user.js +1 -51
- package/dist/src/cache/user.js.map +1 -1
- package/dist/src/redis/redis.d.ts +1 -1
- package/dist/src/redis/redis.js.map +1 -1
- package/dist/tests/core/utilities/structures/shared.d.ts +3 -0
- package/dist/tests/core/utilities/structures/shared.js +14 -0
- package/dist/tests/core/utilities/structures/shared.js.map +1 -0
- package/dist/tests/core/utilities/structures/sso.js +4 -3
- package/dist/tests/core/utilities/structures/sso.js.map +1 -1
- package/dist/tests/core/utilities/structures/users.d.ts +2 -3
- package/dist/tests/core/utilities/structures/users.js +10 -19
- package/dist/tests/core/utilities/structures/users.js.map +1 -1
- package/package.json +4 -4
- package/src/cache/user.ts +0 -60
- package/src/middleware/passport/sso/tests/sso.spec.ts +0 -1
- package/src/redis/redis.ts +1 -1
- package/tests/core/utilities/structures/shared.ts +19 -0
- package/tests/core/utilities/structures/sso.ts +4 -3
- package/tests/core/utilities/structures/users.ts +2 -24
- package/src/cache/tests/user.spec.ts +0 -145
package/dist/index.js
CHANGED
|
@@ -5691,7 +5691,6 @@ var bustCache = performExport("bustCache");
|
|
|
5691
5691
|
var user_exports = {};
|
|
5692
5692
|
__export(user_exports, {
|
|
5693
5693
|
getUser: () => getUser,
|
|
5694
|
-
getUsers: () => getUsers,
|
|
5695
5694
|
invalidateUser: () => invalidateUser
|
|
5696
5695
|
});
|
|
5697
5696
|
init_init();
|
|
@@ -9998,27 +9997,6 @@ async function populateFromDB2(userId, tenantId) {
|
|
|
9998
9997
|
}
|
|
9999
9998
|
return user;
|
|
10000
9999
|
}
|
|
10001
|
-
async function populateUsersFromDB(userIds) {
|
|
10002
|
-
const getUsersResponse = await UserDB.bulkGet(userIds);
|
|
10003
|
-
const notFoundIds = userIds.filter((uid, i) => !getUsersResponse[i]);
|
|
10004
|
-
const users = getUsersResponse.filter((x) => x);
|
|
10005
|
-
await Promise.all(
|
|
10006
|
-
users.map(async (user) => {
|
|
10007
|
-
user.budibaseAccess = true;
|
|
10008
|
-
if (!environment_default.SELF_HOSTED && !environment_default.DISABLE_ACCOUNT_PORTAL) {
|
|
10009
|
-
const account = await getAccount(user.email);
|
|
10010
|
-
if (account) {
|
|
10011
|
-
user.account = account;
|
|
10012
|
-
user.accountPortalAccess = true;
|
|
10013
|
-
}
|
|
10014
|
-
}
|
|
10015
|
-
})
|
|
10016
|
-
);
|
|
10017
|
-
if (notFoundIds.length) {
|
|
10018
|
-
return { users, notFoundIds };
|
|
10019
|
-
}
|
|
10020
|
-
return { users };
|
|
10021
|
-
}
|
|
10022
10000
|
async function getUser(userId, tenantId, populateUser) {
|
|
10023
10001
|
if (!populateUser) {
|
|
10024
10002
|
populateUser = populateFromDB2;
|
|
@@ -10052,22 +10030,6 @@ async function getUser(userId, tenantId, populateUser) {
|
|
|
10052
10030
|
}
|
|
10053
10031
|
return user;
|
|
10054
10032
|
}
|
|
10055
|
-
async function getUsers(userIds) {
|
|
10056
|
-
const client = await getUserClient();
|
|
10057
|
-
let usersFromCache = await client.bulkGet(userIds);
|
|
10058
|
-
const missingUsersFromCache = userIds.filter((uid) => !usersFromCache[uid]);
|
|
10059
|
-
const users = Object.values(usersFromCache);
|
|
10060
|
-
let notFoundIds;
|
|
10061
|
-
if (missingUsersFromCache.length) {
|
|
10062
|
-
const usersFromDb = await populateUsersFromDB(missingUsersFromCache);
|
|
10063
|
-
notFoundIds = usersFromDb.notFoundIds;
|
|
10064
|
-
for (const userToCache of usersFromDb.users) {
|
|
10065
|
-
await client.store(userToCache._id, userToCache, EXPIRY_SECONDS3);
|
|
10066
|
-
}
|
|
10067
|
-
users.push(...usersFromDb.users);
|
|
10068
|
-
}
|
|
10069
|
-
return { users, notFoundIds };
|
|
10070
|
-
}
|
|
10071
10033
|
async function invalidateUser(userId) {
|
|
10072
10034
|
const client = await getUserClient();
|
|
10073
10035
|
await client.delete(userId);
|