Models documentation (#972)
This commit is contained in:
Родитель
e11440f0b4
Коммит
e07d86c87a
|
@ -70,6 +70,7 @@ specifiers:
|
|||
grammarkdown: ~3.1.2
|
||||
js-yaml: ~4.1.0
|
||||
lzutf8: 0.6.2
|
||||
mermaid: ~9.1.6
|
||||
mkdirp: ~1.0.4
|
||||
mocha: ~9.2.0
|
||||
mocha-junit-reporter: ~2.0.2
|
||||
|
@ -177,6 +178,7 @@ dependencies:
|
|||
grammarkdown: 3.1.2
|
||||
js-yaml: 4.1.0
|
||||
lzutf8: 0.6.2
|
||||
mermaid: 9.1.6
|
||||
mkdirp: 1.0.4
|
||||
mocha: 9.2.2
|
||||
mocha-junit-reporter: 2.0.2_mocha@9.2.2
|
||||
|
@ -1988,6 +1990,11 @@ packages:
|
|||
engines: {node: '>= 6'}
|
||||
dev: false
|
||||
|
||||
/commander/7.2.0:
|
||||
resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==}
|
||||
engines: {node: '>= 10'}
|
||||
dev: false
|
||||
|
||||
/commondir/1.0.1:
|
||||
resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==}
|
||||
dev: false
|
||||
|
@ -2176,6 +2183,487 @@ packages:
|
|||
resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==}
|
||||
dev: false
|
||||
|
||||
/d3-array/1.2.4:
|
||||
resolution: {integrity: sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw==}
|
||||
dev: false
|
||||
|
||||
/d3-array/3.2.0:
|
||||
resolution: {integrity: sha512-3yXFQo0oG3QCxbF06rMPFyGRMGJNS7NvsV1+2joOjbBE+9xvWQ8+GcMJAjRCzw06zQ3/arXeJgbPYcjUCuC+3g==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
internmap: 2.0.3
|
||||
dev: false
|
||||
|
||||
/d3-axis/1.0.12:
|
||||
resolution: {integrity: sha512-ejINPfPSNdGFKEOAtnBtdkpr24c4d4jsei6Lg98mxf424ivoDP2956/5HDpIAtmHo85lqT4pruy+zEgvRUBqaQ==}
|
||||
dev: false
|
||||
|
||||
/d3-axis/3.0.0:
|
||||
resolution: {integrity: sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-brush/1.1.6:
|
||||
resolution: {integrity: sha512-7RW+w7HfMCPyZLifTz/UnJmI5kdkXtpCbombUSs8xniAyo0vIbrDzDwUJB6eJOgl9u5DQOt2TQlYumxzD1SvYA==}
|
||||
dependencies:
|
||||
d3-dispatch: 1.0.6
|
||||
d3-drag: 1.2.5
|
||||
d3-interpolate: 1.4.0
|
||||
d3-selection: 1.4.2
|
||||
d3-transition: 1.3.2
|
||||
dev: false
|
||||
|
||||
/d3-brush/3.0.0:
|
||||
resolution: {integrity: sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-dispatch: 3.0.1
|
||||
d3-drag: 3.0.0
|
||||
d3-interpolate: 3.0.1
|
||||
d3-selection: 3.0.0
|
||||
d3-transition: 3.0.1_d3-selection@3.0.0
|
||||
dev: false
|
||||
|
||||
/d3-chord/1.0.6:
|
||||
resolution: {integrity: sha512-JXA2Dro1Fxw9rJe33Uv+Ckr5IrAa74TlfDEhE/jfLOaXegMQFQTAgAw9WnZL8+HxVBRXaRGCkrNU7pJeylRIuA==}
|
||||
dependencies:
|
||||
d3-array: 1.2.4
|
||||
d3-path: 1.0.9
|
||||
dev: false
|
||||
|
||||
/d3-chord/3.0.1:
|
||||
resolution: {integrity: sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-path: 3.0.1
|
||||
dev: false
|
||||
|
||||
/d3-collection/1.0.7:
|
||||
resolution: {integrity: sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==}
|
||||
dev: false
|
||||
|
||||
/d3-color/1.4.1:
|
||||
resolution: {integrity: sha512-p2sTHSLCJI2QKunbGb7ocOh7DgTAn8IrLx21QRc/BSnodXM4sv6aLQlnfpvehFMLZEfBc6g9pH9SWQccFYfJ9Q==}
|
||||
dev: false
|
||||
|
||||
/d3-color/3.1.0:
|
||||
resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-contour/1.3.2:
|
||||
resolution: {integrity: sha512-hoPp4K/rJCu0ladiH6zmJUEz6+u3lgR+GSm/QdM2BBvDraU39Vr7YdDCicJcxP1z8i9B/2dJLgDC1NcvlF8WCg==}
|
||||
dependencies:
|
||||
d3-array: 1.2.4
|
||||
dev: false
|
||||
|
||||
/d3-contour/4.0.0:
|
||||
resolution: {integrity: sha512-7aQo0QHUTu/Ko3cP9YK9yUTxtoDEiDGwnBHyLxG5M4vqlBkO/uixMRele3nfsfj6UXOcuReVpVXzAboGraYIJw==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-array: 3.2.0
|
||||
dev: false
|
||||
|
||||
/d3-delaunay/6.0.2:
|
||||
resolution: {integrity: sha512-IMLNldruDQScrcfT+MWnazhHbDJhcRJyOEBAJfwQnHle1RPh6WDuLvxNArUju2VSMSUuKlY5BGHRJ2cYyoFLQQ==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
delaunator: 5.0.0
|
||||
dev: false
|
||||
|
||||
/d3-dispatch/1.0.6:
|
||||
resolution: {integrity: sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA==}
|
||||
dev: false
|
||||
|
||||
/d3-dispatch/3.0.1:
|
||||
resolution: {integrity: sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-drag/1.2.5:
|
||||
resolution: {integrity: sha512-rD1ohlkKQwMZYkQlYVCrSFxsWPzI97+W+PaEIBNTMxRuxz9RF0Hi5nJWHGVJ3Om9d2fRTe1yOBINJyy/ahV95w==}
|
||||
dependencies:
|
||||
d3-dispatch: 1.0.6
|
||||
d3-selection: 1.4.2
|
||||
dev: false
|
||||
|
||||
/d3-drag/3.0.0:
|
||||
resolution: {integrity: sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-dispatch: 3.0.1
|
||||
d3-selection: 3.0.0
|
||||
dev: false
|
||||
|
||||
/d3-dsv/1.2.0:
|
||||
resolution: {integrity: sha512-9yVlqvZcSOMhCYzniHE7EVUws7Fa1zgw+/EAV2BxJoG3ME19V6BQFBwI855XQDsxyOuG7NibqRMTtiF/Qup46g==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
commander: 2.20.3
|
||||
iconv-lite: 0.4.24
|
||||
rw: 1.3.3
|
||||
dev: false
|
||||
|
||||
/d3-dsv/3.0.1:
|
||||
resolution: {integrity: sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==}
|
||||
engines: {node: '>=12'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
commander: 7.2.0
|
||||
iconv-lite: 0.6.3
|
||||
rw: 1.3.3
|
||||
dev: false
|
||||
|
||||
/d3-ease/1.0.7:
|
||||
resolution: {integrity: sha512-lx14ZPYkhNx0s/2HX5sLFUI3mbasHjSSpwO/KaaNACweVwxUruKyWVcb293wMv1RqTPZyZ8kSZ2NogUZNcLOFQ==}
|
||||
dev: false
|
||||
|
||||
/d3-ease/3.0.1:
|
||||
resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-fetch/1.2.0:
|
||||
resolution: {integrity: sha512-yC78NBVcd2zFAyR/HnUiBS7Lf6inSCoWcSxFfw8FYL7ydiqe80SazNwoffcqOfs95XaLo7yebsmQqDKSsXUtvA==}
|
||||
dependencies:
|
||||
d3-dsv: 1.2.0
|
||||
dev: false
|
||||
|
||||
/d3-fetch/3.0.1:
|
||||
resolution: {integrity: sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-dsv: 3.0.1
|
||||
dev: false
|
||||
|
||||
/d3-force/1.2.1:
|
||||
resolution: {integrity: sha512-HHvehyaiUlVo5CxBJ0yF/xny4xoaxFxDnBXNvNcfW9adORGZfyNF1dj6DGLKyk4Yh3brP/1h3rnDzdIAwL08zg==}
|
||||
dependencies:
|
||||
d3-collection: 1.0.7
|
||||
d3-dispatch: 1.0.6
|
||||
d3-quadtree: 1.0.7
|
||||
d3-timer: 1.0.10
|
||||
dev: false
|
||||
|
||||
/d3-force/3.0.0:
|
||||
resolution: {integrity: sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-dispatch: 3.0.1
|
||||
d3-quadtree: 3.0.1
|
||||
d3-timer: 3.0.1
|
||||
dev: false
|
||||
|
||||
/d3-format/1.4.5:
|
||||
resolution: {integrity: sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ==}
|
||||
dev: false
|
||||
|
||||
/d3-format/3.1.0:
|
||||
resolution: {integrity: sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-geo/1.12.1:
|
||||
resolution: {integrity: sha512-XG4d1c/UJSEX9NfU02KwBL6BYPj8YKHxgBEw5om2ZnTRSbIcego6dhHwcxuSR3clxh0EpE38os1DVPOmnYtTPg==}
|
||||
dependencies:
|
||||
d3-array: 1.2.4
|
||||
dev: false
|
||||
|
||||
/d3-geo/3.0.1:
|
||||
resolution: {integrity: sha512-Wt23xBych5tSy9IYAM1FR2rWIBFWa52B/oF/GYe5zbdHrg08FU8+BuI6X4PvTwPDdqdAdq04fuWJpELtsaEjeA==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-array: 3.2.0
|
||||
dev: false
|
||||
|
||||
/d3-hierarchy/1.1.9:
|
||||
resolution: {integrity: sha512-j8tPxlqh1srJHAtxfvOUwKNYJkQuBFdM1+JAUfq6xqH5eAqf93L7oG1NVqDa4CpFZNvnNKtCYEUC8KY9yEn9lQ==}
|
||||
dev: false
|
||||
|
||||
/d3-hierarchy/3.1.2:
|
||||
resolution: {integrity: sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-interpolate/1.4.0:
|
||||
resolution: {integrity: sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA==}
|
||||
dependencies:
|
||||
d3-color: 1.4.1
|
||||
dev: false
|
||||
|
||||
/d3-interpolate/3.0.1:
|
||||
resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-color: 3.1.0
|
||||
dev: false
|
||||
|
||||
/d3-path/1.0.9:
|
||||
resolution: {integrity: sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==}
|
||||
dev: false
|
||||
|
||||
/d3-path/3.0.1:
|
||||
resolution: {integrity: sha512-gq6gZom9AFZby0YLduxT1qmrp4xpBA1YZr19OI717WIdKE2OM5ETq5qrHLb301IgxhLwcuxvGZVLeeWc/k1I6w==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-polygon/1.0.6:
|
||||
resolution: {integrity: sha512-k+RF7WvI08PC8reEoXa/w2nSg5AUMTi+peBD9cmFc+0ixHfbs4QmxxkarVal1IkVkgxVuk9JSHhJURHiyHKAuQ==}
|
||||
dev: false
|
||||
|
||||
/d3-polygon/3.0.1:
|
||||
resolution: {integrity: sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-quadtree/1.0.7:
|
||||
resolution: {integrity: sha512-RKPAeXnkC59IDGD0Wu5mANy0Q2V28L+fNe65pOCXVdVuTJS3WPKaJlFHer32Rbh9gIo9qMuJXio8ra4+YmIymA==}
|
||||
dev: false
|
||||
|
||||
/d3-quadtree/3.0.1:
|
||||
resolution: {integrity: sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-random/1.1.2:
|
||||
resolution: {integrity: sha512-6AK5BNpIFqP+cx/sreKzNjWbwZQCSUatxq+pPRmFIQaWuoD+NrbVWw7YWpHiXpCQ/NanKdtGDuB+VQcZDaEmYQ==}
|
||||
dev: false
|
||||
|
||||
/d3-random/3.0.1:
|
||||
resolution: {integrity: sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-scale-chromatic/1.5.0:
|
||||
resolution: {integrity: sha512-ACcL46DYImpRFMBcpk9HhtIyC7bTBR4fNOPxwVSl0LfulDAwyiHyPOTqcDG1+t5d4P9W7t/2NAuWu59aKko/cg==}
|
||||
dependencies:
|
||||
d3-color: 1.4.1
|
||||
d3-interpolate: 1.4.0
|
||||
dev: false
|
||||
|
||||
/d3-scale-chromatic/3.0.0:
|
||||
resolution: {integrity: sha512-Lx9thtxAKrO2Pq6OO2Ua474opeziKr279P/TKZsMAhYyNDD3EnCffdbgeSYN5O7m2ByQsxtuP2CSDczNUIZ22g==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-color: 3.1.0
|
||||
d3-interpolate: 3.0.1
|
||||
dev: false
|
||||
|
||||
/d3-scale/2.2.2:
|
||||
resolution: {integrity: sha512-LbeEvGgIb8UMcAa0EATLNX0lelKWGYDQiPdHj+gLblGVhGLyNbaCn3EvrJf0A3Y/uOOU5aD6MTh5ZFCdEwGiCw==}
|
||||
dependencies:
|
||||
d3-array: 1.2.4
|
||||
d3-collection: 1.0.7
|
||||
d3-format: 1.4.5
|
||||
d3-interpolate: 1.4.0
|
||||
d3-time: 1.1.0
|
||||
d3-time-format: 2.3.0
|
||||
dev: false
|
||||
|
||||
/d3-scale/4.0.2:
|
||||
resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-array: 3.2.0
|
||||
d3-format: 3.1.0
|
||||
d3-interpolate: 3.0.1
|
||||
d3-time: 3.0.0
|
||||
d3-time-format: 4.1.0
|
||||
dev: false
|
||||
|
||||
/d3-selection/1.4.2:
|
||||
resolution: {integrity: sha512-SJ0BqYihzOjDnnlfyeHT0e30k0K1+5sR3d5fNueCNeuhZTnGw4M4o8mqJchSwgKMXCNFo+e2VTChiSJ0vYtXkg==}
|
||||
dev: false
|
||||
|
||||
/d3-selection/3.0.0:
|
||||
resolution: {integrity: sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-shape/1.3.7:
|
||||
resolution: {integrity: sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==}
|
||||
dependencies:
|
||||
d3-path: 1.0.9
|
||||
dev: false
|
||||
|
||||
/d3-shape/3.1.0:
|
||||
resolution: {integrity: sha512-tGDh1Muf8kWjEDT/LswZJ8WF85yDZLvVJpYU9Nq+8+yW1Z5enxrmXOhTArlkaElU+CTn0OTVNli+/i+HP45QEQ==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-path: 3.0.1
|
||||
dev: false
|
||||
|
||||
/d3-time-format/2.3.0:
|
||||
resolution: {integrity: sha512-guv6b2H37s2Uq/GefleCDtbe0XZAuy7Wa49VGkPVPMfLL9qObgBST3lEHJBMUp8S7NdLQAGIvr2KXk8Hc98iKQ==}
|
||||
dependencies:
|
||||
d3-time: 1.1.0
|
||||
dev: false
|
||||
|
||||
/d3-time-format/4.1.0:
|
||||
resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-time: 3.0.0
|
||||
dev: false
|
||||
|
||||
/d3-time/1.1.0:
|
||||
resolution: {integrity: sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA==}
|
||||
dev: false
|
||||
|
||||
/d3-time/3.0.0:
|
||||
resolution: {integrity: sha512-zmV3lRnlaLI08y9IMRXSDshQb5Nj77smnfpnd2LrBa/2K281Jijactokeak14QacHs/kKq0AQ121nidNYlarbQ==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-array: 3.2.0
|
||||
dev: false
|
||||
|
||||
/d3-timer/1.0.10:
|
||||
resolution: {integrity: sha512-B1JDm0XDaQC+uvo4DT79H0XmBskgS3l6Ve+1SBCfxgmtIb1AVrPIoqd+nPSv+loMX8szQ0sVUhGngL7D5QPiXw==}
|
||||
dev: false
|
||||
|
||||
/d3-timer/3.0.1:
|
||||
resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/d3-transition/1.3.2:
|
||||
resolution: {integrity: sha512-sc0gRU4PFqZ47lPVHloMn9tlPcv8jxgOQg+0zjhfZXMQuvppjG6YuwdMBE0TuqCZjeJkLecku/l9R0JPcRhaDA==}
|
||||
dependencies:
|
||||
d3-color: 1.4.1
|
||||
d3-dispatch: 1.0.6
|
||||
d3-ease: 1.0.7
|
||||
d3-interpolate: 1.4.0
|
||||
d3-selection: 1.4.2
|
||||
d3-timer: 1.0.10
|
||||
dev: false
|
||||
|
||||
/d3-transition/3.0.1_d3-selection@3.0.0:
|
||||
resolution: {integrity: sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==}
|
||||
engines: {node: '>=12'}
|
||||
peerDependencies:
|
||||
d3-selection: 2 - 3
|
||||
dependencies:
|
||||
d3-color: 3.1.0
|
||||
d3-dispatch: 3.0.1
|
||||
d3-ease: 3.0.1
|
||||
d3-interpolate: 3.0.1
|
||||
d3-selection: 3.0.0
|
||||
d3-timer: 3.0.1
|
||||
dev: false
|
||||
|
||||
/d3-voronoi/1.1.4:
|
||||
resolution: {integrity: sha512-dArJ32hchFsrQ8uMiTBLq256MpnZjeuBtdHpaDlYuQyjU0CVzCJl/BVW+SkszaAeH95D/8gxqAhgx0ouAWAfRg==}
|
||||
dev: false
|
||||
|
||||
/d3-zoom/1.8.3:
|
||||
resolution: {integrity: sha512-VoLXTK4wvy1a0JpH2Il+F2CiOhVu7VRXWF5M/LroMIh3/zBAC3WAt7QoIvPibOavVo20hN6/37vwAsdBejLyKQ==}
|
||||
dependencies:
|
||||
d3-dispatch: 1.0.6
|
||||
d3-drag: 1.2.5
|
||||
d3-interpolate: 1.4.0
|
||||
d3-selection: 1.4.2
|
||||
d3-transition: 1.3.2
|
||||
dev: false
|
||||
|
||||
/d3-zoom/3.0.0:
|
||||
resolution: {integrity: sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-dispatch: 3.0.1
|
||||
d3-drag: 3.0.0
|
||||
d3-interpolate: 3.0.1
|
||||
d3-selection: 3.0.0
|
||||
d3-transition: 3.0.1_d3-selection@3.0.0
|
||||
dev: false
|
||||
|
||||
/d3/5.16.0:
|
||||
resolution: {integrity: sha512-4PL5hHaHwX4m7Zr1UapXW23apo6pexCgdetdJ5kTmADpG/7T9Gkxw0M0tf/pjoB63ezCCm0u5UaFYy2aMt0Mcw==}
|
||||
dependencies:
|
||||
d3-array: 1.2.4
|
||||
d3-axis: 1.0.12
|
||||
d3-brush: 1.1.6
|
||||
d3-chord: 1.0.6
|
||||
d3-collection: 1.0.7
|
||||
d3-color: 1.4.1
|
||||
d3-contour: 1.3.2
|
||||
d3-dispatch: 1.0.6
|
||||
d3-drag: 1.2.5
|
||||
d3-dsv: 1.2.0
|
||||
d3-ease: 1.0.7
|
||||
d3-fetch: 1.2.0
|
||||
d3-force: 1.2.1
|
||||
d3-format: 1.4.5
|
||||
d3-geo: 1.12.1
|
||||
d3-hierarchy: 1.1.9
|
||||
d3-interpolate: 1.4.0
|
||||
d3-path: 1.0.9
|
||||
d3-polygon: 1.0.6
|
||||
d3-quadtree: 1.0.7
|
||||
d3-random: 1.1.2
|
||||
d3-scale: 2.2.2
|
||||
d3-scale-chromatic: 1.5.0
|
||||
d3-selection: 1.4.2
|
||||
d3-shape: 1.3.7
|
||||
d3-time: 1.1.0
|
||||
d3-time-format: 2.3.0
|
||||
d3-timer: 1.0.10
|
||||
d3-transition: 1.3.2
|
||||
d3-voronoi: 1.1.4
|
||||
d3-zoom: 1.8.3
|
||||
dev: false
|
||||
|
||||
/d3/7.6.1:
|
||||
resolution: {integrity: sha512-txMTdIHFbcpLx+8a0IFhZsbp+PfBBPt8yfbmukZTQFroKuFqIwqswF0qE5JXWefylaAVpSXFoKm3yP+jpNLFLw==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
d3-array: 3.2.0
|
||||
d3-axis: 3.0.0
|
||||
d3-brush: 3.0.0
|
||||
d3-chord: 3.0.1
|
||||
d3-color: 3.1.0
|
||||
d3-contour: 4.0.0
|
||||
d3-delaunay: 6.0.2
|
||||
d3-dispatch: 3.0.1
|
||||
d3-drag: 3.0.0
|
||||
d3-dsv: 3.0.1
|
||||
d3-ease: 3.0.1
|
||||
d3-fetch: 3.0.1
|
||||
d3-force: 3.0.0
|
||||
d3-format: 3.1.0
|
||||
d3-geo: 3.0.1
|
||||
d3-hierarchy: 3.1.2
|
||||
d3-interpolate: 3.0.1
|
||||
d3-path: 3.0.1
|
||||
d3-polygon: 3.0.1
|
||||
d3-quadtree: 3.0.1
|
||||
d3-random: 3.0.1
|
||||
d3-scale: 4.0.2
|
||||
d3-scale-chromatic: 3.0.0
|
||||
d3-selection: 3.0.0
|
||||
d3-shape: 3.1.0
|
||||
d3-time: 3.0.0
|
||||
d3-time-format: 4.1.0
|
||||
d3-timer: 3.0.1
|
||||
d3-transition: 3.0.1_d3-selection@3.0.0
|
||||
d3-zoom: 3.0.0
|
||||
dev: false
|
||||
|
||||
/dagre-d3/0.6.4:
|
||||
resolution: {integrity: sha512-e/6jXeCP7/ptlAM48clmX4xTZc5Ek6T6kagS7Oz2HrYSdqcLZFLqpAfh7ldbZRFfxCZVyh61NEPR08UQRVxJzQ==}
|
||||
dependencies:
|
||||
d3: 5.16.0
|
||||
dagre: 0.8.5
|
||||
graphlib: 2.1.8
|
||||
lodash: 4.17.21
|
||||
dev: false
|
||||
|
||||
/dagre/0.8.5:
|
||||
resolution: {integrity: sha512-/aTqmnRta7x7MCCpExk7HQL2O4owCT2h8NT//9I1OQ9vt29Pa0BzSAkR5lwFUcQ7491yVi/3CXU9jQ5o0Mn2Sw==}
|
||||
dependencies:
|
||||
graphlib: 2.1.8
|
||||
lodash: 4.17.21
|
||||
dev: false
|
||||
|
||||
/data-uri-to-buffer/4.0.0:
|
||||
resolution: {integrity: sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==}
|
||||
engines: {node: '>= 12'}
|
||||
|
@ -2289,6 +2777,12 @@ packages:
|
|||
engines: {node: '>=8'}
|
||||
dev: false
|
||||
|
||||
/delaunator/5.0.0:
|
||||
resolution: {integrity: sha512-AyLvtyJdbv/U1GkiS6gUUzclRoAY4Gs75qkMygJJhU75LW4DNuSF2RMzpxs9jw9Oz1BobHjTdkG3zdP55VxAqw==}
|
||||
dependencies:
|
||||
robust-predicates: 3.0.1
|
||||
dev: false
|
||||
|
||||
/delayed-stream/1.0.0:
|
||||
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
|
@ -3414,6 +3908,12 @@ packages:
|
|||
resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==}
|
||||
dev: false
|
||||
|
||||
/graphlib/2.1.8:
|
||||
resolution: {integrity: sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==}
|
||||
dependencies:
|
||||
lodash: 4.17.21
|
||||
dev: false
|
||||
|
||||
/gray-matter/4.0.3:
|
||||
resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==}
|
||||
engines: {node: '>=6.0'}
|
||||
|
@ -3689,6 +4189,11 @@ packages:
|
|||
resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==}
|
||||
dev: false
|
||||
|
||||
/internmap/2.0.3:
|
||||
resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/invariant/2.2.4:
|
||||
resolution: {integrity: sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==}
|
||||
dependencies:
|
||||
|
@ -4032,6 +4537,10 @@ packages:
|
|||
prebuild-install: 7.1.1
|
||||
dev: false
|
||||
|
||||
/khroma/2.0.0:
|
||||
resolution: {integrity: sha512-2J8rDNlQWbtiNYThZRvmMv5yt44ZakX+Tz5ZIp/mN1pt4snn+m030Va5Z4v8xA0cQFDXBwO/8i42xL4QPsVk3g==}
|
||||
dev: false
|
||||
|
||||
/kind-of/3.2.2:
|
||||
resolution: {integrity: sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
@ -4278,6 +4787,20 @@ packages:
|
|||
engines: {node: '>= 8'}
|
||||
dev: false
|
||||
|
||||
/mermaid/9.1.6:
|
||||
resolution: {integrity: sha512-oBuQk7s55wQgEgH/AK0GYY8U0kBqOIGK9QlJL+VYxh+1kZQtU9tNwoy0gWCfBJDaFIRdfpc/fm9PagaIXg6XFQ==}
|
||||
dependencies:
|
||||
'@braintree/sanitize-url': 6.0.0
|
||||
d3: 7.6.1
|
||||
dagre: 0.8.5
|
||||
dagre-d3: 0.6.4
|
||||
dompurify: 2.3.10
|
||||
graphlib: 2.1.8
|
||||
khroma: 2.0.0
|
||||
moment-mini: 2.24.0
|
||||
stylis: 4.1.1
|
||||
dev: false
|
||||
|
||||
/micromatch/4.0.5:
|
||||
resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==}
|
||||
engines: {node: '>=8.6'}
|
||||
|
@ -4421,6 +4944,10 @@ packages:
|
|||
yargs-unparser: 2.0.0
|
||||
dev: false
|
||||
|
||||
/moment-mini/2.24.0:
|
||||
resolution: {integrity: sha512-9ARkWHBs+6YJIvrIp0Ik5tyTTtP9PoV0Ssu2Ocq5y9v8+NOOpWiRshAp8c4rZVWTOe+157on/5G+zj5pwIQFEQ==}
|
||||
dev: false
|
||||
|
||||
/monaco-editor/0.32.1:
|
||||
resolution: {integrity: sha512-LUt2wsUvQmEi2tfTOK+tjAPvt7eQ+K5C4rZPr6SeuyzjAuAHrIvlUloTcOiGjZW3fn3a/jFQCONrEJbNOaCqbA==}
|
||||
dev: false
|
||||
|
@ -5495,6 +6022,10 @@ packages:
|
|||
glob: 7.2.3
|
||||
dev: false
|
||||
|
||||
/robust-predicates/3.0.1:
|
||||
resolution: {integrity: sha512-ndEIpszUHiG4HtDsQLeIuMvRsDnn8c8rYStabochtUeCvfuvNptb5TUbVD68LRAILPX7p9nqQGh4xJgn3EHS/g==}
|
||||
dev: false
|
||||
|
||||
/rollup-plugin-visualizer/5.8.0_rollup@2.70.2:
|
||||
resolution: {integrity: sha512-pY6j/7qHz5I9rB7d/bQoA5gX+2FbV3MBG055wrsFxDn550bgl0FNViRj6wDHh85PMswv+JVdZjhnMBzz/hdAHA==}
|
||||
engines: {node: '>=14'}
|
||||
|
@ -5523,6 +6054,10 @@ packages:
|
|||
queue-microtask: 1.2.3
|
||||
dev: false
|
||||
|
||||
/rw/1.3.3:
|
||||
resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==}
|
||||
dev: false
|
||||
|
||||
/rx/4.1.0:
|
||||
resolution: {integrity: sha512-CiaiuN6gapkdl+cZUr67W6I8jquN4lkak3vtIsIWCl4XIPP8ffsoyN6/+PuGXnQy8Cu8W2y9Xxh31Rq4M6wUug==}
|
||||
dev: false
|
||||
|
@ -5984,6 +6519,10 @@ packages:
|
|||
supports-color: 5.5.0
|
||||
dev: false
|
||||
|
||||
/stylis/4.1.1:
|
||||
resolution: {integrity: sha512-lVrM/bNdhVX2OgBFNa2YJ9Lxj7kPzylieHd3TNjuGE0Re9JB7joL5VUKOVH1kdNNJTgGPpT8hmwIAPLaSyEVFQ==}
|
||||
dev: false
|
||||
|
||||
/supports-color/2.0.0:
|
||||
resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==}
|
||||
engines: {node: '>=0.8.0'}
|
||||
|
@ -7215,16 +7754,19 @@ packages:
|
|||
dev: false
|
||||
|
||||
file:projects/website.tgz:
|
||||
resolution: {integrity: sha512-mAywL0lFvLeHOEjLaz+ZYzimrSV7SGU7Q0peCmov6GZgmOncs5kJE6OIloj7IHBhfSYgoDH/cJX/pVflhfraaw==, tarball: file:projects/website.tgz}
|
||||
resolution: {integrity: sha512-BL129leaIALLrLkAWRCUHAUCvD27Fc+lS6Zu2c6XhDzU3LHHH7wkq90iqZuPF0AKr2PI5X4nzx8xo1OCYoXZOQ==, tarball: file:projects/website.tgz}
|
||||
name: '@rush-temp/website'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@11ty/eleventy': 1.0.2
|
||||
'@11ty/eleventy-navigation': 0.3.5
|
||||
'@11ty/eleventy-plugin-syntaxhighlight': 4.1.0
|
||||
'@playwright/test': 1.25.1
|
||||
'@types/node': 16.0.3
|
||||
eslint: 8.21.0
|
||||
feather-icons: 4.29.0
|
||||
mermaid: 9.1.6
|
||||
playwright: 1.25.1
|
||||
prism-themes: 1.9.0
|
||||
rimraf: 3.0.2
|
||||
transitivePeerDependencies:
|
||||
|
|
|
@ -10,7 +10,7 @@ WORKDIR /app
|
|||
ENV CADL_SKIP_VS_BUILD=1
|
||||
RUN npm install -g @microsoft/rush
|
||||
RUN rush install
|
||||
RUN rush rebuild
|
||||
RUN rush rebuild --to @cadl-lang/compiler
|
||||
|
||||
WORKDIR /app/packages/compiler
|
||||
RUN npm pack
|
||||
|
|
|
@ -43,7 +43,7 @@ model Dog {
|
|||
|
||||
#### Built-in Models
|
||||
|
||||
[Type relations](./type-relations.md)
|
||||
[Type relations](../packages/website/src/docs/language-basics/type-relations.md)
|
||||
|
||||
Cadl comes with built-in models for common data types:
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
const syntaxhighlightPlugin = require("@11ty/eleventy-plugin-syntaxhighlight");
|
||||
const cadlPrismDefinition = require("./cadl-prism-lang.js");
|
||||
const { findNavigationEntries } = require("./1tty-utils/navigation.js");
|
||||
const { renderMermaid } = require("./1tty-utils/mermaid.js");
|
||||
const feather = require("feather-icons");
|
||||
const prNumber = process.env["SYSTEM_PULLREQUEST_PULLREQUESTNUMBER"];
|
||||
|
||||
|
@ -18,6 +19,37 @@ module.exports = (eleventyConfig) => {
|
|||
},
|
||||
});
|
||||
|
||||
eleventyConfig.addPlugin((config) => {
|
||||
const syntaxHighligher = config.markdownHighlighter;
|
||||
config.addMarkdownHighlighter((str, language) => {
|
||||
if (language === "mermaid") {
|
||||
return `{MERMAID}${str}{ENDMERMAID}`;
|
||||
}
|
||||
if (syntaxHighligher) {
|
||||
return syntaxHighligher(str, language);
|
||||
}
|
||||
return `<pre class="${language}">${str}</a>`;
|
||||
});
|
||||
});
|
||||
|
||||
eleventyConfig.addTransform("rendermermaid", async (content, outputPath) => {
|
||||
// Eleventy 1.0+: use this.inputPath and this.outputPath instead
|
||||
if (outputPath && outputPath.endsWith(".html")) {
|
||||
const convertPromises = [];
|
||||
const temp = content.replace(/{MERMAID}([\s\S]+){ENDMERMAID}/gm, (match, content) => {
|
||||
const index = convertPromises.length;
|
||||
convertPromises.push(renderMermaid(content));
|
||||
return `{convertingmermaid:${index}}`;
|
||||
});
|
||||
const convert = await Promise.all(convertPromises);
|
||||
return temp.replace(/{convertingmermaid:(\d+)}/g, (match, index) => {
|
||||
return convert[index];
|
||||
});
|
||||
}
|
||||
|
||||
return content;
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("cadlNavigation", findNavigationEntries);
|
||||
|
||||
eleventyConfig.addShortcode("icon", (iconName, attributes = {}) => {
|
||||
|
|
|
@ -6,4 +6,7 @@ module.exports = {
|
|||
env: {
|
||||
browser: true,
|
||||
},
|
||||
rules: {
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
},
|
||||
};
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
<script src="../node_modules/mermaid/dist/mermaid.min.js" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,42 @@
|
|||
// @ts-check
|
||||
const { chromium } = require("playwright");
|
||||
const path = require("path");
|
||||
const url = require("url");
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} definition
|
||||
* @returns
|
||||
*/
|
||||
async function renderMermaid(definition) {
|
||||
const browser = await chromium.launch();
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
const mermaidHTMLPath = path.join(__dirname, "index.html");
|
||||
await page.goto(url.pathToFileURL(mermaidHTMLPath).href);
|
||||
|
||||
const svg = await page.evaluateHandle((definition) => {
|
||||
/** @type {import("mermaid").default } */
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const mermaid = window.mermaid;
|
||||
mermaid.initialize({});
|
||||
// should throw an error if mmd diagram is invalid
|
||||
try {
|
||||
return mermaid.render("container", definition);
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
// mermaid-js doesn't currently throws JS Errors, but let's leave this
|
||||
// here in case it does in the future
|
||||
throw error;
|
||||
} else {
|
||||
throw new Error(error?.message ?? "Unknown mermaid render error");
|
||||
}
|
||||
}
|
||||
}, definition);
|
||||
|
||||
await browser.close();
|
||||
return svg;
|
||||
}
|
||||
|
||||
module.exports = { renderMermaid };
|
|
@ -19,10 +19,11 @@
|
|||
"@types/node": "~16.0.3",
|
||||
"prism-themes": "~1.9.0",
|
||||
"feather-icons": "~4.29.0",
|
||||
"@playwright/test": "~1.25.1",
|
||||
"playwright": "~1.25.1",
|
||||
"mermaid": "~9.1.6",
|
||||
"@cadl-lang/eslint-config-cadl": "~0.4.0",
|
||||
"eslint": "^8.12.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"eslint": "^8.12.0",
|
||||
"rimraf": "~3.0.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@ const toc = {
|
|||
// "enums",
|
||||
// "unions",
|
||||
// "type-literals",
|
||||
// "alias",
|
||||
"aliases",
|
||||
"type-relations",
|
||||
],
|
||||
// "Cadl Standard Library": [
|
||||
// "built-in-types",
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
id: aliases
|
||||
title: Aliases
|
||||
---
|
||||
|
||||
# Alias
|
||||
|
||||
Aliases can be defined for types. This can be helpeful to reuse a complex expression.
|
||||
|
||||
Alias is only a syntax helper, and it has no representation in the type graph. This means that aliases cannot be decorated. Use [`model is`]({{"/docs/language-basics/models" | url}}) to provide an alternate name for a model.
|
||||
|
||||
Alias can be defined using the `alias` keyword
|
||||
|
||||
```cadl
|
||||
alias Options = "one" | "two";
|
||||
```
|
|
@ -4,3 +4,150 @@ title: Models
|
|||
---
|
||||
|
||||
# Models
|
||||
|
||||
Cadl models are used to describe data shapes or schemas.
|
||||
|
||||
## Model kinds
|
||||
|
||||
Models can be used to represent 3 types:
|
||||
|
||||
- [Primitives](#primitives)
|
||||
- [Record](#record)
|
||||
- [Array](#array)
|
||||
|
||||
### Primitives
|
||||
|
||||
These are types without any fields(For example `string`, `int32`, `boolean`, etc.)
|
||||
|
||||
### Record
|
||||
|
||||
Record models are structure with named fields called properties.
|
||||
|
||||
- name can be an `identifier` or `string literal`.
|
||||
- type can be any type reference
|
||||
|
||||
```cadl
|
||||
model Dog {
|
||||
name: string;
|
||||
age: number;
|
||||
}
|
||||
```
|
||||
|
||||
#### Optional properties
|
||||
|
||||
Properties can be marked as optional using the `?` punctuation.
|
||||
|
||||
```cadl
|
||||
model Dog {
|
||||
address?: string;
|
||||
}
|
||||
```
|
||||
|
||||
#### Default values
|
||||
|
||||
[Optional properties](#optional-properties) can be provided with a default value using `=` operator.
|
||||
|
||||
```cadl
|
||||
model Dog {
|
||||
address?: string = "wild";
|
||||
}
|
||||
```
|
||||
|
||||
### Array
|
||||
|
||||
Array are models created using the `[]` syntax which is just a syntactic sugar for using the `Array<T>` model type.
|
||||
|
||||
## Model composition
|
||||
|
||||
### Spread
|
||||
|
||||
The spread operator takes the members of a source model and copies them into a target model. Spread doesn't create any nominal relationship between source and target, and so it's useful when you want to reuse common properties without reasoning about or generating complex inheritance relationships.
|
||||
|
||||
```cadl
|
||||
model Animal {
|
||||
species: string;
|
||||
}
|
||||
|
||||
model Pet {
|
||||
name: string;
|
||||
}
|
||||
|
||||
model Dog {
|
||||
...Animal;
|
||||
...Pet;
|
||||
}
|
||||
|
||||
// Dog is equivalent to the following declaration:
|
||||
model Dog {
|
||||
species: string;
|
||||
name: string;
|
||||
}
|
||||
```
|
||||
|
||||
### Extends
|
||||
|
||||
Sometimes you want to create an explicit relationship between two models, for example when you want to emit class definitions in languages which support inheritance. The `extends` keyword can be used to establish such a relationship.
|
||||
|
||||
```cadl
|
||||
model Animal {
|
||||
species: string;
|
||||
}
|
||||
|
||||
model Dog extends Animal {}
|
||||
```
|
||||
|
||||
## Is
|
||||
|
||||
Sometimes you want to create a new type that is an exact copy of an existing type but with some additional properties or metadata without creating a nominal inheritance relationship. The `is` keyword can be used for this purpose. It copies all the properties(like spread), but copies [decorators]({{"/docs/language-basics/decorators" | url}}) as well. One common use case is to give a better name to a [template](#Templates) instantiation:
|
||||
|
||||
```cadl
|
||||
@decorator
|
||||
model Thing<T> {
|
||||
property: T;
|
||||
}
|
||||
|
||||
model StringThing is Thing<string>;
|
||||
|
||||
// StringThing declaration is equivalent to the following declaration:
|
||||
@decorator
|
||||
model StringThing {
|
||||
property: string;
|
||||
}
|
||||
```
|
||||
|
||||
## Model templates
|
||||
|
||||
It is often useful to let the users of a model fill in certain details. Model templates enable this pattern. Similar to generics found in other languages, model templates declare template parameters that users provide when referencing the model.
|
||||
|
||||
```cadl
|
||||
model Page<T> {
|
||||
size: number;
|
||||
item: T[];
|
||||
}
|
||||
|
||||
model DogPage {
|
||||
...Page<Dog>;
|
||||
}
|
||||
```
|
||||
|
||||
### Default values
|
||||
|
||||
A template parameter can be given a default value with `= <value>`.
|
||||
|
||||
```cadl
|
||||
model Page<T = string> {
|
||||
size: number;
|
||||
item: T[];
|
||||
}
|
||||
```
|
||||
|
||||
### Template constraints
|
||||
|
||||
Template parameter can provide a constraint using the `extends` keyword. See [type-relations]({{"/docs/language-basics/type-relations" | url}}) documentation for details on how validation works.
|
||||
|
||||
```cadl
|
||||
// Expect T to be a model with property name: string
|
||||
model Foo<T extends {name: string}> {}
|
||||
// Expect T to be a string
|
||||
model Bar<T extends string = "Abc"> {}
|
||||
```
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
# Cadl Types
|
||||
---
|
||||
id: type-relations
|
||||
title: Type relations
|
||||
---
|
||||
|
||||
# Types Relations
|
||||
|
||||
## Type hierachy
|
||||
|
Загрузка…
Ссылка в новой задаче