{"expireTime":9007200821600205000,"key":"gatsby-plugin-mdx-entire-payload-6ab16360fe61cf110a1c93143ba0f1d6-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Sometimes data can exist in a partially normalized state. E.g. a user object has a friend key,\nbut instead of the data giving you the whole object it just returns a user id in its place.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":3,"column":92,"offset":187},"indent":[1]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":3,"column":92,"offset":187},"indent":[1]}},{"type":"code","lang":"js","meta":null,"value":"// User\n{\n    id: '123',\n    name: 'foo',\n    friend: '456'\n}","position":{"start":{"line":5,"column":1,"offset":189},"end":{"line":12,"column":4,"offset":260},"indent":[1,1,1,1,1,1,1]}},{"type":"paragraph","children":[{"type":"text","value":"As long as you already have the friend normalized into state, the Value schemas lets you \ndenormalize ","position":{"start":{"line":14,"column":1,"offset":262},"end":{"line":15,"column":13,"offset":364},"indent":[1]}},{"type":"inlineCode","value":"friend","position":{"start":{"line":15,"column":13,"offset":364},"end":{"line":15,"column":21,"offset":372},"indent":[]}},{"type":"text","value":" as a user.","position":{"start":{"line":15,"column":21,"offset":372},"end":{"line":15,"column":32,"offset":383},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":262},"end":{"line":15,"column":32,"offset":383},"indent":[1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Params","position":{"start":{"line":18,"column":4,"offset":389},"end":{"line":18,"column":10,"offset":395},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":386},"end":{"line":18,"column":10,"offset":395},"indent":[]}},{"type":"code","lang":"js","meta":null,"value":"IdSchema(\n    shape: Schema,\n    options?: {\n        shape: (value) => entity\n    }\n);","position":{"start":{"line":19,"column":1,"offset":396},"end":{"line":26,"column":4,"offset":492},"indent":[1,1,1,1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"shape","position":{"start":{"line":28,"column":5,"offset":498},"end":{"line":28,"column":10,"offset":503},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":494},"end":{"line":28,"column":11,"offset":504},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"type:","position":{"start":{"line":29,"column":3,"offset":507},"end":{"line":29,"column":8,"offset":512},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":505},"end":{"line":29,"column":10,"offset":514},"indent":[]}},{"type":"text","value":" ","position":{"start":{"line":29,"column":10,"offset":514},"end":{"line":29,"column":11,"offset":515},"indent":[]}},{"type":"inlineCode","value":"Schema","position":{"start":{"line":29,"column":11,"offset":515},"end":{"line":29,"column":19,"offset":523},"indent":[]}},{"type":"text","value":"  ","position":{"start":{"line":29,"column":19,"offset":523},"end":{"line":29,"column":21,"offset":525},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":505},"end":{"line":29,"column":21,"offset":525},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"The Schema that this value represents.","position":{"start":{"line":31,"column":1,"offset":527},"end":{"line":31,"column":39,"offset":565},"indent":[]}}],"position":{"start":{"line":31,"column":1,"offset":527},"end":{"line":31,"column":39,"offset":565},"indent":[]}},{"type":"code","lang":"js","meta":null,"value":"const user = new EntitySchema('user');\nconst friend = IdSchema(user);\nuser.set({friend});","position":{"start":{"line":33,"column":1,"offset":567},"end":{"line":37,"column":4,"offset":666},"indent":[1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"options.shape","position":{"start":{"line":39,"column":5,"offset":672},"end":{"line":39,"column":18,"offset":685},"indent":[]}}],"position":{"start":{"line":39,"column":1,"offset":668},"end":{"line":39,"column":18,"offset":685},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"type:","position":{"start":{"line":40,"column":3,"offset":688},"end":{"line":40,"column":8,"offset":693},"indent":[]}}],"position":{"start":{"line":40,"column":1,"offset":686},"end":{"line":40,"column":10,"offset":695},"indent":[]}},{"type":"text","value":" ","position":{"start":{"line":40,"column":10,"offset":695},"end":{"line":40,"column":11,"offset":696},"indent":[]}},{"type":"inlineCode","value":"(id: string) => *","position":{"start":{"line":40,"column":11,"offset":696},"end":{"line":40,"column":30,"offset":715},"indent":[]}},{"type":"break","position":{"start":{"line":40,"column":30,"offset":715},"end":{"line":41,"column":1,"offset":718},"indent":[1]}},{"type":"strong","children":[{"type":"text","value":"default:","position":{"start":{"line":41,"column":3,"offset":720},"end":{"line":41,"column":11,"offset":728},"indent":[]}}],"position":{"start":{"line":41,"column":1,"offset":718},"end":{"line":41,"column":13,"offset":730},"indent":[]}},{"type":"text","value":" ","position":{"start":{"line":41,"column":13,"offset":730},"end":{"line":41,"column":14,"offset":731},"indent":[]}},{"type":"inlineCode","value":"(value) => ({id: value})","position":{"start":{"line":41,"column":14,"offset":731},"end":{"line":41,"column":40,"offset":757},"indent":[]}},{"type":"text","value":"  ","position":{"start":{"line":41,"column":40,"offset":757},"end":{"line":41,"column":42,"offset":759},"indent":[]}}],"position":{"start":{"line":40,"column":1,"offset":686},"end":{"line":41,"column":42,"offset":759},"indent":[1]}},{"type":"paragraph","children":[{"type":"text","value":"By defualt the IdSchema constructs a faux entity by placing the value on the ","position":{"start":{"line":43,"column":1,"offset":761},"end":{"line":43,"column":78,"offset":838},"indent":[]}},{"type":"inlineCode","value":"id","position":{"start":{"line":43,"column":78,"offset":838},"end":{"line":43,"column":82,"offset":842},"indent":[]}},{"type":"text","value":" key of an \nobject. If your shape has a differnt idAtribute function you can replace this to match.","position":{"start":{"line":43,"column":82,"offset":842},"end":{"line":44,"column":88,"offset":941},"indent":[1]}}],"position":{"start":{"line":43,"column":1,"offset":761},"end":{"line":44,"column":88,"offset":941},"indent":[1]}},{"type":"code","lang":null,"meta":null,"value":"const user = new EntitySchema('user', {\n    idAtribute: user => user.email\n});\n\nconst friend = IdSchema(user, {\n    shape: value => ({email: value})\n});\nuser.set({friend});","position":{"start":{"line":46,"column":1,"offset":943},"end":{"line":55,"column":4,"offset":1123},"indent":[1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Methods","position":{"start":{"line":59,"column":4,"offset":1130},"end":{"line":59,"column":11,"offset":1137},"indent":[]}}],"position":{"start":{"line":59,"column":1,"offset":1127},"end":{"line":59,"column":11,"offset":1137},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":".normalize()","position":{"start":{"line":61,"column":5,"offset":1143},"end":{"line":61,"column":17,"offset":1155},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":1139},"end":{"line":61,"column":17,"offset":1155},"indent":[]}},{"type":"jsx","value":"<Normalize />","position":{"start":{"line":62,"column":1,"offset":1156},"end":{"line":62,"column":14,"offset":1169},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":".denormalize()","position":{"start":{"line":64,"column":5,"offset":1175},"end":{"line":64,"column":19,"offset":1189},"indent":[]}}],"position":{"start":{"line":64,"column":1,"offset":1171},"end":{"line":64,"column":19,"offset":1189},"indent":[]}},{"type":"jsx","value":"<Denormalize />","position":{"start":{"line":65,"column":1,"offset":1190},"end":{"line":65,"column":16,"offset":1205},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"id\":\"value-schema\",\"title\":\"Value Schema\",\"group\":\"Enty\"}","position":{"start":{"line":68,"column":1,"offset":1208},"end":{"line":68,"column":88,"offset":1295},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":68,"column":88,"offset":1295}}},"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  \"id\": \"value-schema\",\n  \"title\": \"Value 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 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, \"Sometimes data can exist in a partially normalized state. E.g. a user object has a friend key,\\nbut instead of the data giving you the whole object it just returns a user id in its place.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-js\"\n  }), \"// User\\n{\\n    id: '123',\\n    name: 'foo',\\n    friend: '456'\\n}\\n\")), mdx(\"p\", null, \"As long as you already have the friend normalized into state, the Value schemas lets you\\ndenormalize \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"friend\"), \" as a user.\"), mdx(\"h2\", null, \"Params\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-js\"\n  }), \"IdSchema(\\n    shape: Schema,\\n    options?: {\\n        shape: (value) => entity\\n    }\\n);\\n\")), mdx(\"h3\", null, \"shape\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"type:\"), \" \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Schema\"), \"  \"), mdx(\"p\", null, \"The Schema that this value represents.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-js\"\n  }), \"const user = new EntitySchema('user');\\nconst friend = IdSchema(user);\\nuser.set({friend});\\n\")), mdx(\"h3\", null, \"options.shape\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"type:\"), \" \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"(id: string) => *\"), mdx(\"br\", {\n    parentName: \"p\"\n  }), \"\\n\", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"default:\"), \" \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"(value) => ({id: value})\"), \"  \"), mdx(\"p\", null, \"By defualt the IdSchema constructs a faux entity by placing the value on the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"id\"), \" key of an\\nobject. If your shape has a differnt idAtribute function you can replace this to match.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {}), \"const user = new EntitySchema('user', {\\n    idAtribute: user => user.email\\n});\\n\\nconst friend = IdSchema(user, {\\n    shape: value => ({email: value})\\n});\\nuser.set({friend});\\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  \"id\": \"value-schema\",\n  \"title\": \"Value 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 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>{`Sometimes data can exist in a partially normalized state. E.g. a user object has a friend key,\nbut instead of the data giving you the whole object it just returns a user id in its place.`}</p>\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\"\n      }}>{`// User\n{\n    id: '123',\n    name: 'foo',\n    friend: '456'\n}\n`}</code></pre>\n    <p>{`As long as you already have the friend normalized into state, the Value schemas lets you\ndenormalize `}<inlineCode parentName=\"p\">{`friend`}</inlineCode>{` as a user.`}</p>\n    <h2>{`Params`}</h2>\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\"\n      }}>{`IdSchema(\n    shape: Schema,\n    options?: {\n        shape: (value) => entity\n    }\n);\n`}</code></pre>\n    <h3>{`shape`}</h3>\n    <p><strong parentName=\"p\">{`type:`}</strong>{` `}<inlineCode parentName=\"p\">{`Schema`}</inlineCode>{`  `}</p>\n    <p>{`The Schema that this value represents.`}</p>\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\"\n      }}>{`const user = new EntitySchema('user');\nconst friend = IdSchema(user);\nuser.set({friend});\n`}</code></pre>\n    <h3>{`options.shape`}</h3>\n    <p><strong parentName=\"p\">{`type:`}</strong>{` `}<inlineCode parentName=\"p\">{`(id: string) => *`}</inlineCode><br parentName=\"p\"></br>{`\n`}<strong parentName=\"p\">{`default:`}</strong>{` `}<inlineCode parentName=\"p\">{`(value) => ({id: value})`}</inlineCode>{`  `}</p>\n    <p>{`By defualt the IdSchema constructs a faux entity by placing the value on the `}<inlineCode parentName=\"p\">{`id`}</inlineCode>{` key of an\nobject. If your shape has a differnt idAtribute function you can replace this to match.`}</p>\n    <pre><code parentName=\"pre\" {...{}}>{`const user = new EntitySchema('user', {\n    idAtribute: user => user.email\n});\n\nconst friend = IdSchema(user, {\n    shape: value => ({email: value})\n});\nuser.set({friend});\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;"}}