catalog method

Future<PatchbayInvocation> catalog({
  1. String? requestId,
})

Implementation

Future<PatchbayInvocation> catalog({String? requestId}) async {
  final String id = requestId ?? _newRequestId();
  final PatchbayGateRejection? gate = await _gates.evaluate(const <String>{});
  if (gate != null) return _gateRejected(id, gate);
  final _AdapterSnapshot snapshot;
  try {
    snapshot = _snapshot();
  } on Object catch (error) {
    return _observerFailed(id, error);
  }
  return PatchbayInvocation.accepted(
    requestId: id,
    payload: PatchbayNavigationCatalogWire(
      outcome: 'cataloged',
      source: PatchbayFactSourceWire.appRecorded,
      navigationRevision: snapshot.observation.revision,
      destinations: snapshot.descriptors
          .map(
            (PatchbayDestinationDescriptor descriptor) => descriptor.toWire(),
          )
          .toList(growable: false),
    ).toJson(),
  );
}