Infrastructure for stream interceptor transform nodes

Summary:
Added stream interecptor which gets a chance to augment the messages off the wire. Stream interceptor transformations are async and can fail  due to network errors so added error state with a retry button. The retry button will just call the function again.

I am also handling errors better generally when this method fails unexpectedly, logging more clearly what went wrong and communicating it to the user

Did some refactoring of subtree update event to support this

Reviewed By: lblasa

Differential Revision: D44415260

fbshipit-source-id: a5a5542b318775b641d53941808399a8fa4634d3
This commit is contained in:
Luke De Feo
2023-04-27 07:28:41 -07:00
committed by Facebook GitHub Bot
parent 6b7c5297a5
commit fd673d0535
5 changed files with 170 additions and 26 deletions

View File

@@ -0,0 +1,28 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {Id, Metadata, StreamInterceptor, UINode} from '../types';
export function getStreamInterceptor(): StreamInterceptor {
return new NoOpStreamInterceptor();
}
class NoOpStreamInterceptor implements StreamInterceptor {
init() {
return null;
}
async transformNodes(nodes: Map<Id, UINode>): Promise<Map<Id, UINode>> {
return nodes;
}
async transformMetadata(metadata: Metadata): Promise<Metadata> {
return metadata;
}
}