@absolutejs/auth 0.65.2 → 0.65.4

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
@@ -4687,6 +4687,26 @@ import { Elysia as Elysia9, t as t6 } from "elysia";
4687
4687
 
4688
4688
  // src/utils.ts
4689
4689
  init_constants();
4690
+
4691
+ // src/types.ts
4692
+ function isJsonValue(value) {
4693
+ if (value === null || typeof value === "boolean" || typeof value === "string")
4694
+ return true;
4695
+ if (typeof value === "number")
4696
+ return Number.isFinite(value);
4697
+ if (Array.isArray(value))
4698
+ return value.every(isJsonValue);
4699
+ if (typeof value !== "object")
4700
+ return false;
4701
+ return Object.values(value).every(isJsonValue);
4702
+ }
4703
+ var parseJsonObject = (value) => {
4704
+ if (!isJsonValue(value) || value === null || Array.isArray(value) || typeof value !== "object")
4705
+ throw new TypeError("Expected a JSON object");
4706
+ return value;
4707
+ };
4708
+
4709
+ // src/utils.ts
4690
4710
  var MILLISECONDS_IN_A_SECOND2 = 1000;
4691
4711
  var readOptionalString = (value, property) => {
4692
4712
  const candidate = Reflect.get(value, property);
@@ -4846,7 +4866,7 @@ var resolveOAuthAuthorization = async ({
4846
4866
  oauthSubject,
4847
4867
  refreshToken,
4848
4868
  tokenType: typeof tokenType === "string" ? tokenType : undefined,
4849
- userIdentity
4869
+ userIdentity: parseJsonObject(userIdentity)
4850
4870
  };
4851
4871
  };
4852
4872
  var parseExpiresInSeconds = (expiresIn) => {
@@ -30868,6 +30888,14 @@ __export(exports_value2, {
30868
30888
  // src/session/redisStore.ts
30869
30889
  var SESSION_SEGMENT = "sess:";
30870
30890
  var UNREGISTERED_SEGMENT = "unreg:";
30891
+ var jsonValueSchema = Type.Recursive((self) => Type.Union([
30892
+ Type.String(),
30893
+ Type.Number(),
30894
+ Type.Boolean(),
30895
+ Type.Null(),
30896
+ Type.Array(self),
30897
+ Type.Record(Type.String(), self)
30898
+ ]));
30871
30899
  var impersonatorSchema = Type.Object({
30872
30900
  actorEmail: Type.Optional(Type.String()),
30873
30901
  actorId: Type.String(),
@@ -30897,8 +30925,8 @@ var unregisteredSessionSchema = Type.Object({
30897
30925
  expiresAt: Type.Number(),
30898
30926
  oauthSubject: Type.Optional(Type.Union([Type.String(), Type.Number()])),
30899
30927
  refreshToken: Type.Optional(Type.String()),
30900
- sessionInformation: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
30901
- userIdentity: Type.Optional(Type.Record(Type.String(), Type.Unknown()))
30928
+ sessionInformation: Type.Optional(Type.Record(Type.String(), jsonValueSchema)),
30929
+ userIdentity: Type.Optional(Type.Record(Type.String(), jsonValueSchema))
30902
30930
  });
30903
30931
  var parseJson = (raw) => {
30904
30932
  if (raw === null)
@@ -31016,8 +31044,8 @@ var annotateFailureMetadata = (metadata, report, now) => ({
31016
31044
  ...metadata ?? {},
31017
31045
  lastCredentialFailureAt: now,
31018
31046
  lastCredentialFailureCode: report.code,
31019
- lastCredentialFailureMessage: report.message,
31020
- lastCredentialFailureRetryAt: report.retryAt
31047
+ ...report.message === undefined ? {} : { lastCredentialFailureMessage: report.message },
31048
+ ...report.retryAt === undefined ? {} : { lastCredentialFailureRetryAt: report.retryAt }
31021
31049
  });
31022
31050
  var sortNewestFirst = (items) => [...items].sort((left, right) => right.updatedAt - left.updatedAt);
31023
31051
  var resolveGrantFailureStatus = (grant, report) => {
@@ -37763,6 +37791,7 @@ export {
37763
37791
  parseSdJwtVc,
37764
37792
  parseSchema,
37765
37793
  parsePresentationToken,
37794
+ parseJsonObject,
37766
37795
  organizationsTable,
37767
37796
  organizationRoutes,
37768
37797
  organizationMembershipsTable,
@@ -37820,6 +37849,7 @@ export {
37820
37849
  isOIDCProviderOption,
37821
37850
  isMfaEnrolled,
37822
37851
  isLegacyHash,
37852
+ isJsonValue,
37823
37853
  isImpersonating,
37824
37854
  isE164Phone,
37825
37855
  isDisposableEmail,
@@ -38151,5 +38181,5 @@ export {
38151
38181
  AGENT_CLAIM_GRANT_TYPE
38152
38182
  };
38153
38183
 
38154
- //# debugId=0ABB16F4AD8BF1CD64756E2164756E21
38184
+ //# debugId=C6EA4E2761E1FA9664756E2164756E21
38155
38185
  //# sourceMappingURL=index.js.map