@cfxlabsinc/b2b-services
    Preparing search index...

    Identity and status for the admin dashboard's users. Every request upserts the cfx-admin Cognito identity; roles are resolved by AdminDashboardRoleService.

    Hierarchy (View Summary)

    Index
    db: B2bDatabase
    instance: (...args: []) => AdminDashboardUserService = ...

    The process service: owner emails from the dashboard-auth namespace, read at each grant.

    • Records whether the operator's Cognito login holds a passkey, as Cognito listed it: stamps passkeyEnrolledAt the first time it does, keeping an earlier stamp, and clears it once it holds none. changed is whether it wrote.

      Parameters

      • __namedParameters: { enrolled: boolean; id: string }

      Returns Promise<
          | { error: ServiceError; ok: false }
          | { ok: true; value: { changed: boolean } },
      >

    • Parameters

      • Optionalinput: {
            cognitoSubs?: string[];
            ids?: string[];
            orderBy?: { direction: "ASC" | "DESC"; field: UserSortField }[];
            page?: number;
            pageSize?: number;
            query?: string;
            roleIds?: string[];
            statuses?: ("ACTIVE" | "DISABLED")[];
        }
        • OptionalcognitoSubs?: string[]
        • Optionalids?: string[]
        • OptionalorderBy?: { direction: "ASC" | "DESC"; field: UserSortField }[]

          Applied ahead of a stable id tiebreak; omitted, rows come in creation order. lastSeenAt sorts its ISO-8601 jsonb string, which is chronological.

        • Optionalpage?: number
        • OptionalpageSize?: number
        • Optionalquery?: string

          Case-insensitive substring of the email, first name or last name.

        • OptionalroleIds?: string[]
        • Optionalstatuses?: ("ACTIVE" | "DISABLED")[]

      Returns Promise<
          {
              ok: true;
              value: { hasNext: boolean; items: AdminDashboardUser[]; total: number };
          },
      >

    • Sets the user's status and/or display preferences: colorScheme, one of COLOR_SCHEMES, and timeZone, an IANA Area/Location name or auto. Writing what it already has is a no-op, but a named status publishes. The preferences are personal display settings, not operator state changes, so callers record no admin activity for them.

      Parameters

      • input: {
            data: {
                colorScheme?: ColorScheme;
                status?: "ACTIVE" | "DISABLED";
                timeZone?: TimeZonePreference;
            };
            id: string;
        }

      Returns Promise<
          | { ok: true; value: AdminDashboardUser }
          | { error: ServiceError; ok: false },
      >

    • Refresh the row keyed on cognitoSub, else link the one unlinked row with the same email (case-insensitive), else insert. Never flips DISABLED back to ACTIVE; a disabled user returns ADMIN_USER_DISABLED.

      created is true only when this call inserted the row — the same branch that runs the bootstrap owner grant, which publishes auth.adminUser.roleChanged after commit. timeZone, the browser's at sign-in, is stored only on that insert, and only when valid; otherwise auto.

      linked is true when it claimed a pre-cutover row by email; either flag marks a first request the sign-in callback could not record.

      Parameters

      • input: {
            cognitoSub: string;
            email: string;
            firstName?: string;
            hostedDomain?: string;
            lastName?: string;
            timeZone?: TimeZone;
        }

      Returns Promise<
          | {
              ok: true;
              value: AdminDashboardUser & { created: boolean; linked: boolean };
          }
          | { error: ServiceError; ok: false },
      >