@absolutejs/auth 0.44.2 → 0.45.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.d.ts CHANGED
@@ -15140,7 +15140,7 @@ export * from './session/sessionsConfig';
15140
15140
  export { endImpersonation, isImpersonating, startImpersonation } from './session/impersonation';
15141
15141
  export { createAnonymousSession, isAnonymousSession } from './session/anonymous';
15142
15142
  export { addToSessionRing, listRingSessions, readSessionRing, removeFromSessionRing, switchActiveSession } from './session/multiSession';
15143
- export { listUserSessions, revokeUserSessions } from './session/userSessions';
15143
+ export { listUserSessions, refreshUserSessions, revokeUserSessions } from './session/userSessions';
15144
15144
  export type { UserSession } from './session/userSessions';
15145
15145
  export { sessionCleanup } from './session/cleanup';
15146
15146
  export { createAuthHtmxRoutes } from './htmx/routes';
package/dist/index.js CHANGED
@@ -3443,6 +3443,23 @@ var listUserSessions = async ({
3443
3443
  const records = await Promise.all(ids.map((id) => authSessionStore.getSession(id)));
3444
3444
  return ids.map((id, index) => ({ id, session: records[index] })).filter((entry) => entry.session !== undefined && getUserId(entry.session.user) === userId);
3445
3445
  };
3446
+ var refreshUserSessions = async ({
3447
+ authSessionStore,
3448
+ getUserId,
3449
+ user,
3450
+ userId
3451
+ }) => {
3452
+ const sessions = await listUserSessions({
3453
+ authSessionStore,
3454
+ getUserId,
3455
+ userId
3456
+ });
3457
+ await Promise.all(sessions.map((entry) => authSessionStore.setSession(entry.id, {
3458
+ ...entry.session,
3459
+ user
3460
+ })));
3461
+ return sessions.length;
3462
+ };
3446
3463
  var revokeUserSessions = async ({
3447
3464
  authSessionStore,
3448
3465
  exceptSessionId,
@@ -8222,7 +8239,11 @@ var callback = ({
8222
8239
  },
8223
8240
  query: { code, state: callback_state }
8224
8241
  }) => withSpan("auth.oauth.callback", { "auth.provider": auth_provider?.value }, async () => {
8225
- if (stored_state === undefined || code_verifier === undefined || user_session_id === undefined || auth_client === undefined || auth_intent === undefined) {
8242
+ if (stored_state === undefined || code_verifier === undefined || auth_provider === undefined || user_session_id === undefined || auth_client === undefined || auth_intent === undefined) {
8243
+ return status("Bad Request", "Cookies are missing");
8244
+ }
8245
+ const authProvider = auth_provider.value;
8246
+ if (authProvider === undefined) {
8226
8247
  return status("Bad Request", "Cookies are missing");
8227
8248
  }
8228
8249
  if (!isNonEmptyString(code) || stored_state.value === undefined) {
@@ -8241,7 +8262,6 @@ var callback = ({
8241
8262
  }
8242
8263
  const { clientName, providerInstance } = resolvedProvider.entry;
8243
8264
  stored_state.remove();
8244
- const authProvider = auth_provider.value;
8245
8265
  const requiresPKCE = isPKCEProviderOption(authProvider);
8246
8266
  const verifier = requiresPKCE ? code_verifier.value : undefined;
8247
8267
  if (requiresPKCE && verifier === undefined) {
@@ -8336,11 +8356,11 @@ var callback = ({
8336
8356
  cookie: t18.Cookie({
8337
8357
  auth_client: authClientOption,
8338
8358
  auth_intent: authIntentOption,
8339
- auth_provider: authProviderOption,
8359
+ auth_provider: t18.Optional(authProviderOption),
8340
8360
  code_verifier: t18.Optional(t18.String()),
8341
8361
  origin_url: t18.Optional(t18.String()),
8342
8362
  state: t18.Optional(t18.String()),
8343
- user_session_id: userSessionIdTypebox
8363
+ user_session_id: t18.Optional(userSessionIdTypebox)
8344
8364
  })
8345
8365
  });
8346
8366
 
@@ -25848,6 +25868,7 @@ export {
25848
25868
  rehashCredentialPassword,
25849
25869
  registerClient,
25850
25870
  refreshableProviderOptions,
25871
+ refreshUserSessions,
25851
25872
  recordLoginAttempt,
25852
25873
  readUserInfoBearer,
25853
25874
  readSessionRing,
@@ -26187,5 +26208,5 @@ export {
26187
26208
  AuthIdentityConflictError
26188
26209
  };
26189
26210
 
26190
- //# debugId=02ED8EE4D0AFE4F564756E2164756E21
26211
+ //# debugId=11387670FAEA3B5D64756E2164756E21
26191
26212
  //# sourceMappingURL=index.js.map