@objectstack/runtime 9.10.0 → 9.11.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/index.js CHANGED
@@ -2048,6 +2048,7 @@ async function resolveExecutionContext(opts) {
2048
2048
  userId = sessionData?.user?.id ?? sessionData?.session?.userId;
2049
2049
  tenantId = tenantId ?? sessionData?.session?.activeOrganizationId;
2050
2050
  ctx.accessToken = sessionData?.session?.token ?? ctx.accessToken;
2051
+ if (sessionData?.user?.email) ctx.email = String(sessionData.user.email);
2051
2052
  } catch {
2052
2053
  }
2053
2054
  }
@@ -2056,6 +2057,10 @@ async function resolveExecutionContext(opts) {
2056
2057
  if (!userId) return ctx;
2057
2058
  const ql = await opts.getQl();
2058
2059
  if (!ql) return ctx;
2060
+ if (!ctx.email) {
2061
+ const userRows = await tryFind(ql, "sys_user", { id: userId }, 1);
2062
+ if (userRows[0]?.email) ctx.email = String(userRows[0].email);
2063
+ }
2059
2064
  const memberWhere = tenantId ? { user_id: userId, organization_id: tenantId } : { user_id: userId };
2060
2065
  const members = await tryFind(ql, "sys_member", memberWhere, 50);
2061
2066
  for (const m of members) {