{"expireTime":9007200821629488000,"key":"gatsby-plugin-mdx-entire-payload-95e676fb50471f0d50db7df10ff417a2-","val":{"mdast":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"The ArraySchema is a structural schema used to define relationships in homogeneous arrays.","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":91,"offset":91},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":91,"offset":91},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Params","position":{"start":{"line":4,"column":4,"offset":96},"end":{"line":4,"column":10,"offset":102},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":93},"end":{"line":4,"column":10,"offset":102},"indent":[]}},{"type":"code","lang":"js","meta":"live=true","value":"new ArraySchema(\n    shape: StructuralSchema,\n    options?: {\n        create?: (entity: A) => B,\n        merge?: (previous: A, next: B) => C\n    }\n);","position":{"start":{"line":6,"column":1,"offset":104},"end":{"line":14,"column":4,"offset":273},"indent":[1,1,1,1,1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"shape","position":{"start":{"line":16,"column":5,"offset":279},"end":{"line":16,"column":10,"offset":284},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":275},"end":{"line":16,"column":11,"offset":285},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"type:","position":{"start":{"line":17,"column":3,"offset":288},"end":{"line":17,"column":8,"offset":293},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":286},"end":{"line":17,"column":10,"offset":295},"indent":[]}},{"type":"text","value":" ","position":{"start":{"line":17,"column":10,"offset":295},"end":{"line":17,"column":11,"offset":296},"indent":[]}},{"type":"inlineCode","value":"StructuralSchema","position":{"start":{"line":17,"column":11,"offset":296},"end":{"line":17,"column":29,"offset":314},"indent":[]}},{"type":"text","value":"  ","position":{"start":{"line":17,"column":29,"offset":314},"end":{"line":17,"column":31,"offset":316},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":286},"end":{"line":17,"column":31,"offset":316},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"A single structural schema that describes what is in this collection.","position":{"start":{"line":19,"column":1,"offset":318},"end":{"line":19,"column":70,"offset":387},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":318},"end":{"line":19,"column":70,"offset":387},"indent":[]}},{"type":"code","lang":"jsx","meta":"live=true","value":"const person = new EntitySchema('person');\nconst friends = new ArraySchema(person);","position":{"start":{"line":21,"column":1,"offset":389},"end":{"line":24,"column":4,"offset":493},"indent":[1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"options.create","position":{"start":{"line":26,"column":5,"offset":499},"end":{"line":26,"column":19,"offset":513},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":495},"end":{"line":26,"column":20,"offset":514},"indent":[]}},{"type":"jsx","value":"<Create/>","position":{"start":{"line":27,"column":1,"offset":515},"end":{"line":27,"column":10,"offset":524},"indent":[]}},{"type":"code","lang":"js","meta":null,"value":"const friends = new ArraySchema(person, {\n    create: (entity) => new List(entity)\n});","position":{"start":{"line":29,"column":1,"offset":526},"end":{"line":33,"column":4,"offset":622},"indent":[1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"text","value":"options.merge","position":{"start":{"line":35,"column":5,"offset":628},"end":{"line":35,"column":18,"offset":641},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":624},"end":{"line":35,"column":19,"offset":642},"indent":[]}},{"type":"jsx","value":"<Merge default=\"(previous, next) => next\" />","position":{"start":{"line":36,"column":1,"offset":643},"end":{"line":36,"column":45,"offset":687},"indent":[]}},{"type":"paragraph","children":[{"type":"emphasis","children":[{"type":"text","value":"Note: The default merge for an array is to just accept the new one. But you can\ncreate some interesting funcitonality with custom merge function. E.g. if your merge functions concats\nthe two arrays, you would create an append only list.","position":{"start":{"line":38,"column":2,"offset":690},"end":{"line":40,"column":54,"offset":926},"indent":[1,1]}}],"position":{"start":{"line":38,"column":1,"offset":689},"end":{"line":40,"column":55,"offset":927},"indent":[1,1]}}],"position":{"start":{"line":38,"column":1,"offset":689},"end":{"line":40,"column":55,"offset":927},"indent":[1,1]}},{"type":"code","lang":"js","meta":null,"value":"const person = new ArraySchema({}, {\n    merge: (prev, next) => prev.concat(next)\n});","position":{"start":{"line":42,"column":1,"offset":929},"end":{"line":46,"column":4,"offset":1024},"indent":[1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"text","value":"Methods","position":{"start":{"line":49,"column":4,"offset":1030},"end":{"line":49,"column":11,"offset":1037},"indent":[]}}],"position":{"start":{"line":49,"column":1,"offset":1027},"end":{"line":49,"column":11,"offset":1037},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":".normalize()","position":{"start":{"line":51,"column":5,"offset":1043},"end":{"line":51,"column":17,"offset":1055},"indent":[]}}],"position":{"start":{"line":51,"column":1,"offset":1039},"end":{"line":51,"column":17,"offset":1055},"indent":[]}},{"type":"jsx","value":"<Normalize />","position":{"start":{"line":52,"column":1,"offset":1056},"end":{"line":52,"column":14,"offset":1069},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"text","value":".denormalize()","position":{"start":{"line":54,"column":5,"offset":1075},"end":{"line":54,"column":19,"offset":1089},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":1071},"end":{"line":54,"column":19,"offset":1089},"indent":[]}},{"type":"jsx","value":"<Denormalize />","position":{"start":{"line":55,"column":1,"offset":1090},"end":{"line":55,"column":16,"offset":1105},"indent":[]}},{"type":"export","value":"export const _frontmatter = {\"title\":\"Array Schema\",\"group\":\"Enty\"}","position":{"start":{"line":59,"column":1,"offset":1109},"end":{"line":59,"column":68,"offset":1176},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":59,"column":68,"offset":1176}}},"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\": \"Array 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 ArraySchema is a structural schema used to define relationships in homogeneous arrays.\"), mdx(\"h2\", null, \"Params\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-js\",\n    \"metastring\": \"live=true\",\n    \"live\": \"true\"\n  }), \"new ArraySchema(\\n    shape: StructuralSchema,\\n    options?: {\\n        create?: (entity: A) => B,\\n        merge?: (previous: A, next: B) => C\\n    }\\n);\\n\")), mdx(\"h3\", null, \"shape\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"type:\"), \" \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"StructuralSchema\"), \"  \"), mdx(\"p\", null, \"A single structural schema that describes what is in this collection.\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-jsx\",\n    \"metastring\": \"live=true\",\n    \"live\": \"true\"\n  }), \"const person = new EntitySchema('person');\\nconst friends = new ArraySchema(person);\\n\")), mdx(\"h3\", null, \"options.create\"), mdx(Create, {\n    mdxType: \"Create\"\n  }), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-js\"\n  }), \"const friends = new ArraySchema(person, {\\n    create: (entity) => new List(entity)\\n});\\n\")), mdx(\"h3\", null, \"options.merge\"), mdx(Merge, {\n    \"default\": \"(previous, next) => next\",\n    mdxType: \"Merge\"\n  }), mdx(\"p\", null, mdx(\"em\", {\n    parentName: \"p\"\n  }, \"Note: The default merge for an array is to just accept the new one. But you can\\ncreate some interesting funcitonality with custom merge function. E.g. if your merge functions concats\\nthe two arrays, you would create an append only list.\")), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-js\"\n  }), \"const person = new ArraySchema({}, {\\n    merge: (prev, next) => prev.concat(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\": \"Array 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 ArraySchema is a structural schema used to define relationships in homogeneous arrays.`}</p>\n    <h2>{`Params`}</h2>\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\",\n        \"metastring\": \"live=true\",\n        \"live\": \"true\"\n      }}>{`new ArraySchema(\n    shape: StructuralSchema,\n    options?: {\n        create?: (entity: A) => B,\n        merge?: (previous: A, next: B) => C\n    }\n);\n`}</code></pre>\n    <h3>{`shape`}</h3>\n    <p><strong parentName=\"p\">{`type:`}</strong>{` `}<inlineCode parentName=\"p\">{`StructuralSchema`}</inlineCode>{`  `}</p>\n    <p>{`A single structural schema that describes what is in this collection.`}</p>\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-jsx\",\n        \"metastring\": \"live=true\",\n        \"live\": \"true\"\n      }}>{`const person = new EntitySchema('person');\nconst friends = new ArraySchema(person);\n`}</code></pre>\n    <h3>{`options.create`}</h3>\n    <Create mdxType=\"Create\" />\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\"\n      }}>{`const friends = new ArraySchema(person, {\n    create: (entity) => new List(entity)\n});\n`}</code></pre>\n    <h3>{`options.merge`}</h3>\n    <Merge default=\"(previous, next) => next\" mdxType=\"Merge\" />\n    <p><em parentName=\"p\">{`Note: The default merge for an array is to just accept the new one. But you can\ncreate some interesting funcitonality with custom merge function. E.g. if your merge functions concats\nthe two arrays, you would create an append only list.`}</em></p>\n    <pre><code parentName=\"pre\" {...{\n        \"className\": \"language-js\"\n      }}>{`const person = new ArraySchema({}, {\n    merge: (prev, next) => prev.concat(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;"}}