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

    Function whenEchoType

    • Matches a node whose data is an instance of the given ECHO schema type. Returns the typed entity data (not the node) for direct use in callbacks.

      Use this when you need to work directly with the typed ECHO entity in your connector or actions callback.

      Type Parameters

      • T extends AnyEntity

        The ECHO schema type to match against.

      Parameters

      • type: T

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

      Returns Matcher<InstanceType<T>>

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

      GraphBuilder.createExtension({
      id: 'collectionExtension',
      match: AppNodeMatcher.whenEchoType(Collection.Collection),
      connector: (collection) => {
      // `collection` is typed as Collection.Collection
      return Effect.succeed(collection.objects.map(...));
      },
      });

      Can be composed directly with whenAll/whenAny/whenNot while preserving the typed entity data in the result.

      whenEchoTypeMatches - Returns the node instead of data for legacy composition.