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

    A customer dashboard's roster, authorized by joining the caller's ACTIVE membership to their role's grants. A member is addressed by customer and user. Role, status and name live only in the rows.

    Index
    instance: (...args: []) => CustomerDashboardMembershipService = ...

    The process service: the shared database and the internal event bus.

    • The caller's own live memberships across every customer, by customer name, with each one's grants and their user row. Needs no permission. q matches the customer's shared search document.

      Parameters

      • args: {
            customerIds?: string[];
            dashboardUserId: string;
            enterable?: boolean;
            page?: number;
            pageSize?: number;
            q?: string;
            statuses?: ("ACTIVE" | "DELETED" | "DISABLED")[];
            workspaceIds?: string[];
        }
        • OptionalcustomerIds?: string[]
        • dashboardUserId: string
        • Optionalenterable?: boolean

          Only memberships a session can enter: ACTIVE, of a live ACTIVE customer with its main organization.

        • Optionalpage?: number
        • OptionalpageSize?: number
        • Optionalq?: string
        • Optionalstatuses?: ("ACTIVE" | "DELETED" | "DISABLED")[]
        • OptionalworkspaceIds?: string[]

      Returns Promise<
          {
              ok: true;
              value: {
                  hasNext: boolean;
                  items: CustomerDashboardOwnMembership[];
                  total: number;
                  user: CustomerDashboardOwnUser
                  | null;
              };
          },
      >

    • roleId and status need team/role:w, a member within the caller's reach who isn't the caller, and a target role within reach. firstName / lastName rename the caller's OWN user only. A status that changes is recorded as user.workspaceStatusChanged in the same transaction. With a caller's tx nothing is published: the caller publishes after its commit.

      Parameters

      • args: (CustomerDashboardCaller | CustomerDashboardStaffCaller) & {
            data: {
                firstName?: string;
                lastName?: string;
                roleId?: string;
                status?: "ACTIVE" | "DISABLED";
            };
            requestMetadata?: {
                geoLocation?: {
                    city?: string;
                    country?: string;
                    countryRegion?: string;
                    flag?: string;
                    latitude?: string;
                    longitude?: string;
                    postalCode?: string;
                    region?: string;
                };
                ipAddress?: string;
                userAgent?: {
                    browser: { name?: string; version?: string };
                    cpu: { architecture?: string };
                    device: { model?: string; type?: string; vendor?: string };
                    engine: { name?: string; version?: string };
                    isBot: boolean;
                    os: { name?: string; version?: string };
                    ua: string;
                };
            };
            tx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>;
            userId: string;
        }
        • data: {
              firstName?: string;
              lastName?: string;
              roleId?: string;
              status?: "ACTIVE" | "DISABLED";
          }
        • OptionalrequestMetadata?: {
              geoLocation?: {
                  city?: string;
                  country?: string;
                  countryRegion?: string;
                  flag?: string;
                  latitude?: string;
                  longitude?: string;
                  postalCode?: string;
                  region?: string;
              };
              ipAddress?: string;
              userAgent?: {
                  browser: { name?: string; version?: string };
                  cpu: { architecture?: string };
                  device: { model?: string; type?: string; vendor?: string };
                  engine: { name?: string; version?: string };
                  isBot: boolean;
                  os: { name?: string; version?: string };
                  ua: string;
              };
          }

          The request's IP, location and agent, stored on the activity a status change records.

          • OptionalgeoLocation?: {
                city?: string;
                country?: string;
                countryRegion?: string;
                flag?: string;
                latitude?: string;
                longitude?: string;
                postalCode?: string;
                region?: string;
            }

            Geolocation information from the request

            • Optionalcity?: string

              The city that the request originated from.

            • Optionalcountry?: string

              The country that the request originated from (ISO 3166-1 alpha-2).

            • OptionalcountryRegion?: string

              The ISO 3166-2 region code of the client (CloudFront-Viewer-Country-Region).

            • Optionalflag?: string

              The flag emoji for the country — derived from country at render time.

            • Optionallatitude?: string

              The latitude of the client.

            • Optionallongitude?: string

              The longitude of the client.

            • OptionalpostalCode?: string

              The postal code of the client

            • Optionalregion?: string

              Legacy Vercel edge region; unpopulated under CloudFront.

          • OptionalipAddress?: string

            IP address of the request

          • OptionaluserAgent?: {
                browser: { name?: string; version?: string };
                cpu: { architecture?: string };
                device: { model?: string; type?: string; vendor?: string };
                engine: { name?: string; version?: string };
                isBot: boolean;
                os: { name?: string; version?: string };
                ua: string;
            }

            User agent information from the request

        • Optionaltx?: PgAsyncTransaction<NodePgQueryResultHKT, EmptyRelations>
        • userId: string

      Returns Promise<
          | {
              ok: true;
              value: MemberSnapshot & { previousRoleName: string
              | null };
          }
          | { error: UpdateError; ok: false },
      >