@dxos/echo
    Preparing search index...

    Variable makeRelationConst

    makeRelation: <Self>(
        dxn: DXN.DXN,
    ) => <SourceInstance, TargetInstance>(
        opts: {
            id?: Key.EntityId;
            source:
                | Type.Obj<SourceInstance, any>
                | internal.UnknownTypeSchema<
                    SourceInstance,
                    typeof EntityModule.Kind.Object,
                >;
            target: | Type.Obj<TargetInstance, any>
            | internal.UnknownTypeSchema<
                TargetInstance,
                typeof EntityModule.Kind.Object,
            >;
        },
    ) => MakeRelation<Self, SourceInstance, TargetInstance> = ...

    Factory function to create an ECHO relation schema. Adds relation metadata annotations to an Effect schema.

    Type declaration

      • <Self>(
            dxn: DXN.DXN,
        ): <SourceInstance, TargetInstance>(
            opts: {
                id?: Key.EntityId;
                source:
                    | Type.Obj<SourceInstance, any>
                    | internal.UnknownTypeSchema<
                        SourceInstance,
                        typeof EntityModule.Kind.Object,
                    >;
                target: | Type.Obj<TargetInstance, any>
                | internal.UnknownTypeSchema<
                    TargetInstance,
                    typeof EntityModule.Kind.Object,
                >;
            },
        ) => MakeRelation<Self, SourceInstance, TargetInstance>
      • Type Parameters

        • Self

        Parameters

        Returns <SourceInstance, TargetInstance>(
            opts: {
                id?: Key.EntityId;
                source:
                    | Type.Obj<SourceInstance, any>
                    | internal.UnknownTypeSchema<
                        SourceInstance,
                        typeof EntityModule.Kind.Object,
                    >;
                target: | Type.Obj<TargetInstance, any>
                | internal.UnknownTypeSchema<
                    TargetInstance,
                    typeof EntityModule.Kind.Object,
                >;
            },
        ) => MakeRelation<Self, SourceInstance, TargetInstance>

    class WorksFor extends Type.makeRelation<WorksFor>(DXN.make('com.example.type.worksFor', '0.1.0'))(
    { source: Person, target: Company },
    )(Schema.Struct({ role: Schema.String })) {}

    // Like `makeObject`, the last call also takes struct fields and an optional annotate function.
    class Employs extends Type.makeRelation<Employs>(DXN.make('com.example.type.employs', '0.1.0'))(
    { source: Company, target: Person },
    )({ role: Schema.String }, Annotation.LabelAnnotation.set(['role'])) {}

    O(schema size) once at definition time; builds the type entity eagerly, so call it at module scope, not per use.