message: fetcher Factory
diff: @@ -4,28 +4,69 @@ import * as React from 'react';
  import * as ReactDOM from 'react-dom';
  import GraphiQL from 'graphiql';
  import { buildSchema, graphql } from "graphql";
  +import { IMap } from "@prague/map";
  require("../node_modules/graphiql/graphiql.css");
  export class Graphiql extends Document {
  // Initialize the document/component (only called when document is initially created).
  protected async create() {
  + await this.root.set("presence", this.createMap());
  + await this.root.set("users", this.createMap());
  + await this.root.set("graph", this.createString());
  }
  public async opened() {
  const maybeDiv = await this.platform.queryInterface<HTMLElement>("div");
  + let users = await this.root.wait<IMap>("users");
  +
  + console.log(users);
  + await this.root.get("users");
  + await this.serializable();
  +
  maybeDiv.style.height = "700px";
  if (maybeDiv) {
  ReactDOM.render(
  React.createElement(GraphiQL, {
  - fetcher: this.graphqlBase,
  + fetcher: this.fetcherFactory(this.root),
  schema: schema
  } ), maybeDiv);
  }
  }
  + public async serializable() {
  + root = this.root.serialize();
  + return root;
  + }
  +
  + public fetcherFactory(root: IMap): (params: any) => Promise<any> {
  + let rootLocal = this.root;
  + return (params) => {
  + const rootJson = rootLocal.serialize();
  + const rootResolvers = {
  + map: (params) => {
  + return rootJson.find((value) => value.key === params.key );
  + },
  + maps: () => rootJson,
  + };
  +
  + return graphql(schema, params.query, rootResolvers).then((response) => {
  + return response;
  + });
  + }
  + }
  +
  public async graphqlBase(params) {
  + // console.log(this.root.serialize());
  + const rootJson = this.root.serialize();
  + const rootResolvers = {
  + map: (params) => {
  + return rootJson.find((value) => value.key === params.key );
  + },
  + maps: () => rootJson,
  + };
  +
  return graphql(schema, params.query, rootResolvers).then((response) => {
  return response;
  });
  @@ -38,7 +79,14 @@ export async function instantiate(): Promise<IChaincode> {
  return DataStore.instantiate(new Graphiql());
  }
  -const root = [
  +// const rootResolvers = {
  +// map: (params) => {
  +// return root.find((value) => value.key === params.key );
  +// },
  +// maps: () => root,
  +// };
  +
  +let root = [
  {
  key: "insights",
  type: "map",
  @@ -84,13 +132,6 @@ const root = [
  }
  ];
  -const rootResolvers = {
  - map: (params) => {
  - return root.find((value) => value.key === params.key );
  - },
  - maps: () => root,
  -};
  -
  // Public queries are map(key) and maps ** the s is important!
  const schema = buildSchema(`
  type Map {
  