@dxos/app-toolkit - v0.16.0
    Preparing search index...

    Function whenEchoTypeMatches

    • Matches a node whose data is an instance of the given ECHO schema type. Returns the node (not the data) to enable composition with whenAll/whenAny/whenNot.

      Use this instead of whenEchoType when you need to combine matchers. The difference is what's returned:

      • whenEchoType returns the typed entity (for direct use)
      • whenEchoTypeMatches returns the node (for composition)

      Type Parameters

      • T extends AnyObj | AnyRelation

        The ECHO schema type to match against.

      Parameters

      • type: T

        The ECHO schema (e.g., Channel.Channel, Document.Document).

      Returns Matcher<
          Readonly<
              {
                  cacheable?: string[];
                  data: any;
                  id: string;
                  properties: Readonly<Record<string, any>>;
                  type: string;
              },
          >,
      >

      A matcher that returns Option.some(node) if the data matches, Option.none() otherwise.

      // Use with whenAny for OR logic
      const whenPresentable = GraphNodeMatcher.whenAny(
      AppNodeMatcher.whenEchoTypeMatches(Collection.Collection),
      AppNodeMatcher.whenEchoTypeMatches(Markdown.Document),
      );

      // Use with whenNot for exclusion
      const whenNotChannel = GraphNodeMatcher.whenNot(
      AppNodeMatcher.whenEchoTypeMatches(Channel.Channel),
      );

      whenEchoType - Use instead when you need the typed entity directly.