Files @ 69ca2b2fc133
Branch filter:

Location: light9/web/lib/avro.ts

drewp@bigasterisk.com
overcomplicated attempt at persisting the pane layout in the rdf graph

this was hard because we have to somehow wait for the graph to load before config'ing the panes
import * as avrojs from "avro-js";
export namespace avro {
  export async function loadType(typeName: string): Promise<avrojs.types.Type> {
    const schemaSource = await (await fetch(`/avro/${typeName}.avsc`)).json();
    return await avrojs.parse(schemaSource);
  }
  
  export async function parseBlob(type: avrojs.types.Type, b: Blob): Promise<avrojs.types.Record> {
    const jsMsg = type.fromBuffer(Buffer.from(await b.arrayBuffer()));
    return jsMsg;
  }
}