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

    Unless need to directly act on an identity specifically, you should be using EntityService instead.

    Extends IdentityCache, which owns the identity-search namespace this read goes through.

    Hierarchy (View Summary)

    Index
    cache: ServiceCache<
        CachedSearchPage<
            {
                achName: string;
                amlVerification?: { id: string; status: VerificationStatus } & {
                    statusDescription: string;
                };
                capabilities: (
                    | "TRANSACT"
                    | "MANAGE_PAYMENT_INSTRUMENT"
                    | "MANAGE_LEDGER_ACCOUNT"
                    | "MANAGE_DEPOSIT_MEMO"
                )[];
                countryCode: string;
                countryOfResidence: string;
                createdAt: Date;
                customerVerification?: { id: string };
                dateOfBirth?: string;
                deletedAt?: Date;
                email: string;
                fullName: string;
                id: string;
                identityDocumentVerification?: { id: string; status: VerificationStatus } & {
                    statusDescription: string;
                };
                metadata: Record<string, string>;
                name: { firstName: string; lastName: string; middleName?: string };
                phone: string;
                referenceId?: string;
                requiredInfo: RequiredInfoField[];
                status:
                    | "PENDING_VERIFICATION"
                    | "ACTION_REQUIRED"
                    | "APPROVED"
                    | "DISABLED"
                    | "DELETED"
                    | "REVIEW"
                    | "BLOCKED";
                statusDescription: string;
                taxId?: string;
                type: "IDENTITY";
                updatedAt: Date;
                uuid: string;
                verificationProfileId?: string;
                verificationReasonCode?: | "OTHER"
                | "INVALID_TAX_ID"
                | "ADDRESS_MISMATCH"
                | "REGISTRY_NOT_FOUND"
                | "DOCUMENT_ISSUE"
                | "IDENTITY_MISMATCH";
                verificationReasonCodeDescription?: string;
                wireName: string;
            },
        >,
    >
    db: B2bDatabase
    instance: (...args: []) => IdentityQueryService = ...

    The process default: built from each dependency's own instance().

    • Parameters

      • __namedParameters: { customerId: string; id: string }

      Returns Promise<
          {
              ok: true;
              value: | {
                  achName: string;
                  amlVerification?: { id: string; status: VerificationStatus } & {
                      statusDescription: string;
                  };
                  capabilities: (
                      | "TRANSACT"
                      | "MANAGE_PAYMENT_INSTRUMENT"
                      | "MANAGE_LEDGER_ACCOUNT"
                      | "MANAGE_DEPOSIT_MEMO"
                  )[];
                  countryCode: string;
                  countryOfResidence: string;
                  createdAt: Date;
                  customerVerification?: { id: string };
                  dateOfBirth?: string;
                  deletedAt?: Date;
                  email: string;
                  fullName: string;
                  id: string;
                  identityDocumentVerification?: { id: string; status: VerificationStatus } & {
                      statusDescription: string;
                  };
                  metadata: Record<string, string>;
                  name: { firstName: string; lastName: string; middleName?: string };
                  phone: string;
                  referenceId?: string;
                  requiredInfo: RequiredInfoField[];
                  status:
                      | "PENDING_VERIFICATION"
                      | "ACTION_REQUIRED"
                      | "APPROVED"
                      | "DISABLED"
                      | "DELETED"
                      | "REVIEW"
                      | "BLOCKED";
                  statusDescription: string;
                  taxId?: string;
                  type: "IDENTITY";
                  updatedAt: Date;
                  uuid: string;
                  verificationProfileId?: string;
                  verificationReasonCode?: | "OTHER"
                  | "INVALID_TAX_ID"
                  | "ADDRESS_MISMATCH"
                  | "REGISTRY_NOT_FOUND"
                  | "DOCUMENT_ISSUE"
                  | "IDENTITY_MISMATCH";
                  verificationReasonCodeDescription?: string;
                  wireName: string;
              }
              | null;
          },
      >

    • Clear each customer's membership tag and each record tag wherever cached, and always this namespace's collection tag. keys are exact deletes in this instance's key space: the only bust a null client honours.

      Parameters

      • __namedParameters: {
            customerIds: readonly string[];
            keys?: readonly CacheKey[];
            records?: readonly string[];
        }

      Returns Promise<void>

    • The bust every identity write makes, whatever it changed: its record tag in every namespace copying its columns, its customer's pages on both surfaces, and the folded get key, the one bust a null client honours.

      Parameters

      • __namedParameters: { customerId: string; id: string }

      Returns Promise<void>

    • Parameters

      • __namedParameters: {
            amlVerificationStatuses?: VerificationStatus[];
            countriesOfResidence?: string[];
            createdAt?: DbTimestampCriteria;
            customerId: string;
            emailLike?: string;
            emails?: string[];
            hasCustomerVerification?: boolean;
            identityDocumentVerificationStatuses?: VerificationStatus[];
            ids?: string[];
            includeDeleted?: boolean;
            nameLike?: string;
            orderBy?: DbOrderByCriterion<
                Omit<
                    PgTableWithColumns<
                        {
                            columns: {
                                achName: PgBuildColumn<
                                    "identity",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                countryOfResidence: PgBuildColumn<
                                    "identity",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                createdAt: PgBuildColumn<
                                    "identity",
                                    SetHasDefault<SetNotNull<(...)>>,
                                    {
                                        data: Date;
                                        dataType: "object date";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                customerExternalId: PgBuildColumn<
                                    "identity",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                customerId: PgBuildColumn<
                                    "identity",
                                    SetNotNull<PgIntegerBuilder>,
                                    {
                                        data: number;
                                        dataType: "number int32";
                                        driverParam: (...) | (...);
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                data: PgBuildColumn<
                                    "identity",
                                    Set$Type<SetHasDefault<(...)>, { dateOfBirth?: ...; taxId?: ... }>,
                                    {
                                        data: { dateOfBirth?: ...; taxId?: ... };
                                        dataType: "object json";
                                        driverParam: unknown;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                deletedAt: PgBuildColumn<
                                    "identity",
                                    PgTimestampBuilder,
                                    {
                                        data: Date;
                                        dataType: "object date";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "identity";
                                    },
                                >;
                                email: PgBuildColumn<
                                    "identity",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                externalId: PgBuildColumn<
                                    "identity",
                                    SetHasRuntimeDefault<SetNotNull<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                fullName: PgBuildColumn<
                                    "identity",
                                    SetHasGenerated<SetNotNull<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: true;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                id: PgBuildColumn<
                                    "identity",
                                    HasIdentity<SetIsPrimaryKey<(...)>, "byDefault">,
                                    {
                                        data: number;
                                        dataType: "number int32";
                                        driverParam: (...) | (...);
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: "byDefault";
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                metadata: PgBuildColumn<
                                    "identity",
                                    SetHasDefault<SetNotNull<(...)>>,
                                    {
                                        data: TData;
                                        dataType: "object json";
                                        driverParam: unknown;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                name: PgBuildColumn<
                                    "identity",
                                    Set$Type<
                                        SetNotNull<(...)>,
                                        { firstName: ...; lastName: ...; middleName?: ... },
                                    >,
                                    {
                                        data: { firstName: ...; lastName: ...; middleName?: ... };
                                        dataType: "object json";
                                        driverParam: unknown;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                phone: PgBuildColumn<
                                    "identity",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                referenceId: PgBuildColumn<
                                    "identity",
                                    PgTextBuilder<[(...), ...(...)[]]>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "identity";
                                    },
                                >;
                                searchDocument: PgBuildColumn<
                                    "identity",
                                    SetHasGenerated<SetNotNull<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: true;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                searchDocumentAdmin: PgBuildColumn<
                                    "identity",
                                    SetHasGenerated<SetNotNull<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: true;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                status: PgBuildColumn<
                                    "identity",
                                    Set$Type<
                                        SetNotNull<(...)>,
                                        (...) | (...) | (...) | (...) | (...) | (...) | (...),
                                    >,
                                    {
                                        data: (...) | (...) | (...) | (...) | (...) | (...) | (...);
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                updatedAt: PgBuildColumn<
                                    "identity",
                                    SetHasDefault<SetHasDefault<(...)>>,
                                    {
                                        data: Date;
                                        dataType: "object date";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                uuid: PgBuildColumn<
                                    "identity",
                                    SetHasDefault<SetNotNull<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string uuid";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                verification: PgBuildColumn<
                                    "identity",
                                    Set$Type<
                                        SetHasDefault<(...)>,
                                        {
                                            amlVerification?: ...;
                                            customerVerification?: ...;
                                            identityDocumentVerification?: ...;
                                            verificationProfileId?: ...;
                                        },
                                    >,
                                    {
                                        data: {
                                            amlVerification?: ...;
                                            customerVerification?: ...;
                                            identityDocumentVerification?: ...;
                                            verificationProfileId?: ...;
                                        };
                                        dataType: "object json";
                                        driverParam: unknown;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: true;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                verificationProfileId: PgBuildColumn<
                                    "identity",
                                    PgTextBuilder<[(...), ...(...)[]]>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "identity";
                                    },
                                >;
                                verificationReasons: PgBuildColumn<
                                    "identity",
                                    Set$Type<PgJsonbBuilder, VerificationReasons>,
                                    {
                                        data: VerificationReasons;
                                        dataType: "object json";
                                        driverParam: unknown;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "identity";
                                    },
                                >;
                                wireName: PgBuildColumn<
                                    "identity",
                                    SetNotNull<PgTextBuilder<(...)>>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: true;
                                        tableName: "identity";
                                    },
                                >;
                                workspaceExternalId: PgBuildColumn<
                                    "identity",
                                    PgTextBuilder<[(...), ...(...)[]]>,
                                    {
                                        data: string;
                                        dataType: "string";
                                        driverParam: string;
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "identity";
                                    },
                                >;
                                workspaceId: PgBuildColumn<
                                    "identity",
                                    PgIntegerBuilder,
                                    {
                                        data: number;
                                        dataType: "number int32";
                                        driverParam: (...)
                                        | (...);
                                        enumValues: undefined;
                                        generated: undefined;
                                        hasDefault: false;
                                        hasRuntimeDefault: false;
                                        identity: undefined;
                                        isAutoincrement: false;
                                        isPrimaryKey: false;
                                        name: string;
                                        notNull: false;
                                        tableName: "identity";
                                    },
                                >;
                            };
                            dialect: "pg";
                            isAlias: false;
                            name: "identity";
                            schema: "b2b";
                        },
                    >,
                    "enableRLS",
                >,
                "createdAt"
                | "updatedAt"
                | "fullName",
            >[];
            page?: number;
            pageSize?: number;
            partialText?: string;
            phoneLike?: string;
            phones?: string[];
            referenceIdLike?: string;
            referenceIds?: string[];
            statuses?: (
                | "PENDING_VERIFICATION"
                | "ACTION_REQUIRED"
                | "APPROVED"
                | "DISABLED"
                | "DELETED"
                | "REVIEW"
                | "BLOCKED"
            )[];
            updatedAt?: DbTimestampCriteria;
            workspaceIds?: string[];
        }
        • OptionalamlVerificationStatuses?: VerificationStatus[]
        • OptionalcountriesOfResidence?: string[]
        • OptionalcreatedAt?: DbTimestampCriteria
        • customerId: string
        • OptionalemailLike?: string

          Partial match on email

        • Optionalemails?: string[]

          Exact match, ignoring case

        • OptionalhasCustomerVerification?: boolean

          Identities that have customer verification or don't. undefined will return either.

        • OptionalidentityDocumentVerificationStatuses?: VerificationStatus[]
        • Optionalids?: string[]

          Fetch multiple ids

        • OptionalincludeDeleted?: boolean
        • OptionalnameLike?: string

          Partial match on first, middle, last name or full name

        • OptionalorderBy?: DbOrderByCriterion<
              Omit<
                  PgTableWithColumns<
                      {
                          columns: {
                              achName: PgBuildColumn<
                                  "identity",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              countryOfResidence: PgBuildColumn<
                                  "identity",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              createdAt: PgBuildColumn<
                                  "identity",
                                  SetHasDefault<SetNotNull<(...)>>,
                                  {
                                      data: Date;
                                      dataType: "object date";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              customerExternalId: PgBuildColumn<
                                  "identity",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              customerId: PgBuildColumn<
                                  "identity",
                                  SetNotNull<PgIntegerBuilder>,
                                  {
                                      data: number;
                                      dataType: "number int32";
                                      driverParam: (...) | (...);
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              data: PgBuildColumn<
                                  "identity",
                                  Set$Type<SetHasDefault<(...)>, { dateOfBirth?: ...; taxId?: ... }>,
                                  {
                                      data: { dateOfBirth?: ...; taxId?: ... };
                                      dataType: "object json";
                                      driverParam: unknown;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              deletedAt: PgBuildColumn<
                                  "identity",
                                  PgTimestampBuilder,
                                  {
                                      data: Date;
                                      dataType: "object date";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "identity";
                                  },
                              >;
                              email: PgBuildColumn<
                                  "identity",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              externalId: PgBuildColumn<
                                  "identity",
                                  SetHasRuntimeDefault<SetNotNull<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              fullName: PgBuildColumn<
                                  "identity",
                                  SetHasGenerated<SetNotNull<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: true;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              id: PgBuildColumn<
                                  "identity",
                                  HasIdentity<SetIsPrimaryKey<(...)>, "byDefault">,
                                  {
                                      data: number;
                                      dataType: "number int32";
                                      driverParam: (...) | (...);
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: "byDefault";
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              metadata: PgBuildColumn<
                                  "identity",
                                  SetHasDefault<SetNotNull<(...)>>,
                                  {
                                      data: TData;
                                      dataType: "object json";
                                      driverParam: unknown;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              name: PgBuildColumn<
                                  "identity",
                                  Set$Type<
                                      SetNotNull<(...)>,
                                      { firstName: ...; lastName: ...; middleName?: ... },
                                  >,
                                  {
                                      data: { firstName: ...; lastName: ...; middleName?: ... };
                                      dataType: "object json";
                                      driverParam: unknown;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              phone: PgBuildColumn<
                                  "identity",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              referenceId: PgBuildColumn<
                                  "identity",
                                  PgTextBuilder<[(...), ...(...)[]]>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "identity";
                                  },
                              >;
                              searchDocument: PgBuildColumn<
                                  "identity",
                                  SetHasGenerated<SetNotNull<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: true;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              searchDocumentAdmin: PgBuildColumn<
                                  "identity",
                                  SetHasGenerated<SetNotNull<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: true;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              status: PgBuildColumn<
                                  "identity",
                                  Set$Type<
                                      SetNotNull<(...)>,
                                      (...) | (...) | (...) | (...) | (...) | (...) | (...),
                                  >,
                                  {
                                      data: (...) | (...) | (...) | (...) | (...) | (...) | (...);
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              updatedAt: PgBuildColumn<
                                  "identity",
                                  SetHasDefault<SetHasDefault<(...)>>,
                                  {
                                      data: Date;
                                      dataType: "object date";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              uuid: PgBuildColumn<
                                  "identity",
                                  SetHasDefault<SetNotNull<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string uuid";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              verification: PgBuildColumn<
                                  "identity",
                                  Set$Type<
                                      SetHasDefault<(...)>,
                                      {
                                          amlVerification?: ...;
                                          customerVerification?: ...;
                                          identityDocumentVerification?: ...;
                                          verificationProfileId?: ...;
                                      },
                                  >,
                                  {
                                      data: {
                                          amlVerification?: ...;
                                          customerVerification?: ...;
                                          identityDocumentVerification?: ...;
                                          verificationProfileId?: ...;
                                      };
                                      dataType: "object json";
                                      driverParam: unknown;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: true;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              verificationProfileId: PgBuildColumn<
                                  "identity",
                                  PgTextBuilder<[(...), ...(...)[]]>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "identity";
                                  },
                              >;
                              verificationReasons: PgBuildColumn<
                                  "identity",
                                  Set$Type<PgJsonbBuilder, VerificationReasons>,
                                  {
                                      data: VerificationReasons;
                                      dataType: "object json";
                                      driverParam: unknown;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "identity";
                                  },
                              >;
                              wireName: PgBuildColumn<
                                  "identity",
                                  SetNotNull<PgTextBuilder<(...)>>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: true;
                                      tableName: "identity";
                                  },
                              >;
                              workspaceExternalId: PgBuildColumn<
                                  "identity",
                                  PgTextBuilder<[(...), ...(...)[]]>,
                                  {
                                      data: string;
                                      dataType: "string";
                                      driverParam: string;
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "identity";
                                  },
                              >;
                              workspaceId: PgBuildColumn<
                                  "identity",
                                  PgIntegerBuilder,
                                  {
                                      data: number;
                                      dataType: "number int32";
                                      driverParam: (...)
                                      | (...);
                                      enumValues: undefined;
                                      generated: undefined;
                                      hasDefault: false;
                                      hasRuntimeDefault: false;
                                      identity: undefined;
                                      isAutoincrement: false;
                                      isPrimaryKey: false;
                                      name: string;
                                      notNull: false;
                                      tableName: "identity";
                                  },
                              >;
                          };
                          dialect: "pg";
                          isAlias: false;
                          name: "identity";
                          schema: "b2b";
                      },
                  >,
                  "enableRLS",
              >,
              "createdAt"
              | "updatedAt"
              | "fullName",
          >[]

          Ties break on the row id, in the last criterion's direction. fullName is the name every list shows, served by identity_*full_name_idx.

        • Optionalpage?: number

          Defaults to 1

        • OptionalpageSize?: number

          Defaults to 50

        • OptionalpartialText?: string

          Partial text search on: id, referenceId, name, email, phone

        • OptionalphoneLike?: string

          Partial match on phone

        • Optionalphones?: string[]
        • OptionalreferenceIdLike?: string

          Partial match on reference ID

        • OptionalreferenceIds?: string[]
        • Optionalstatuses?: (
              | "PENDING_VERIFICATION"
              | "ACTION_REQUIRED"
              | "APPROVED"
              | "DISABLED"
              | "DELETED"
              | "REVIEW"
              | "BLOCKED"
          )[]
        • OptionalupdatedAt?: DbTimestampCriteria
        • OptionalworkspaceIds?: string[]

          Identities that own one of these sign-in workspaces

      Returns Promise<
          {
              ok: true;
              value: {
                  hasNext: boolean;
                  items: {
                      achName: string;
                      amlVerification?: { id: string; status: VerificationStatus } & {
                          statusDescription: string;
                      };
                      capabilities: (
                          | "TRANSACT"
                          | "MANAGE_PAYMENT_INSTRUMENT"
                          | "MANAGE_LEDGER_ACCOUNT"
                          | "MANAGE_DEPOSIT_MEMO"
                      )[];
                      countryCode: string;
                      countryOfResidence: string;
                      createdAt: Date;
                      customerVerification?: { id: string };
                      dateOfBirth?: string;
                      deletedAt?: Date;
                      email: string;
                      fullName: string;
                      id: string;
                      identityDocumentVerification?: {
                          id: string;
                          status: VerificationStatus;
                      } & { statusDescription: string };
                      metadata: Record<string, string>;
                      name: { firstName: string; lastName: string; middleName?: string };
                      phone: string;
                      referenceId?: string;
                      requiredInfo: RequiredInfoField[];
                      status:
                          | "PENDING_VERIFICATION"
                          | "ACTION_REQUIRED"
                          | "APPROVED"
                          | "DISABLED"
                          | "DELETED"
                          | "REVIEW"
                          | "BLOCKED";
                      statusDescription: string;
                      taxId?: string;
                      type: "IDENTITY";
                      updatedAt: Date;
                      uuid: string;
                      verificationProfileId?: string;
                      verificationReasonCode?: | "OTHER"
                      | "INVALID_TAX_ID"
                      | "ADDRESS_MISMATCH"
                      | "REGISTRY_NOT_FOUND"
                      | "DOCUMENT_ISSUE"
                      | "IDENTITY_MISMATCH";
                      verificationReasonCodeDescription?: string;
                      wireName: string;
                  }[];
                  total: number;
              };
          },
      >

    • Tags for a page: the scope its query searched (each customer's membership tag, else the collection tag), so an empty page is bustable too, plus the records it projects and the fields that chose or ordered its rows.

      Parameters

      • __namedParameters: {
            customerIds: readonly string[] | undefined;
            fields?: readonly string[];
            records?: readonly string[];
        }

      Returns string[]

    • The exact cache key IdentityQueryService.get reads through.

      get folds onto search, so its entry is an ordinary single-row search page — these args must stay identical to the ones get passes ({ customerId, ids: [id], pageSize: 1 }, with search's page default of 1). Every other search filter is undefined there, and serviceCacheKey canonicalizes with JCS, which drops undefined properties — so naming only the four that are set produces the same digest. identityCache.test.ts pins that equivalence.

      Writers pass this to SearchCache.invalidateCache's keys so read-after-write holds in memory mode, where tag invalidation no-ops. The cache hashes and surface-prefixes it; this returns the arguments only.

      Parameters

      • __namedParameters: { customerId: string; id: string }

      Returns Record<string, unknown>

    • Identity → the dashboard wire form. Not the cached shape; needs no cache instance.

      Parameters

      • identity: {
            achName: string;
            amlVerification?: { id: string; status: VerificationStatus } & {
                statusDescription: string;
            };
            capabilities: (
                | "TRANSACT"
                | "MANAGE_PAYMENT_INSTRUMENT"
                | "MANAGE_LEDGER_ACCOUNT"
                | "MANAGE_DEPOSIT_MEMO"
            )[];
            countryCode: string;
            countryOfResidence: string;
            createdAt: Date;
            customerVerification?: { id: string };
            dateOfBirth?: string;
            deletedAt?: Date;
            email: string;
            fullName: string;
            id: string;
            identityDocumentVerification?: { id: string; status: VerificationStatus } & {
                statusDescription: string;
            };
            metadata: Record<string, string>;
            name: { firstName: string; lastName: string; middleName?: string };
            phone: string;
            referenceId?: string;
            requiredInfo: RequiredInfoField[];
            status:
                | "PENDING_VERIFICATION"
                | "ACTION_REQUIRED"
                | "APPROVED"
                | "DISABLED"
                | "DELETED"
                | "REVIEW"
                | "BLOCKED";
            statusDescription: string;
            taxId?: string;
            type: "IDENTITY";
            updatedAt: Date;
            uuid: string;
            verificationProfileId?: string;
            verificationReasonCode?: | "OTHER"
            | "INVALID_TAX_ID"
            | "ADDRESS_MISMATCH"
            | "REGISTRY_NOT_FOUND"
            | "DOCUMENT_ISSUE"
            | "IDENTITY_MISMATCH";
            verificationReasonCodeDescription?: string;
            wireName: string;
        }
        • achName: string
        • OptionalamlVerification?: { id: string; status: VerificationStatus } & { statusDescription: string }
        • capabilities: (
              | "TRANSACT"
              | "MANAGE_PAYMENT_INSTRUMENT"
              | "MANAGE_LEDGER_ACCOUNT"
              | "MANAGE_DEPOSIT_MEMO"
          )[]

          What this identity is capable of executing currently

        • countryCode: string

          Country of jurisdiction; alias of countryOfResidence

        • countryOfResidence: string
        • createdAt: Date
        • OptionalcustomerVerification?: { id: string }

          Details of customer's own verification of the identity

          • id: string

            Verification unique identifier in the customer's system

        • OptionaldateOfBirth?: string

          In ISO format: yyyy-MM-dd

        • OptionaldeletedAt?: Date
        • email: string
        • fullName: string
        • id: string
        • OptionalidentityDocumentVerification?: { id: string; status: VerificationStatus } & { statusDescription: string }
        • metadata: Record<string, string>
        • name: { firstName: string; lastName: string; middleName?: string }
        • phone: string
        • OptionalreferenceId?: string
        • requiredInfo: RequiredInfoField[]

          Field paths verification needs and the identity lacks; derived, never stored.

        • status:
              | "PENDING_VERIFICATION"
              | "ACTION_REQUIRED"
              | "APPROVED"
              | "DISABLED"
              | "DELETED"
              | "REVIEW"
              | "BLOCKED"
        • statusDescription: string

          The one label status is shown under, computed in SQL beside it.

        • OptionaltaxId?: string

          The person's own tax identification number — an SSN or ITIN for a US person, the local equivalent elsewhere. Stored as entered.

          Mirrors related_person.data.taxId: the two are the same fact about the same kind of party, and both forward to AiPrise the same way (additional_info: TAX_IDENTIFICATION_NUMBER on the identity-document verification run — AiPrise's user profile has no field for it).

        • type: "IDENTITY"

          Discriminator shared with Organization for mixed entity lists

        • updatedAt: Date
        • uuid: string
        • OptionalverificationProfileId?: string

          AiPrise user profile ID

          Only set if we verify the identity.

        • OptionalverificationReasonCode?:
              | "OTHER"
              | "INVALID_TAX_ID"
              | "ADDRESS_MISMATCH"
              | "REGISTRY_NOT_FOUND"
              | "DOCUMENT_ISSUE"
              | "IDENTITY_MISMATCH"

          Customer-safe; set while the verification is declined, in review or needs info.

        • OptionalverificationReasonCodeDescription?: string
        • wireName: string

      Returns CachedIdentity