Hierarchy

  • Sync

Constructors

  • Parameters

    • imodel: IModelDb

    Returns Sync

Properties

imodel: IModelDb
store: Repository<RepositoryLinkProps>

Stores provenance information for relationships.

touched: Set<string> = ...

The set of IDs that the synchronizer has seen in its lifetime. fir uses this property to determine which elements are safe to delete after synchronizing.

See

Sync#trim

Methods

  • Remove key-value pair tag from an element' JSON properties. If the key does not exist, this is a nop.

    Type Parameters

    Type Parameters

    Parameters

    • element: string | E
    • key: string | string[]

    Returns void

  • Given a fir element, fetch its external source aspect from the iModel.

    Type Parameters

    Type Parameters

    Parameters

    • element: E

    Returns { aspectId?: string; elementId?: string }

    • Optional aspectId?: string
    • Optional elementId?: string
  • Insert fir's representation of a branch in an iModel into the iModel. Its ID is returned. If the branch already exists fir will not attempt to insert it again. I like to think of it like the shell program touch.

    Type Parameters

    Type Parameters

    Parameters

    • branch: B

    Returns string

  • Type Parameters

    Type Parameters

    Parameters

    • element: E

    Returns string

  • Type Parameters

    Type Parameters

    • M extends Model<ModelProps>

    Parameters

    • model: M

    Returns string

  • Note that neither Models nor Aspects may be the source nor target of relationships in the link table, and therefore Models and Aspects cannot be involved in relationships with properties or relationships with (..) multiplicity.

    The Relationship type represents link-table relationships.

    Type Parameters

    Type Parameters

    Parameters

    • relationship: R

    Returns { criteria: string; relClassFullName: string }

    • criteria: string
    • relClassFullName: string
  • Sync fir's representation of a branch in an iModel with the iModel. If the external source aspect of the element has changed, the element will be updated. This function will also insert all of the dependencies of the element if its to function is correct.

    Type Parameters

    Type Parameters

    Parameters

    • branch: B

    Returns void

  • Type Parameters

    Type Parameters

    Parameters

    • element: E

    Returns void

  • Because we can only attach external source aspects to elements, a model does not have information that anchors it to the source document. In BIS speak, this is provenance. Thus, we only update the model if its modeled element has changed.

    See

    Sync#sync

    Type Parameters

    Type Parameters

    • M extends Model<ModelProps>

    Parameters

    • model: M

    Returns void

  • Type Parameters

    Type Parameters

    Parameters

    • relationship: R

    Returns void

  • Tag an element with a key-value pair in its JSON properties. If the key already exists, it will be written over.

    Type Parameters

    Type Parameters

    Parameters

    • element: E
    • key: string
    • value: unknown

    Returns void

  • Type Parameters

    Type Parameters

    • A extends Aspect<ElementAspectProps>

    Parameters

    • elementId: string
    • aspect: A

    Returns ElementAspectProps

  • This mapping function doesn't look like the rest, because its first parameter is the ID of the element that owns the external source aspect. This is because we've reversed the dependency in our element type compared to the iTwin type. Our element type refers to the aspect, while iTwin's aspect type refers to the element, just like the BIS navigation property. Thus, there's no way to resolve the BIS dependency with only the aspect; we can't traverse backwards from our aspect type to our element type.

    This design decision also means we can't use to functions with aspects, because we'd have to supply the ID of the owning element.

    Aspects are only allowed as the source of relationships behind navigational properties, or as the target of element-owns-aspect relationships.

    Here's my source for that quote, straight from Casey.

    We're already handling the latter, and but I think the former means that aspects are allowed to have navigation properties, which will not be supported until the iTwin APIs allow you to locate the ID of an aspect you've inserted. Then we'll have to decouple the aspect type from the external aspect type, and make it point to the element, and not vice versa.

    Parameters

    • elementId: string
    • meta: Meta<ExternalSourceAspectProps>

    Returns ExternalSourceAspectProps

  • Given a subtree of the iModel, delete any elements and models that have not been seen by the synchronizer and whose child elements have not been seen. Note that fir uses put to find or insert the branch, so the argument will never be deleted.

    Remarks

    This code is expected to be replaced by ElementTreeDeleter when it is merged into the iTwin libraries. This implementation does not defer the deletion of definition elements; it trades efficiency for correctness, because I don't know how the backend processes different classes of definition elements when deleteDefinitionElements is called.

    See

    Sam Wilson's comments if you're interested why this isn't totally trivial.

    deleteDefinitionElements does not preserve the order that you specify, and it does not process children before parents.

    Todo

    What about deferring definition elements until we encounter a definition model, and then pass its immediate children? How does the backend respond to DefinitionGroup and DefinitionContainer?

    Type Parameters

    Type Parameters

    Parameters

    • branch: B

    Returns Trim

  • Parameters

    • branch: string

    Returns Trim

Generated using TypeDoc