jmap-kit
    Preparing search index...
    • Parse and validate a JMAP session response using the JMAPSessionSchema.

      Performs structural validation only (required top-level fields, account shape, presence of the Core server capability key). Capability-specific content validation is performed separately via the capability registry's validateServerCapabilities() and validateAccountCapabilities() methods.

      The returned session object is not frozen — callers should apply deepFreeze() after capability validation has had a chance to strip invalid capabilities from the session.

      Parameters

      • jsonResponse: unknown

        The raw JSON response from the server to be validated.

      • logger: Logger

        Logger instance used to log validation errors.

      Returns {
          accounts: Record<
              string,
              {
                  accountCapabilities: { [key: string]: unknown };
                  isPersonal: boolean;
                  isReadOnly: boolean;
                  name: string;
                  [key: string]: unknown;
              },
          >;
          apiUrl: string;
          capabilities: {
              "urn:ietf:params:jmap:core": { [key: string]: unknown };
              [key: string]: unknown;
          };
          downloadUrl: string;
          eventSourceUrl: string;
          primaryAccounts: Record<string, string>;
          state: string;
          uploadUrl: string;
          username: string;
          [key: string]: unknown;
      }

      The parsed and structurally validated session object (mutable).

      Error if the response does not conform to the JMAPSessionSchema.