{"expireTime":9007200821600205000,"key":"gatsby-plugin-mdx-entire-payload-ae884830a5795e410a7076c70b243eba-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"The ObjectSchema is a structural schema used to define relationships in objects.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":81,"offset":81},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":81,"offset":81},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Params","position":{"start":{"line":4,"column":4,"offset":86},"end":{"line":4,"column":10,"offset":92},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":83},"end":{"line":4,"column":10,"offset":92},"indent":[]}},{"type":"code","lang":"js","meta":null,"value":"new ObjectSchema(\n    shape: {\n        [key: string]: Schema\n    }\n    options?: {\n        shape: (entity: A) => B,\n        merge: (previous: A, next: B) => C\n    }\n);\n","position":{"start":{"line":5,"column":1,"offset":93},"end":{"line":16,"column":4,"offset":271},"indent":[1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"shape","position":{"start":{"line":17,"column":5,"offset":276},"end":{"line":17,"column":10,"offset":281},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":272},"end":{"line":17,"column":11,"offset":282},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"type:","position":{"start":{"line":18,"column":3,"offset":285},"end":{"line":18,"column":8,"offset":290},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":283},"end":{"line":18,"column":10,"offset":292},"indent":[]}},{"type":"inlineCode","value":"{[key: string]: string}","position":{"start":{"line":18,"column":10,"offset":292},"end":{"line":18,"column":35,"offset":317},"indent":[]}},{"type":"break","position":{"start":{"line":18,"column":35,"offset":317},"end":{"line":19,"column":1,"offset":320},"indent":[1]}},{"type":"strong","children":[{"type":"text","value":"default:","position":{"start":{"line":19,"column":3,"offset":322},"end":{"line":19,"column":11,"offset":330},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":320},"end":{"line":19,"column":13,"offset":332},"indent":[]}},{"type":"text","value":" ","position":{"start":{"line":19,"column":13,"offset":332},"end":{"line":19,"column":14,"offset":333},"indent":[]}},{"type":"inlineCode","value":"{}","position":{"start":{"line":19,"column":14,"offset":333},"end":{"line":19,"column":18,"offset":337},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":283},"end":{"line":19,"column":18,"offset":337},"indent":[1]}},{"type":"paragraph","children":[{"type":"text","value":"A javascript object that describes the relationships to other schemas. \n","position":{"start":{"line":21,"column":1,"offset":339},"end":{"line":22,"column":1,"offset":411},"indent":[1]}},{"type":"emphasis","children":[{"type":"text","value":"Note: you only have to define the keys that hold relationships.","position":{"start":{"line":22,"column":2,"offset":412},"end":{"line":22,"column":65,"offset":475},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":411},"end":{"line":22,"column":66,"offset":476},"indent":[]}}],"position":{"start":{"line":21,"column":1,"offset":339},"end":{"line":22,"column":66,"offset":476},"indent":[1]}},{"type":"code","lang":"js","meta":null,"value":"const person = new EntitySchema('person')\n\nperson.shape = new ObjectSchema({\n    friend: person,\n    enemy: person\n});","position":{"start":{"line":24,"column":1,"offset":478},"end":{"line":31,"column":4,"offset":606},"indent":[1,1,1,1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"options.create","position":{"start":{"line":33,"column":5,"offset":612},"end":{"line":33,"column":19,"offset":626},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":608},"end":{"line":33,"column":20,"offset":627},"indent":[]}},{"type":"jsx","value":"<Create />","position":{"start":{"line":34,"column":1,"offset":628},"end":{"line":34,"column":11,"offset":638},"indent":[]}},{"type":"code","lang":null,"meta":null,"value":"const person = new ObjectSchema({}, {\n    create: (data) => new Person(data)\n});\n\nconst user = new EntitySchema('user');\nuser.shape = person;","position":{"start":{"line":36,"column":1,"offset":640},"end":{"line":43,"column":4,"offset":789},"indent":[1,1,1,1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"options.merge","position":{"start":{"line":45,"column":5,"offset":795},"end":{"line":45,"column":18,"offset":808},"indent":[]}}],"position":{"start":{"line":45,"column":1,"offset":791},"end":{"line":45,"column":19,"offset":809},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"default:","position":{"start":{"line":46,"column":3,"offset":812},"end":{"line":46,"column":11,"offset":820},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":810},"end":{"line":46,"column":13,"offset":822},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":810},"end":{"line":46,"column":13,"offset":822},"indent":[]}},{"type":"jsx","value":"<Merge default=\"(previous, next) => ({...previous, ...next})\"/>","position":{"start":{"line":47,"column":1,"offset":823},"end":{"line":47,"column":64,"offset":886},"indent":[]}},{"type":"code","lang":"js","meta":null,"value":"const person = new ObjectSchema({}, {\n    create: item => new Person(item),\n    merge: (prev, next) => prev.merge(next)\n});","position":{"start":{"line":50,"column":1,"offset":889},"end":{"line":55,"column":4,"offset":1022},"indent":[1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Methods","position":{"start":{"line":58,"column":4,"offset":1028},"end":{"line":58,"column":11,"offset":1035},"indent":[]}}],"position":{"start":{"line":58,"column":1,"offset":1025},"end":{"line":58,"column":11,"offset":1035},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":".normalize()","position":{"start":{"line":60,"column":5,"offset":1041},"end":{"line":60,"column":17,"offset":1053},"indent":[]}}],"position":{"start":{"line":60,"column":1,"offset":1037},"end":{"line":60,"column":17,"offset":1053},"indent":[]}},{"type":"jsx","value":"<Normalize />","position":{"start":{"line":61,"column":1,"offset":1054},"end":{"line":61,"column":14,"offset":1067},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":".denormalize()","position":{"start":{"line":63,"column":5,"offset":1073},"end":{"line":63,"column":19,"offset":1087},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":1069},"end":{"line":63,"column":19,"offset":1087},"indent":[]}},{"type":"jsx","value":"<Denormalize />","position":{"start":{"line":64,"column":1,"offset":1088},"end":{"line":64,"column":16,"offset":1103},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Object Schema\",\"group\":\"Enty\"}","position":{"start":{"line":67,"column":1,"offset":1106},"end":{"line":67,"column":69,"offset":1174},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":67,"column":69,"offset":1174}}},"scopeImports":["import React from 'react'"],"scopeIdentifiers":["React"],"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Object Schema\",\n  \"group\": \"Enty\"\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar Create = makeShortcode(\"Create\");\nvar Merge = makeShortcode(\"Merge\");\nvar Normalize = makeShortcode(\"Normalize\");\nvar Denormalize = makeShortcode(\"Denormalize\");\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"The ObjectSchema is a structural schema used to define relationships in objects.\"), mdx(\"h2\", null, \"Params\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-js\"\n  }), \"new ObjectSchema(\\n    shape: {\\n        [key: string]: Schema\\n    }\\n    options?: {\\n        shape: (entity: A) => B,\\n        merge: (previous: A, next: B) => C\\n    }\\n);\\n\\n\")), mdx(\"h3\", null, \"shape\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"type:\"), mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"{[key: string]: string}\"), mdx(\"br\", {\n    parentName: \"p\"\n  }), \"\\n\", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"default:\"), \" \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"{}\")), mdx(\"p\", null, \"A javascript object that describes the relationships to other schemas.\\n\", mdx(\"em\", {\n    parentName: \"p\"\n  }, \"Note: you only have to define the keys that hold relationships.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-js\"\n  }), \"const person = new EntitySchema('person')\\n\\nperson.shape = new ObjectSchema({\\n    friend: person,\\n    enemy: person\\n});\\n\")), mdx(\"h3\", null, \"options.create\"), mdx(Create, {\n    mdxType: \"Create\"\n  }), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"const person = new ObjectSchema({}, {\\n    create: (data) => new Person(data)\\n});\\n\\nconst user = new EntitySchema('user');\\nuser.shape = person;\\n\")), mdx(\"h3\", null, \"options.merge\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"default:\")), mdx(Merge, {\n    \"default\": \"(previous, next) => ({...previous, ...next})\",\n    mdxType: \"Merge\"\n  }), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-js\"\n  }), \"const person = new ObjectSchema({}, {\\n    create: item => new Person(item),\\n    merge: (prev, next) => prev.merge(next)\\n});\\n\")), mdx(\"h2\", null, \"Methods\"), mdx(\"h3\", null, \".normalize()\"), mdx(Normalize, {\n    mdxType: \"Normalize\"\n  }), mdx(\"h3\", null, \".denormalize()\"), mdx(Denormalize, {\n    mdxType: \"Denormalize\"\n  }));\n}\n;\nMDXContent.isMDXComponent = true;","rawMDXOutput":"/* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsx mdx */\n\nexport const _frontmatter = {\n  \"title\": \"Object Schema\",\n  \"group\": \"Enty\"\n};\nconst makeShortcode = name => function MDXDefaultShortcode(props) {\n  console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\")\n  return <div {...props}/>\n};\nconst Create = makeShortcode(\"Create\");\nconst Merge = makeShortcode(\"Merge\");\nconst Normalize = makeShortcode(\"Normalize\");\nconst Denormalize = makeShortcode(\"Denormalize\");\nconst layoutProps = {\n  _frontmatter\n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n  components,\n  ...props\n}) {\n  return <MDXLayout {...layoutProps} {...props} components={components} mdxType=\"MDXLayout\">\n    <p>{`The ObjectSchema is a structural schema used to define relationships in objects.`}</p>\n    <h2>{`Params`}</h2>\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\"\n      }}>{`new ObjectSchema(\n    shape: {\n        [key: string]: Schema\n    }\n    options?: {\n        shape: (entity: A) => B,\n        merge: (previous: A, next: B) => C\n    }\n);\n\n`}</code></pre>\n    <h3>{`shape`}</h3>\n    <p><strong parentName=\"p\">{`type:`}</strong><inlineCode parentName=\"p\">{`{[key: string]: string}`}</inlineCode><br parentName=\"p\"></br>{`\n`}<strong parentName=\"p\">{`default:`}</strong>{` `}<inlineCode parentName=\"p\">{`{}`}</inlineCode></p>\n    <p>{`A javascript object that describes the relationships to other schemas.\n`}<em parentName=\"p\">{`Note: you only have to define the keys that hold relationships.`}</em></p>\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\"\n      }}>{`const person = new EntitySchema('person')\n\nperson.shape = new ObjectSchema({\n    friend: person,\n    enemy: person\n});\n`}</code></pre>\n    <h3>{`options.create`}</h3>\n    <Create mdxType=\"Create\" />\n    <pre><code parentName=\"pre\" {...{}}>{`const person = new ObjectSchema({}, {\n    create: (data) => new Person(data)\n});\n\nconst user = new EntitySchema('user');\nuser.shape = person;\n`}</code></pre>\n    <h3>{`options.merge`}</h3>\n    <p><strong parentName=\"p\">{`default:`}</strong></p>\n    <Merge default=\"(previous, next) => ({...previous, ...next})\" mdxType=\"Merge\" />\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\"\n      }}>{`const person = new ObjectSchema({}, {\n    create: item => new Person(item),\n    merge: (prev, next) => prev.merge(next)\n});\n`}</code></pre>\n    <h2>{`Methods`}</h2>\n    <h3>{`.normalize()`}</h3>\n    <Normalize mdxType=\"Normalize\" />\n    <h3>{`.denormalize()`}</h3>\n    <Denormalize mdxType=\"Denormalize\" />\n\n    </MDXLayout>;\n}\n\n;\nMDXContent.isMDXComponent = true;"}}