Frodo Library - v4.5.0
    Preparing search index...

    Type Alias ManagedObject

    ManagedObject covers two distinct things that are easy to conflate:

    • Records: actual data instances of a managed type (e.g. a specific alpha_user), created/read/updated/deleted via the createManagedObject / readManagedObject / updateManagedObjectProperties / deleteManagedObject family below.
    • Configuration: the managed.json config entity that defines every managed type for the tenant (properties, relationships, etc.), read and written as a whole document via IdmConfigOps.ts's readSubConfigEntity('managed', type) / importSubConfigEntity('managed', ...).

    A type's schema — its resolved property/relationship definitions, and the ways to mutate them — is a third, related thing, covered by ManagedObjectSchemaOps.ts instead (exposed as frodo.idm.managed.schema).

    type ManagedObject = {
        addRelationship(
            type: string,
            id: string,
            field: string,
            target: RelationshipTarget,
            rev?: string,
        ): Promise<IdObjectSkeletonInterface>;
        countManagedObjects(type: string, filter?: string): Promise<number>;
        createManagedObject(
            type: string,
            moData: IdObjectSkeletonInterface,
            id?: string,
        ): Promise<IdObjectSkeletonInterface>;
        deleteManagedObject(
            type: string,
            id: string,
        ): Promise<IdObjectSkeletonInterface>;
        deleteManagedObjects(type: string, filter: string): Promise<number>;
        findOrCreateManagedObject(
            type: string,
            filter: string,
            moData: IdObjectSkeletonInterface,
            fields?: string[],
        ): Promise<FindOrCreateManagedObjectResult>;
        queryManagedObjects(
            type: string,
            filter?: string,
            fields?: string[],
            pageSize?: number,
        ): Promise<IdObjectSkeletonInterface[]>;
        queryRelatedManagedObjects(
            type: string,
            id: string,
            relationship: string,
            fields?: string[],
            pageSize?: number,
        ): Promise<IdObjectSkeletonInterface[]>;
        readManagedObject(
            type: string,
            id: string,
            fields?: string[],
        ): Promise<IdObjectSkeletonInterface>;
        readManagedObjects(
            type: string,
            fields?: string[],
        ): Promise<IdObjectSkeletonInterface[]>;
        readRelationship(type: string, id: string, field: string): Promise<unknown>;
        removeRelationship(
            type: string,
            id: string,
            field: string,
            target: RelationshipTarget,
            rev?: string,
        ): Promise<IdObjectSkeletonInterface>;
        replaceRelationship(
            type: string,
            id: string,
            field: string,
            target: RelationshipTarget | RelationshipTarget[],
            rev?: string,
        ): Promise<IdObjectSkeletonInterface>;
        resolveFullName(type: string, id: string): Promise<string>;
        resolveIdentity(idOrDn: string, realm?: string): Promise<ResolvedIdentity>;
        resolveUserName(type: string, id: string): Promise<string>;
        updateManagedObject(
            type: string,
            id: string,
            moData: IdObjectSkeletonInterface,
        ): Promise<IdObjectSkeletonInterface>;
        updateManagedObjectProperties(
            type: string,
            id: string,
            operations: PatchOperationInterface[],
            rev?: string,
        ): Promise<IdObjectSkeletonInterface>;
        updateManagedObjectsProperties(
            type: string,
            filter: string,
            operations: PatchOperationInterface[],
            rev?: string,
            pageSize?: number,
        ): Promise<IdObjectSkeletonInterface[]>;
    }
    Index

    Methods

    • Add one target to a many-valued relationship field without disturbing any existing members.

      Parameters

      • type: string

        managed object type, e.g. alpha_user

      • id: string

        managed object id

      • field: string

        relationship field name, e.g. 'roles'

      • target: RelationshipTarget

        the object to add, as plain { type, id }

      • Optionalrev: string

        optional optimistic concurrency revision token

      Returns Promise<IdObjectSkeletonInterface>

      the patched object

    • Count managed objects of the specified type.

      Parameters

      • type: string

        managed object type, e.g. alpha_user or user

      • Optionalfilter: string

        CREST search filter

      Returns Promise<number>

      a promise that resolves to the object count

    • Delete managed objects by filter

      Parameters

      • type: string

        managed object type, e.g. alpha_user or user

      • filter: string

        filter

      Returns Promise<number>

      a promise that resolves the number of deleted objects

    • Find a managed object by a CREST query filter, creating one with a server-generated _id if no match exists. Intended for JIT-provisioning flows where an external identity (e.g. a JWT subject from a foreign IDP) must not become the managed object's own _id/userName: query by a metadata field pair that captures the external identity instead (e.g. custom_merchantCustomerId eq "..." and custom_merchantId eq "..."), and let IDM generate the local _id on first use.

      Parameters

      • type: string

        managed object type, e.g. alpha_user

      • filter: string

        CREST search filter uniquely identifying the object by its external identity metadata

      • moData: IdObjectSkeletonInterface

        object data to create with if no match is found; ignored if a match is found

      • Optionalfields: string[]

        array of fields to return in either case

      Returns Promise<FindOrCreateManagedObjectResult>

      the found or newly created object, and whether it was newly created

    • Query managed objects

      Parameters

      • type: string

        managed object type, e.g. alpha_user or user

      • Optionalfilter: string

        CREST search filter

      • Optionalfields: string[]

        array of fields to return

      • OptionalpageSize: number

        page size

      Returns Promise<IdObjectSkeletonInterface[]>

      a promise resolving to an array of managed objects

    • Query related managed objects

      Parameters

      • type: string

        managed object type, e.g. alpha_user or user

      • id: string

        managed object id

      • relationship: string

        name of the relationship to query, e.g. "members" for team membership relationships

      • Optionalfields: string[]

        array of fields to return

      • OptionalpageSize: number

      Returns Promise<IdObjectSkeletonInterface[]>

      a promise resolving to an array of managed objects

    • Read managed object

      Parameters

      • type: string

        managed object type, e.g. alpha_user or user

      • id: string

        managed object id

      • Optionalfields: string[]

        array of fields to include

      Returns Promise<IdObjectSkeletonInterface>

      a promise that resolves to an IdObjectSkeletonInterface

    • Read all managed object of the specified type

      Parameters

      • type: string

        managed object type, e.g. alpha_user or user

      • Optionalfields: string[]

        array of fields to return

      Returns Promise<IdObjectSkeletonInterface[]>

      a promise that resolves to an array of IdObjectSkeletonInterfaces

    • Read the current value of a relationship field directly off a managed object (the forward direction, e.g. an alpha_user's own manager or roles field). For the reverse direction use queryRelatedManagedObjects.

      Parameters

      • type: string

        managed object type, e.g. alpha_user

      • id: string

        managed object id

      • field: string

        relationship field name, e.g. 'manager' or 'roles'

      Returns Promise<unknown>

      the field's current value: a single ref object, an array of them, or null/undefined if unset

    • Remove one target from a many-valued relationship field without disturbing any other members.

      Parameters

      • type: string

        managed object type, e.g. alpha_user

      • id: string

        managed object id

      • field: string

        relationship field name, e.g. 'roles'

      • target: RelationshipTarget

        the object to remove, as plain { type, id }

      • Optionalrev: string

        optional optimistic concurrency revision token

      Returns Promise<IdObjectSkeletonInterface>

      the patched object

    • Replace the entire value of a relationship field: a single target (or null to clear it) for a single-valued field like 'manager', or an array of targets for a many-valued field like 'roles'. Replaces the whole field — use addRelationship/removeRelationship to change one member of a many-valued field without disturbing the rest.

      Parameters

      • type: string

        managed object type, e.g. alpha_user

      • id: string

        managed object id

      • field: string

        relationship field name, e.g. 'manager' or 'roles'

      • target: RelationshipTarget | RelationshipTarget[]

        the new value

      • Optionalrev: string

        optional optimistic concurrency revision token

      Returns Promise<IdObjectSkeletonInterface>

      the patched object

    • Resolve a managed object's uuid to a human readable full name

      Parameters

      • type: string

        managed object type, e.g. teammember or alpha_user

      • id: string

        managed object _id

      Returns Promise<string>

      resolved full name or uuid if any error occurs during reslution

    • Resolve a DN or bare uuid to a structured identity: what kind of principal it is (managed user, service account, tenant admin, or unknown/unconfirmed) and its display name, without the caller needing to already know its managed object type.

      Parameters

      • idOrDn: string

        a managed/system object uuid, or a full userId DN (e.g. from an audit log event)

      • Optionalrealm: string

        optional realm override; only consulted when idOrDn is a bare uuid (a DN's own realm segment, if present, always wins)

      Returns Promise<ResolvedIdentity>

      the resolved identity

    • Resolve a managed object's uuid to a human readable username

      Parameters

      • type: string

        managed object type, e.g. teammember or alpha_user

      • id: string

        managed object _id

      Returns Promise<string>

      resolved username or uuid if any error occurs during reslution

    • Partially update managed object through a collection of patch operations.

      Parameters

      • type: string

        managed object type, e.g. alpha_user or user

      • id: string

        managed object id

      • operations: PatchOperationInterface[]

        collection of patch operations to perform on the object

      • Optionalrev: string

        managed object revision

      Returns Promise<IdObjectSkeletonInterface>

      a promise that resolves to an IdObjectSkeletonInterface

    • Partially update multiple managed object through a collection of patch operations.

      Parameters

      • type: string

        managed object type, e.g. alpha_user or user

      • filter: string

        CREST search filter

      • operations: PatchOperationInterface[]

        collection of patch operations to perform on the object

      • Optionalrev: string

        managed object revision

      • OptionalpageSize: number

        page size

      Returns Promise<IdObjectSkeletonInterface[]>

      a promise that resolves to an IdObjectSkeletonInterface