@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.cjs CHANGED
@@ -2116,6 +2116,7 @@ async function resolveExecutionContext(opts) {
2116
2116
  userId = sessionData?.user?.id ?? sessionData?.session?.userId;
2117
2117
  tenantId = tenantId ?? sessionData?.session?.activeOrganizationId;
2118
2118
  ctx.accessToken = sessionData?.session?.token ?? ctx.accessToken;
2119
+ if (sessionData?.user?.email) ctx.email = String(sessionData.user.email);
2119
2120
  } catch {
2120
2121
  }
2121
2122
  }
@@ -2124,6 +2125,10 @@ async function resolveExecutionContext(opts) {
2124
2125
  if (!userId) return ctx;
2125
2126
  const ql = await opts.getQl();
2126
2127
  if (!ql) return ctx;
2128
+ if (!ctx.email) {
2129
+ const userRows = await tryFind(ql, "sys_user", { id: userId }, 1);
2130
+ if (userRows[0]?.email) ctx.email = String(userRows[0].email);
2131
+ }
2127
2132
  const memberWhere = tenantId ? { user_id: userId, organization_id: tenantId } : { user_id: userId };
2128
2133
  const members = await tryFind(ql, "sys_member", memberWhere, 50);
2129
2134
  for (const m of members) {